예제 #1
0
        internal void Init()
        {
            this.clientName = "RouterClient." + bridge.windowName;
            var Handshake = new JObject(
                new JProperty("header",
                              new JObject(
                                  new JProperty("origin", clientName),
                                  new JProperty("type", "initialHandshake")
                                  )
                              )
                );

            bridge.Publish("RouterService", Handshake);             //TODO: wait for handshake response
            bridge.Subscribe(clientName, MessageHandler);

            var timer = new Timer(100);

            timer.Elapsed += (s, e) =>
            {
                if (!connected)                                 //retry handshake until connected
                {
                    bridge.Publish("RouterService", Handshake); //TODO: wait for handshake response
                }
                else
                {
                    timer.AutoReset = false;
                    timer.Enabled   = false;
                }
            };
            timer.AutoReset = true;
            timer.Enabled   = true;
        }
예제 #2
0
        internal Docking(Finsemble _bridge, string channel)
        {
            Application.Current.Dispatcher.Invoke(delegate             //main thread
            {
                this.bridge                 = _bridge;
                routerClient                = bridge.RouterClient;
                this.dockingChannel         = channel;
                this.dockingWindow          = bridge.window;
                this.dockingWindowName      = bridge.windowName;
                dockingWindow.Loaded       += Window_Loaded;
                dockingWindow.Closing      += Window_Closing;
                dockingWindow.Activated    += Window_Activated;
                dockingWindow.StateChanged += DockingWindow_StateChanged;
                bridge.Subscribe(dockingChannel, Got_Docking_Message);                                                    // Finsemble 2.3
                routerClient.AddListener("FinsembleNativeActions." + bridge.windowName, Got_Docking_Message_Over_Router); // Finsemble 2.5+
                //dockingWindow.GotMouseCapture += DockingWindow_GotMouseCapture;
                //dockingWindow.LostMouseCapture += DockingWindow_LostMouseCapture;
                //MouseWatcher.OnMouseInput += MouseWatcher_OnMouseInput;

                /*routerClient.AddListener("LauncherService.shutdownRequest", (s, e) =>
                 * {
                 *      sendCloseToFinsemble = false;
                 * });*/
            });
        }