private void AddHotkeyData(string key, Action fun, string description) { var data = new HotkeyData(key, fun); data.DescriptionBinding = description; config.hotkeyDic[key] = data; }
/// <summary> /// 根据 key 获取热键数据 /// </summary> /// <param name="key"></param> /// <returns></returns> public HotkeyData GetHotkeyData(string key) { HotkeyData data = null; config.hotkeyDic.TryGetValue(key, out data); return(data); }
/// <summary> /// 注销热键 /// </summary> /// <param name="key"></param> public void UnregHotkey(string key) { HotkeyData hotkeyData = null; if (config.hotkeyDic.TryGetValue(key, out hotkeyData)) { if (hotkeyData.atom > 0) { atomToHotkeyidDic.Remove(hotkeyData.atom); HotkeyTool.Instance.UnregisterHotkey(hotkeyData.atom); hotkeyData.key = 0; hotkeyData.keyFlag = 0; hotkeyData.atom = 0; hotkeyData.KeyBinding = string.Empty; } } }