Exemple #1
0
 void DataReceived(object sender, MessageReceivedEventArgs args)
 {
     if (this.checkboxData.InvokeRequired)
     {
         SetCheckBoxCallback callback = new SetCheckBoxCallback(DataReceived);
         this.Invoke(callback, new object[] { sender, args });
     }
     else
     {
         System.Threading.Thread.Sleep(1000);
         this.checkboxData.Checked = true;
         this.txtData.Text         = args.Data;
         System.Threading.Thread.Sleep(1000);
         this.checkboxData.Checked = false;
     }
 }
Exemple #2
0
 // Update the state of a checkbox on the form
 private void updateCheckBox(CheckBox checkBox, Boolean onNotOff)
 {
     if (checkBox.InvokeRequired)
     {
         SetCheckBoxCallback update = new SetCheckBoxCallback(_updateCheckBox);
         checkBox.Invoke(update, new object[] { checkBox, onNotOff });
     }
     else
     {
         _updateCheckBox(checkBox, onNotOff);
     }
 }