/// <summary>
        /// User wants to edit a switch. Display the switch edit form
        /// and update the datagridview with the edited data
        /// </summary>
        /// <param name="e">event args</param>
        private void handleEditSwitch(DataGridViewCellEventArgs e)
        {
            var row = dataGridView2.Rows[e.RowIndex];

            Hide();

            var editKeyboardActuatorForm = new EditKeyboardActuatorSwitchForm();

            var checkBoxCell = (dataGridView2.Rows[e.RowIndex].Cells[TriggerColumn.Name]) as DataGridViewCheckBoxCell;

            if (checkBoxCell.Value != null)
            {
                editKeyboardActuatorForm.IsTriggerSelect = (bool)checkBoxCell.Value;
            }

            if (!editKeyboardActuatorForm.IsTriggerSelect)
            {
                editKeyboardActuatorForm.MappedCommand =
                    dataGridView2.Rows[e.RowIndex].Cells[CommandColumn.Name].Value as String;
            }

            editKeyboardActuatorForm.Shortcut =
                dataGridView2.Rows[e.RowIndex].Cells[ShortcutColumn.Name].Value as String;

            var dialogResult = editKeyboardActuatorForm.ShowDialog();

            Show();

            if (dialogResult == DialogResult.OK)
            {
                dataGridView2.Rows[e.RowIndex].Cells[TriggerColumn.Name].Value =
                    editKeyboardActuatorForm.IsTriggerSelect;

                if (editKeyboardActuatorForm.IsTriggerSelect)
                {
                    row.Cells[CommandColumn.Name].Value = _unmappedValue;
                }
                else
                {
                    dataGridView2.Rows[e.RowIndex].Cells[CommandColumn.Name].Value =
                        formatCommandForDisplay(editKeyboardActuatorForm.MappedCommand);
                    dataGridView2.Rows[e.RowIndex].Cells[CommandColumn.Name].Tag =
                        dataGridView2.Rows[e.RowIndex].Cells[CommandColumn.Name].Value;
                }

                if (editKeyboardActuatorForm.ShortcutChanged)
                {
                    dataGridView2.Rows[e.RowIndex].Cells[ShortcutColumn.Name].Value = editKeyboardActuatorForm.Shortcut;
                }

                _isDirty = true;
            }
        }
        private void buttonAddNew_Click(object sender, EventArgs e)
        {
            Hide();

            var editKeyboardActuatorForm = new EditKeyboardActuatorSwitchForm();

            var dialogResult = editKeyboardActuatorForm.ShowDialog();

            Show();

            if (dialogResult == DialogResult.OK)
            {
                var source = editKeyboardActuatorForm.ShortcutChanged ? editKeyboardActuatorForm.Shortcut : String.Empty;

                if (String.IsNullOrEmpty(source))
                {
                    return;
                }

                var switchName = generateSwitchName();

                var command = editKeyboardActuatorForm.MappedCommand;

                var switchSetting = new SwitchSetting(switchName, "Keyboard shortcut", command)
                {
                    Source = source
                };

                if (editKeyboardActuatorForm.IsTriggerSelect)
                {
                    switchSetting.ConfigureAsTriggerSwitch(true);
                    switchSetting.BeepFile = "beep.wav";
                }

                _actuatorSetting.SwitchSettings.Add(switchSetting);

                _isDirty = true;

                refreshDataGridView();
            }
        }