private void EnableControls(bool isEnabled)
        {
            // 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 (txtAppFolder.InvokeRequired)
            {
                var d = new SetEnableControlCallback(EnableControls);
                Invoke(d, new object[] { isEnabled });
            }
            else
            {
                txtAppFolder.Enabled = isEnabled;
                txtAppFolder.Update();
                txtUrl.Enabled = isEnabled;
                txtUrl.Update();
                cmbDefaultLang.Enabled = isEnabled;
                cmbDefaultLang.Update();

                btnBrowseUrl.Enabled = isEnabled;
                btnCancel.Enabled    = isEnabled;
                btnInstall.Enabled   = isEnabled;
                btnUninstall.Enabled = isEnabled;
            }
        }
Exemple #2
0
 public static void SetEnableControl(Control control, bool value)
 {
     if (control.InvokeRequired)
     {
         SetEnableControlCallback callback = new SetEnableControlCallback(SetEnableControl);
         control.Invoke(callback, control, value);
     }
     else
     {
         control.Enabled = value;
     }
 }