示例#1
0
 private void SetText(string text)
 {
     if (this.listBox1.InvokeRequired)
     {
         setArduinoMessage d = new setArduinoMessage(SetText);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         listBox1.Items.Clear();
         listBox1.Items.Add(text);
     }
 }
示例#2
0
 private void SetText(string text)
 {
     if (this.listBox1.InvokeRequired)
     {
         setArduinoMessage d = new setArduinoMessage(SetText);
         listBox1.Invoke(d, new object[] { text });
     }
     else
     {
         try
         {
             string state = getPortThread.ThreadState.ToString();
             if (!isClosed)
             {
                 listBox1.Items.Clear();
                 listBox1.Items.Add(text);
             }
         }
         catch (Exception c)
         {
             MessageBox.Show(c.Message + "2");
         }
     }
 }