public static void SetControlState(Form f, Control c, bool stat)
 {
     if (c.InvokeRequired)
     {
         SetButtonState d = new SetButtonState(SetControlState);
         f.Invoke(d, new object[] { f, c, stat });
     }
     else
     {
         c.Enabled = stat;
     }
 }
Beispiel #2
0
        /// <summary>
        /// The rest of the code is infrastructure of the VoiceXmlSample form, and is not directly related
        /// to VoiceXML functionality
        /// </summary>

        //This initializes form elements such as delegates and control colors
        private void InitializeFormControls()
        {
            SetResultsDelegate     = new SetResultsText(SetResultsTextProc);
            SetButtonStateDelegate = new SetButtonState(SetButtonStateProc);

            // This enables changing the color of all buttons in once place
            buttonColor = Color.Silver;

            hangupCallButton.BackColor  = buttonColor;
            stopBrowserButton.BackColor = buttonColor;
            exitButton.BackColor        = buttonColor;
            hangupCallButton.Enabled    = false;
            stopBrowserButton.Enabled   = false;

            SetStartPage();
        }
Beispiel #3
0
 public Form1()
 {
     btnDelegate = SetBtnState;
     msgDelegate = ShowMsgBox;
     InitializeComponent();
 }