public static IpcPipeDuplex <IBrowserWindow, IBrowserHost> CreateClientDuplex(int parentId, Func <IBrowserWindow> factory)
 {
     return(new IpcPipeDuplex <IBrowserWindow, IBrowserHost>(new IpcDuplexParameters <IBrowserWindow>
     {
         ClientPipe = ElectroliteCommon.ElectroliteHost(parentId),
         ServerEndpoint = ElectroliteCommon.ElectroliteBrowserEndpoint(parentId),
         ServerPipe = ElectroliteCommon.ElectroliteBrowser(parentId),
         ServerFactory = (service => factory())
     }));
 }
Esempio n. 2
0
        public IpcSession(IIpcPlatformAdapter adapter, Uri url, ElectroliteOptions options)
        {
            _adapter       = adapter;
            Url            = url;
            StartupOptions = options;
            var processId = Process.GetCurrentProcess().Id;

            _duplex = new IpcPipeDuplex <IBrowserHost, IBrowserWindow>(new IpcDuplexParameters <IBrowserHost>
            {
                ClientPipe     = ElectroliteCommon.ElectroliteBrowser(processId),
                ServerEndpoint = ElectroliteCommon.ElectroliteHostEndpoint(processId),
                ServerPipe     = ElectroliteCommon.ElectroliteHost(processId),
                ServerFactory  = provider => new BrowserHost(this)
            });
            _source      = new CancellationTokenSource();
            _startWaiter = new TaskCompletionSource <bool>();
        }