Can windows CDO's be RPT enabled? - ocean

Does anyone know if it is possible to RPT enable windows custom domain objects (e.g. child of a 2D window). It does not seem to work when implemented the same way as for other custom domain objects...

Yes this should be possible by letting your CDOs implement the Slb.Ocean.Petrel.Basics.ISyncable interface.

Related

Checking for previous instance of application

I am trying to write a code to check previous instance of the application in vb.net, my requirement is that application should prevent for same user and it should allow for different user who wants to access through remote parellel 2x client..Any one please help me on this...Thanks
If you are using VB.Net, You should definetly look into WindowsFormsApplicationBase class, shipped as part of .NET framework.
There is a property (IsSingleInstance) specifically designed to provide single instance behavior to the application.
You can even receive notifications through StartupNextInstance or the counterpart OnStartupNextInstance method when another instance of the application tries to run.
I forgot to mention that My.Application already is an object of the WindowsFormsApplicationBase type (at least in VB.NET WinForms applications).
UPDATE:
Currently, to take advantage of this stuff from a VB.NET project you have to follow these steps:
Edit project properties.
Enable "Make single instance application".
Click "View Application Events".
(optionally) Implement StartupNextInstance event handler.

How to share an instance of a singleton class between two windows

I am working with small electron application, and I want to ask one small question.
I need to share a singleton class instance between different two windows of my app.
“Share” means instance which has each class is the same and variables of the instance are the same.
I used affinity parameter in the BrowserWindow() constructor to run two windows in the same renderer process. I suppose if the two windows run in the same process, the two windows share the instance. But actually, the instance and the values of the instance are different.
Is this a correct behavior?
1.If so, could you tell me another way to share an instance between two windows?
2.If not, is this a bug? Or do I need to set another parameter?
affinity option exposes control to chromimum's process model (https://github.com/electron/electron/issues/11484 / https://www.chromium.org/developers/design-documents/process-models) and none of chromium's process model allows share hosted page's context between. Running two site in single process doesn't necessarily mean two hosted sites shares context, especially it exposes whole security concerns around.
There is no such thing for singleton in electron, at least from out of box supported way via electron's supported api surface. Though it's not true sharing, sync via ipc is nearly only way to go.
i use window.open() method to create new BrowserWindow, when use this method, you can paas your javascript singleton class by window
render-process
const modal = window.open(filePath, 'xxx');
modal.window.singletonClass = window.singletonClass;
main process
mainWindow.webContents.on('new-window', ()=> {});

Is it possible, in WCF, to add a global message inspector?

There are a bunch of questions regarding global error handlers and such but none of those address what I need.
Is there any way to add a behavior that will attach to every endpoint or service through .config?
*Specifically what I want to do is add a logger that will capture and log every SOAP request/response. But I would prefer that behavior to be automatically added to every service I have instead of having to manually add it to each.
I looked into behavior extensions and thought that would be the solution but no, you have to add the behavior to every service.*
You may be able to use the <commonBehaviors> section of your machine.config file to define a behavior which would be applied to all services in your machine. Notice that updating the machine.config is really like using a bazooka to solve your problem (and in many scenarios the group policy may forbid you from doing that), so it may not work for all scenarios. You'll also need to make sure that the behavior extension is registered (also in machine.config), and that whatever application you're using with WCF has access to the assembly referenced in the extension (possibly via GAC).
Another alternative would be to use a common library for creating the service hosts (either directly for self-hosted services or via a service host factory for webhosted services), and use that library (which would in turn add the inspector).
Its always good to have a message inspector to get rid of this kind of problem. Message Inspector is an implementation of WCF extension which works nicely to track every incoming request(s) and outgoing response(s) for your service, even if its fails in Message Validation it has an option to trap and work accordingly. More precisely the message inspector can configure using configuration files without making changes in your existing service.
More details about your Message inspector and its implementation can be found Here
Hope this helps !!
Happy Coding :)

How to write a WCF service similar to Running Object Table (ROT)?

I am trying to write a running object table like WCF service (.NET 4.0) for providing access to some COM controls across processes. This service is accessed by both COM and .NET clients.
I chose WCF since it is recommended for inter-process communication and I also thought it would be good if I don't have to depend on ROT where I don't have much control over.
After solving several hiccups, I reached a road block. I don't know how to pass the COM control through the service and give it back to a client. The object never reaches the service. Though WCF is recommended for IPC, it does not provide out of the box support to pass COM objects. I also haven't found any solutions so far. May be WCF service is not the right approach to replace running object table. But I don't see a better way to do IPC.
Any suggestions on this?
A COM objref can't be passed around in a WCF message (well I guess you could create a MEOW interpreter on the receiver size and use CoMarshalInterThreadInterfaceInStream to pass the objref)
However, you could put the objects in the GIT and pass the GIT cookies around
But we can directly place COM object into the ROT by implementing IUNKNOWn interface

Session Per ViewModel in Desktop Application with Repository

I have been writing a WPF DESKTOP application using NHibernate, WPF, Prism and Unity Container but have a problem in terms of Session Management in Services / Repositories and how to do it cleanly through dependency injection using Unity.
Having read Building A Desktop To Do-Application With NHibernate I now have a Session Per ViewModel / Presenter.
However, if I have several services on my viewmodel I have to pass the Session into each and every service which seems cumbersome and not quite right as I want to perform all data access through a repository.
e.g
CustomerMaintenanceViewModel
{
service1.Session = SessionForThisPresenter;
service2.Session = SessionForThisPresenter;
service3.Session = SessionForThisPresenter;
service1.GetAllSomething();
service2.GetAllSomething();
service3.GetAllSomething();
}
Each service is essentially a facade over a repository and I would want each repository for this presenter to be involved in the same session without explicitly setting it.
Any advice on how to handle this would be most appreciated as I am sure there is a solution quite close but I am not sure how to do it.
I suggest you look into uNhAddIns.
It has a full WPF example using MVVM.