예제 #1
0
 void OnExited(object sender, EventArgs eventArgs)
 {
     if (_proc != sender)
     {
         return;
     }
     _conn?.Dispose();
     _conn = null;
     _proc = null;
     _dispatcher.Post(_ =>
     {
         HandleExited();
     }, null);
 }
예제 #2
0
        public MainWindow()
        {
            this.InitializeComponent();
            var tb = this.FindControl <TextBox>("Xaml");

            tb.Text = InitialXaml;
            var scroll = this.FindControl <ScrollViewer>("Remote");
            var rem    = new Center();

            scroll.Content   = rem;
            _errorsContainer = this.FindControl <Control>("ErrorsContainer");
            _errors          = this.FindControl <TextBlock>("Errors");
            tb.GetObservable(TextBox.TextProperty).Subscribe(text => _connection?.Send(new UpdateXamlMessage
            {
                Xaml = text
            }));
            new BsonTcpTransport().Listen(IPAddress.Loopback, 25000, t =>
            {
                Dispatcher.UIThread.Post(() =>
                {
                    if (_connection != null)
                    {
                        _connection.Dispose();
                        _connection.OnMessage -= OnMessage;
                    }
                    _connection = t;
                    rem.Child   = _remote = new RemoteWidget(t);
                    t.Send(new UpdateXamlMessage
                    {
                        Xaml = tb.Text
                    });

                    t.OnMessage += OnMessage;
                });
            });
            Title = "Listening on 127.0.0.1:25000";
        }
 public void Dispose() => _conn.Dispose();