示例#1
0
 private void btnDeleteHotKey_Click(object sender, EventArgs e)
 {
     if (hotKeyBindingSource.Current != null)
     {
         HotKeyManager.DeleteHotKey((HotKey)hotKeyBindingSource.Current);
         RefreshGrid();
     }
 }
示例#2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (_mode == HotKeyFormMode.Normal && HotKeyManager.DuplicateHotKey(_hotkey))
            {
                return;
            }

            if (_mode == HotKeyFormMode.Edit)
            {
                HotKeyManager.DeleteHotKey(_linkedHotKey);
            }

            //Add HK
            if (HotKeyManager.AddHotKey(_hotkey))
            {
                DialogResult = DialogResult.OK;
                Close();
            }
            else
            {
                errorProvider1.SetError(txtHotKey, "Hot Key is already registered");
            }
        }