Пример #1
0
 private void Netconnect_Click(object sender, RoutedEventArgs e)
 {
     if ((bool)netconnect.IsChecked)
     {
         if (iptextbox.Text == string.Empty || porttextbox.Text == string.Empty)
         {
             _messageServer.AddWindowsMsg("请正确填写网络信息");
         }
         else
         {
             if (_netServer.Start(iptextbox.Text, Convert.ToUInt16(porttextbox.Text)))
             {
                 _messageServer.AddMsg(_messageServer._netBindList, $" > Start Server success !");
                 startListen.IsEnabled = true;
             }
             else
             {
                 _messageServer.AddWindowsMsg("网络服务启动失败!");
             }
         }
     }
     else
     {
         if (_netServer.Stop())
         {
             ;
         }
         else
         {
             _messageServer.AddWindowsMsg("网络服务停止失败!");
         }
     }
 }
Пример #2
0
        private void OnRxEndPointData(object sender, EndpointDataEventArgs e)
        {
            _msgserver.AddMsg(_msgserver._usbBindList, $" > {e.Count} data received");

            _actionBlock.Post(e.Buffer);
        }