Exemplo n.º 1
0
        /// <inheritdoc />
        public override void UnregisterHotKey(VirtualKeys key, Modifiers modifiers)
        {
            // remove no repeat before adding to list to avoid getting different hash
            modifiers = (Modifiers)((uint)modifiers & 0xF);

            KeyModifierCombination combination = new KeyModifierCombination(key, modifiers);

            if (!HotKeys.ContainsKey(combination))
            {
                String error = $"Failed to unregister hotKey : HotKey \"{key}+{modifiers}\" is not registered";
                Logger.Warn(error);
                throw new HotKeyException(error);
            }

            try
            {
                HotKey tmpHotKey = HotKeys[combination];
                tmpHotKey.UnregisterHotKey();
                HotKeysId.Remove(tmpHotKey.Id);
                HotKeys.Remove(combination);
            }
            catch (HotKeyException e)
            {
                Logger.Warn("Failed to unregister hotKey : {0}", e.Message);
                throw;
            }
        }
Exemplo n.º 2
0
        public void RemoveHotKey(HotKey hotKey, bool save = true)
        {
            var existing = HotKeys.FirstOrDefault(x => x.HotKey.Equals(hotKey));

            if (existing != null)
            {
                HotKeys.Remove(existing);
            }
            if (save)
            {
                Save();
            }
        }
Exemplo n.º 3
0
 private void DeleteHotKey(ConfiguredHotKeyViewModel vm)
 {
     HotKeys.Remove(vm);
     CloseEditDialog(vm);
     SaveHotKeysToFile();
 }
Exemplo n.º 4
0
 public bool Remove(string key)
 {
     return(HotKeys.Remove(key));
 }