public void EnableButton(Button b)
 {
     if (b.InvokeRequired)
     {
         EnableButtonCallback ebc = new EnableButtonCallback(EnableButton);
         this.Invoke(ebc, new object[] { b });
     }
     else
     {
         b.Enabled = true;
     }
 }
Exemple #2
0
 private void EnableButtonDeepSleep(bool enable)
 {
     if (this.buttonDeepSleep.InvokeRequired)
     {
         EnableButtonCallback d1 = new EnableButtonCallback(EnableButtonDeepSleep);
         this.Invoke(d1, new object[] { enable });
     }
     else
     {
         this.buttonDeepSleep.Enabled = enable;
     }
 }
 public void EnableButton(bool enable)
 {
     // InvokeRequired required compares the thread ID of the calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.buttonOK.InvokeRequired)
     {
         EnableButtonCallback enableCallback = new EnableButtonCallback(EnableButton);
         this.Invoke(enableCallback, new object[] { enable });
     }
     else
     {
         this.buttonOK.Visible = enable;
     }
 }
Exemple #4
0
 private void EnableButton(bool text)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.textBox1.InvokeRequired)
     {
         EnableButtonCallback d = new EnableButtonCallback(EnableButton);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         //this.button1.Enabled = text;
     }
 }
Exemple #5
0
 private void EnableLocalSwitch(bool shouldEnable)
 {
     if (this.button6.InvokeRequired)
     {
         EnableButtonCallback d = new EnableButtonCallback(EnableLocalSwitch);
         this.Invoke(d, new object[] { shouldEnable });
     }
     else
     {
         try
         {
             button6.Enabled = shouldEnable;
         }
         catch (ObjectDisposedException)
         {
             // Deliberately do nothing -- the UI is gone anyway
         }
     }
 }
Exemple #6
0
 private void EnableButtonSleep(bool enable)
 {
     if (this.buttonSleep.InvokeRequired)
     {
         EnableButtonCallback d1 = new EnableButtonCallback(EnableButtonSleep);
         this.Invoke(d1, new object[] { enable });
     }
     else
     {
         this.buttonSleep.Enabled = enable;
     }
 }
Exemple #7
0
 private void EnableButton(Button button)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (button.InvokeRequired)
     {
         EnableButtonCallback d = new EnableButtonCallback(EnableButton);
         this.Invoke(d, new object[] { button });
     }
     else
     {
         button.Enabled = true;
     }
 }
Exemple #8
0
 private void EnableRemoteSwitch(bool shouldEnable)
 {
     if (this.button4.InvokeRequired)
     {
         EnableButtonCallback d = new EnableButtonCallback(EnableRemoteSwitch);
         this.Invoke(d, new object[] { shouldEnable });
     }
     else
     {
         try
         {
             button4.Enabled = shouldEnable;
         }
         catch (ObjectDisposedException)
         {
             // Deliberately do nothing -- the UI is gone anyway
         }
     }
 }