Ejemplo n.º 1
0
 private void SetButtonEnabled(bool enabled)
 {
     // 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 (buttonConvert.InvokeRequired)
     {
         BooleanArgReturningVoidDelegate d = new BooleanArgReturningVoidDelegate(SetButtonEnabled);
         Invoke(d, new object[] { enabled });
     }
     else
     {
         buttonConvert.Enabled = enabled;
     }
 }
Ejemplo n.º 2
0
        // If the calling thread is the same as the thread that created
        // the TextBox control, the Text property is set directly.

        private void SetGrpBoxState(Boolean trueOrfalse)
        {
            // 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.grpParams.InvokeRequired)
            {
                BooleanArgReturningVoidDelegate d = new BooleanArgReturningVoidDelegate(SetGrpBoxState);
                this.Invoke(d, new object[] { trueOrfalse });
            }
            else
            {
                this.grpParams.Enabled = trueOrfalse;
            }
        }