Beispiel #1
0
 void setButtonEnabled(Button btn, bool value)
 {
     if (btn.InvokeRequired)
     {
         SetButtonEnabledCallback d = new SetButtonEnabledCallback(setButtonEnabled);
         this.Invoke(d, new object[] { btn, value });
     }
     else
     {
         btn.Enabled = value;
     }
 }
Beispiel #2
0
 public void SetButtonEnabled(Button b, Boolean enabled)
 {
     if (b.InvokeRequired)
     {
         SetButtonEnabledCallback d = new SetButtonEnabledCallback(SetButtonEnabled);
         this.Invoke(d, new Object[] { b, enabled });
     }
     else
     {
         b.Enabled = enabled;
     }
 }
Beispiel #3
0
 /// <summary>
 /// Set text property of various controls
 /// </summary>
 /// <param name="form">The calling form</param>
 /// <param name="control"></param>
 /// <param name="enabled"></param>
 public static void SetButtonEnabled(Form form, Control control, 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 (control.InvokeRequired)
     {
         var setButtonEnabledCallback = new SetButtonEnabledCallback(SetButtonEnabled);
         form.Invoke(setButtonEnabledCallback, form, control, enabled);
     }
     else
     {
         control.Enabled = enabled;
     }
 }
Beispiel #4
0
 private void SetButton(bool b)
 {
     if (this.btn.InvokeRequired)
     {
         SetButtonEnabledCallback d = new SetButtonEnabledCallback(SetButton);
         this.Invoke(d, new object[] { b });
     }
     else
     {
         if (b)
         {
             this.btn.Text = "作成開始";
         }
         else
         {
             this.btn.Text = "作成中";
         }
         this.btn.Enabled = b;
     }
 }
Beispiel #5
0
        private void _testOnConsoleTrace(String text)
        {
            String printString = DateTime.UtcNow.ToLongTimeString() + ": " + text;

            if (textBoxDebug.TextLength + printString.Length + Environment.NewLine.Length > textBoxDebug.MaxLength)
            {
                textBoxDebug.Text = textBoxDebug.Text.Remove(textBoxDebug.TextLength - printString.Length - Environment.NewLine.Length);
            }
            textBoxDebug.Text = printString + Environment.NewLine + textBoxDebug.Text;

            if (text.Trim().Equals("MessageCodec::ready."))
            {
                Boolean enabled;

                messageCodecReady = true;
                enabled = buttonConnectEnableOk();
                // Set up the buffer for sending messages
                txDatagramBuffer = new byte[messageCodec.maxDatagramSizeRaw()];

                // Enable the connect button if it can be (across threads)
                if (buttonConnect.InvokeRequired)
                {
                    SetButtonEnabledCallback update = new SetButtonEnabledCallback(_updateButtonEnabled);
                    buttonConnect.Invoke(update, new object[] { buttonConnect, enabled });
                }
                else
                {
                    _updateButtonEnabled(buttonConnect, enabled);
                }

            }
        }