public BrowserManager(
     JavaScriptBridge javaScriptBridge,
     BcfierJavascriptInterop javascriptInterop,
     ChromiumWebBrowser chromiumWebBrowser,
     IDownloadHandler downloadHandler,
     IRequestHandler requestHandler,
     ILifeSpanHandler lifeSpanHandler)
 {
     _javaScriptBridge   = javaScriptBridge;
     _javascriptInterop  = javascriptInterop;
     _chromiumWebBrowser = chromiumWebBrowser;
     _downloadHandler    = downloadHandler;
     _requestHandler     = requestHandler;
     _lifeSpanHandler    = lifeSpanHandler;
 }
Example #2
0
        public static void StartIpcCommunication(JavaScriptBridge javaScriptBridge, int serverPort, int clientPort)
        {
            var server = new IpcServer();

            server.Start(serverPort);
            server.ReceivedRequest += (sender, e) =>
            {
                var deserialized = JsonConvert.DeserializeObject <WebUiMessageEventArgs>(e.Request);
                javaScriptBridge.SendMessageToOpenProject(
                    deserialized.MessageType, deserialized.TrackingId, deserialized.MessagePayload);
            };

            var client = new IpcClient();

            client.Initialize(clientPort);
            javaScriptBridge.OnWebUiMessageReceived += (s, e) => client.Send(JsonConvert.SerializeObject(e));
        }