コード例 #1
0
        public Console(WxhtpClient client, WxhtpServiceServer wxhtpServiceServer, CancellationToken ct)
        {
            InitializeComponent();

            _wxhtpClient        = client;
            _wxhtpServiceServer = wxhtpServiceServer;
            _ct             = ct;
            DataContext     = dc;
            Loaded         += MainWindow_Loaded;
            Title           = Title + " " + _wxhtpClient.getTcpClient().Client.RemoteEndPoint.ToString();
            cmdexecListener = new CmdExecListener();
            Closing        += new CancelEventHandler(MainWindow_Closing);
        }
コード例 #2
0
        //public async Task UpdateIncomingWithDelay()
        //{
        //    await Task.Delay(5000);
        //    ((ViewModel)DataContext).sessions[0].Incoming = 25;
        //}

        private async void btnStart_Clicked(object sender, RoutedEventArgs e)
        {
            if (_wxhtpServiceServer != null)
            {
                _wxhtpServiceServer.Stop();
                _wxhtpServiceServer = null;
            }
            _wxhtpServiceServer = new WxhtpServiceServer(Utils.GetAllLocalIPv4(NetworkInterfaceType.Wireless80211).FirstOrDefault(), 56432, ViewModelSession);
            _wxhtpServiceServer.Start();
            connectionListener.Subscribe(connInfoListener, ViewModelSession, _wxhtpServiceServer);

            LabelAppStatus.Content = "Server started";

            await _wxhtpServiceServer.Run();
        }
コード例 #3
0
        private void btnStop_Clicked(object sender, RoutedEventArgs e)
        {
            try
            {
                if (connectionListener.isSubscribed)
                {
                    connectionListener.UnsubscribeAsync();
                }
                _wxhtpServiceServer?.Stop();
                _wxhtpServiceServer = null;

                LabelAppStatus.Content = string.Format("Server stopped");
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Exception in btnStop " + ex);
            }
        }