Beispiel #1
0
 private void SetButtonState(Button button, bool enabled)
 {
     if (button.InvokeRequired)
     {
         SetButtonStateDelegate d = new SetButtonStateDelegate(SetButtonState);
         button.Invoke(d, new object[] { button, enabled });
     }
     else
     {
         button.Enabled = enabled;
     }
 }
Beispiel #2
0
 private void SetButtonState(bool state)
 {
     if (Start_BTN.InvokeRequired)
     {
         try
         {
             // update textbox asynchronously
             SetButtonStateDelegate ut = new SetButtonStateDelegate(SetButtonState);
             //if (this.IsHandleCreated && !this.IsDisposed)
             this.BeginInvoke(ut, new object[] { state });
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error: " + ex.Message);
         }
     }
     else
     {
         Start_BTN.Enabled = state;
     }
 }