private bool SaveValues()
        {
            try {
                var rows = int.Parse(textBoxRows.Text);
                var cols = int.Parse(textBoxColumns.Text);

                if (rows * cols > 20)
                {
                    var result =
                        MessageBox.Show(this,
                                        (rows * cols) + " desktops is not recommended for windows performance. Continue?",
                                        "Warning",
                                        MessageBoxButtons.YesNo,
                                        MessageBoxIcon.Warning);
                    if (result != DialogResult.Yes)
                    {
                        return(false);
                    }
                }

                if (rows * cols < settings.Rows * settings.Columns)
                {
                    MessageBox.Show(this, "Unrequired desktops will not be removed");
                }
                else if (rows * cols > settings.Rows * settings.Columns)
                {
                    MessageBox.Show(this, "More desktops will be created to fill the grid if necessary");
                }

                settings.Rows    = rows;
                settings.Columns = cols;
            } catch {
                MessageBox.Show(this, "Values for Rows and Columns must be numbers only");
                return(false);
            }

            settings.WrapAround = checkBoxWrapAround.Checked;

            settings.ActivateWebBrowserOnSwitch = checkBoxActivateWebBrowser.Checked;

            if (!settings.ApplySettings())
            {
                MessageBox.Show(this, "Failed to apply settings", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (!settings.Save())
            {
                MessageBox.Show(this, "Failed to save settings to file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            return(true);
        }
        private bool SaveValues()
        {
            try {
                var rows = int.Parse(textBoxRows.Text);
                var cols = int.Parse(textBoxColumns.Text);

                if (rows * cols > 20)
                {
                    var result =
                        MessageBox.Show(this,
                                        (rows * cols) + " desktops is not recommended for windows performance. Continue?",
                                        "Warning",
                                        MessageBoxButtons.YesNo,
                                        MessageBoxIcon.Warning);
                    if (result != DialogResult.Yes)
                    {
                        return(false);
                    }
                }

                if (rows * cols < settings.Rows * settings.Columns)
                {
                    MessageBox.Show(this, "Unrequired desktops will not be removed");
                }
                else if (rows * cols > settings.Rows * settings.Columns)
                {
                    MessageBox.Show(this, "More desktops will be created to fill the grid if necessary");
                }

                settings.Rows    = rows;
                settings.Columns = cols;
            } catch {
                MessageBox.Show(this, "Values for Rows and Columns must be numbers only");
                return(false);
            }

            settings.WrapAround = checkBoxWrapAround.Checked;

            settings.SwitchModifiers.Ctrl  = checkBoxCtrlModifierSwitch.Checked;
            settings.SwitchModifiers.Win   = checkBoxWinModifierSwitch.Checked;
            settings.SwitchModifiers.Alt   = checkBoxAltModifierSwitch.Checked;
            settings.SwitchModifiers.Shift = checkBoxShiftModifierSwitch.Checked;

            settings.MoveModifiers.Ctrl  = checkBoxCtrlModifierMove.Checked;
            settings.MoveModifiers.Win   = checkBoxWinModifierMove.Checked;
            settings.MoveModifiers.Alt   = checkBoxAltModifierMove.Checked;
            settings.MoveModifiers.Shift = checkBoxShiftModifierMove.Checked;

            settings.FKeysForNumbers      = checkBoxFKeys.Checked;
            settings.NumPadKeysForNumbers = checkBoxNumPadKeys.Checked;

            settings.StickyWindowHotKey.Modifiers.Ctrl  = checkBoxCtrlModifierSticky.Checked;
            settings.StickyWindowHotKey.Modifiers.Win   = checkBoxWinModifierSticky.Checked;
            settings.StickyWindowHotKey.Modifiers.Alt   = checkBoxAltModifierSticky.Checked;
            settings.StickyWindowHotKey.Modifiers.Shift = checkBoxShiftModifierSticky.Checked;
            settings.StickyWindowHotKey.Key             = (Keys)comboBoxKeySticky.SelectedItem;

            settings.AlwaysOnTopHotkey.Modifiers.Ctrl  = checkBoxCtrlModifierAlwaysOnTop.Checked;
            settings.AlwaysOnTopHotkey.Modifiers.Win   = checkBoxWinModifierAlwaysOnTop.Checked;
            settings.AlwaysOnTopHotkey.Modifiers.Alt   = checkBoxAltModifierAlwaysOnTop.Checked;
            settings.AlwaysOnTopHotkey.Modifiers.Shift = checkBoxShiftModifierAlwaysOnTop.Checked;
            settings.AlwaysOnTopHotkey.Key             = (Keys)comboBoxAlwaysOnTopKey.SelectedItem;

            settings.ActivateWebBrowserOnSwitch = checkBoxActivateWebBrowser.Checked;

            if (!settings.ApplySettings())
            {
                MessageBox.Show(this, "Failed to apply settings", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (!settings.Save())
            {
                MessageBox.Show(this, "Failed to save settings to file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            return(true);
        }
        private bool SaveValues()
        {
            try {
                var rows = int.Parse(textBoxRows.Text);
                var cols = int.Parse(textBoxColumns.Text);

                if (rows * cols > 20)
                {
                    var result =
                        MessageBox.Show(this,
                                        (rows * cols) + " desktops is not recommended for windows performance. Continue?",
                                        "Warning",
                                        MessageBoxButtons.YesNo,
                                        MessageBoxIcon.Warning);
                    if (result != DialogResult.Yes)
                    {
                        return(false);
                    }
                }

                if (rows * cols < settings.Rows * settings.Columns)
                {
                    MessageBox.Show(this, "Unrequired desktops will not be removed");
                }
                else if (rows * cols > settings.Rows * settings.Columns)
                {
                    MessageBox.Show(this, "More desktops will be created to fill the grid if necessary");
                }

                settings.Rows    = rows;
                settings.Columns = cols;
            } catch {
                MessageBox.Show(this, "Values for Rows and Columns must be numbers only");
                return(false);
            }

            settings.WrapAround = checkBoxWrapAround.Checked;

            settings.SwitchDirModifiers.Ctrl  = checkBoxCtrlModifierSwitchDir.Checked;
            settings.SwitchDirModifiers.Win   = checkBoxWinModifierSwitchDir.Checked;
            settings.SwitchDirModifiers.Alt   = checkBoxAltModifierSwitchDir.Checked;
            settings.SwitchDirModifiers.Shift = checkBoxShiftModifierSwitchDir.Checked;
            settings.SwitchDirEnabled         = checkBoxEnabledSwitchDir.Checked;

            settings.MoveDirModifiers.Ctrl  = checkBoxCtrlModifierMoveDir.Checked;
            settings.MoveDirModifiers.Win   = checkBoxWinModifierMoveDir.Checked;
            settings.MoveDirModifiers.Alt   = checkBoxAltModifierMoveDir.Checked;
            settings.MoveDirModifiers.Shift = checkBoxShiftModifierMoveDir.Checked;
            settings.MoveDirEnabled         = checkBoxEnabledMoveDir.Checked;

            settings.ArrowKeysEnabled = checkBoxArrowKeys.Checked;

            settings.LeftKey  = GetKeyFromComboBox(comboBoxLeft);
            settings.RightKey = GetKeyFromComboBox(comboBoxRight);
            settings.UpKey    = GetKeyFromComboBox(comboBoxUp);
            settings.DownKey  = GetKeyFromComboBox(comboBoxDown);

            settings.SwitchPosModifiers.Ctrl  = checkBoxCtrlModifierSwitchPos.Checked;
            settings.SwitchPosModifiers.Win   = checkBoxWinModifierSwitchPos.Checked;
            settings.SwitchPosModifiers.Alt   = checkBoxAltModifierSwitchPos.Checked;
            settings.SwitchPosModifiers.Shift = checkBoxShiftModifierSwitchPos.Checked;
            settings.SwitchPosEnabled         = checkBoxEnabledSwitchPos.Checked;

            settings.MovePosModifiers.Ctrl  = checkBoxCtrlModifierMovePos.Checked;
            settings.MovePosModifiers.Win   = checkBoxWinModifierMovePos.Checked;
            settings.MovePosModifiers.Alt   = checkBoxAltModifierMovePos.Checked;
            settings.MovePosModifiers.Shift = checkBoxShiftModifierMovePos.Checked;
            settings.MovePosEnabled         = checkBoxEnabledMovePos.Checked;

            settings.FKeysEnabled   = checkBoxFKeys.Checked;
            settings.NumbersEnabled = checkBoxNumbers.Checked;

            for (int i = 0; i < desktopCombos.Length; ++i)
            {
                settings.DesktopKeys[i] = GetKeyFromComboBox(desktopCombos[i]);
            }

            settings.StickyWindowHotKey.Modifiers.Ctrl  = checkBoxCtrlModifierSticky.Checked;
            settings.StickyWindowHotKey.Modifiers.Win   = checkBoxWinModifierSticky.Checked;
            settings.StickyWindowHotKey.Modifiers.Alt   = checkBoxAltModifierSticky.Checked;
            settings.StickyWindowHotKey.Modifiers.Shift = checkBoxShiftModifierSticky.Checked;
            settings.StickyWindowHotKey.Key             = GetKeyFromComboBox(comboBoxKeySticky);
            settings.StickyWindowEnabled = checkBoxEnabledSticky.Checked;

            settings.AlwaysOnTopHotkey.Modifiers.Ctrl  = checkBoxCtrlModifierAlwaysOnTop.Checked;
            settings.AlwaysOnTopHotkey.Modifiers.Win   = checkBoxWinModifierAlwaysOnTop.Checked;
            settings.AlwaysOnTopHotkey.Modifiers.Alt   = checkBoxAltModifierAlwaysOnTop.Checked;
            settings.AlwaysOnTopHotkey.Modifiers.Shift = checkBoxShiftModifierAlwaysOnTop.Checked;
            settings.AlwaysOnTopHotkey.Key             = GetKeyFromComboBox(comboBoxAlwaysOnTopKey);
            settings.AlwaysOnTopEnabled = checkBoxEnabledAlwaysOnTop.Checked;

            if (!settings.ApplySettings())
            {
                MessageBox.Show(this, "Failed to apply settings", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (!settings.Save())
            {
                MessageBox.Show(this, "Failed to save settings to file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            return(true);
        }