Пример #1
0
 /// <summary>
 /// 接收到的数据,写入文本框内
 /// </summary>
 /// <param name="data"></param>
 private void OnComReceiveData(object sender, string data)
 {
     Application.Current.Dispatcher.Invoke(new EventHandler(delegate
     {
         ReceiveTextBox.AppendText($"接收:{data}\n");
     }));
 }
Пример #2
0
 /// <summary>
 /// 输入到显示区域
 /// </summary>
 /// <param name="content"></param>
 private void AddContent(string content)
 {
     this.BeginInvoke(new MethodInvoker(delegate //在创建控件的基础句柄所在线程上异步执行指定委托。
     {
         if (ReceiveTextBox.Text.Length > 0)     //存在内容
         {
             ReceiveTextBox.AppendText("\r\n");  //换行
         }
         ReceiveTextBox.AppendText(content);
     }));
 }
        private void JournalingReceiveBox(string text, int code)
        {
            this.AcceptJournalingCode(code);

            ReceiveTextBox.AppendText(text);
        }