Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Configure"/> class.
        /// </summary>
        public Configure()
        {
            InitializeComponent();
            this.Icon = Properties.Resources.Icon;

            // Put this in a try...catch so that if the registry keys don't exist we don't throw an ugly exception.
            try
            {
                checkBoxDisableAutomaticButtons.Checked = !MicrosoftMceTransceiver.CheckAutomaticButtons();
            }
            catch
            {
                checkBoxDisableAutomaticButtons.Enabled = false;
            }
        }
Exemple #2
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (checkBoxDisableAutomaticButtons.Enabled)
            {
                try
                {
                    bool changeMade = false;

                    bool keysExist = MicrosoftMceTransceiver.CheckAutomaticButtons();

                    if (checkBoxDisableAutomaticButtons.Checked && keysExist)
                    {
                        MicrosoftMceTransceiver.DisableAutomaticButtons();
                        changeMade = true;
                    }
                    else if (!checkBoxDisableAutomaticButtons.Checked && !keysExist)
                    {
                        MicrosoftMceTransceiver.EnableAutomaticButtons();
                        changeMade = true;
                    }

                    if (changeMade)
                    {
                        MessageBox.Show(this,
                                        "You must restart the computer for changes to automatic button handling to take effect",
                                        "Restart required", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.ToString(), "Error modifiying the system registry", MessageBoxButtons.OK);
                }
            }

            DialogResult = DialogResult.OK;
            Close();
        }