public bool UnregisterHotKey(Form form, HotKeyId id) { bool result = User32.UnregisterHotKey(form.Handle, (int)id); hotkeyDictionary.Remove(getHotKeyCharFromId(id)); return(result); }
public bool RegisterHotkey(Form form, char key, HotKeyId id) { bool result = User32.RegisterHotKey(form.Handle, (int)id, getModifier().Modifier, (int)(Char.ToUpper(key))); if (result) { saveHotkey(key, id); } return(result); }
private char getHotKeyCharFromId(HotKeyId hkid) { switch (hkid) { case HotKeyId.HKID_NEW: return(Properties.Settings.Default.HotkeyNewSession); case HotKeyId.HKID_MINIMIZE: return(Properties.Settings.Default.HotkeyMinimize); case HotKeyId.HKID_SESSION_1: return(Properties.Settings.Default.HotkeySession1); case HotKeyId.HKID_SESSION_2: return(Properties.Settings.Default.HotkeySession2); case HotKeyId.HKID_SESSION_3: return(Properties.Settings.Default.HotkeySession3); case HotKeyId.HKID_SESSION_4: return(Properties.Settings.Default.HotkeySession4); case HotKeyId.HKID_SESSION_5: return(Properties.Settings.Default.HotkeySession5); case HotKeyId.HKID_SESSION_6: return(Properties.Settings.Default.HotkeySession6); case HotKeyId.HKID_SESSION_7: return(Properties.Settings.Default.HotkeySession7); case HotKeyId.HKID_SESSION_8: return(Properties.Settings.Default.HotkeySession8); case HotKeyId.HKID_SESSION_9: return(Properties.Settings.Default.HotkeySession9); case HotKeyId.HKID_SESSION_10: return(Properties.Settings.Default.HotkeySession10); default: return(Properties.Settings.Default.HotkeySession1); } }
public bool isSessionHotkeyEnabled(HotKeyId hkid) { bool result = false; switch (hkid) { case HotKeyId.HKID_SESSION_1: result = Properties.Settings.Default.Hotkey1Enabled; break; case HotKeyId.HKID_SESSION_2: result = Properties.Settings.Default.Hotkey2Enabled; break; case HotKeyId.HKID_SESSION_3: result = Properties.Settings.Default.Hotkey3Enabled; break; case HotKeyId.HKID_SESSION_4: result = Properties.Settings.Default.Hotkey4Enabled; break; case HotKeyId.HKID_SESSION_5: result = Properties.Settings.Default.Hotkey5Enabled; break; case HotKeyId.HKID_SESSION_6: result = Properties.Settings.Default.Hotkey6Enabled; break; case HotKeyId.HKID_SESSION_7: result = Properties.Settings.Default.Hotkey7Enabled; break; case HotKeyId.HKID_SESSION_8: result = Properties.Settings.Default.Hotkey8Enabled; break; case HotKeyId.HKID_SESSION_9: result = Properties.Settings.Default.Hotkey9Enabled; break; case HotKeyId.HKID_SESSION_10: result = Properties.Settings.Default.Hotkey10Enabled; break; default: result = false; break; } return(result); }
private String getSessionKeyFromHotkey(HotKeyId hkid) { switch (hkid) { case HotKeyId.HKID_SESSION_1: return(Properties.Settings.Default.FavouriteSession1); case HotKeyId.HKID_SESSION_2: return(Properties.Settings.Default.FavouriteSession2); case HotKeyId.HKID_SESSION_3: return(Properties.Settings.Default.FavouriteSession3); case HotKeyId.HKID_SESSION_4: return(Properties.Settings.Default.FavouriteSession4); case HotKeyId.HKID_SESSION_5: return(Properties.Settings.Default.FavouriteSession5); case HotKeyId.HKID_SESSION_6: return(Properties.Settings.Default.FavouriteSession6); case HotKeyId.HKID_SESSION_7: return(Properties.Settings.Default.FavouriteSession7); case HotKeyId.HKID_SESSION_8: return(Properties.Settings.Default.FavouriteSession8); case HotKeyId.HKID_SESSION_9: return(Properties.Settings.Default.FavouriteSession9); case HotKeyId.HKID_SESSION_10: return(Properties.Settings.Default.FavouriteSession10); default: return(""); } }
public Session getSessionFromHotkey(HotKeyId hkid) { return(sc.findSessionByKey(getSessionKeyFromHotkey(hkid))); }
public Session getSessionFromHotkey(HotKeyId hkid) { return sc.findSessionByKey(getSessionKeyFromHotkey(hkid)); }
public bool saveSessionnameToHotkey(Form window, HotKeyId hkid, Session s) { return(saveSessionnameToHotkey(window, hkid, s, false)); }
private char getHotKeyCharFromId(HotKeyId hkid) { switch (hkid) { case HotKeyId.HKID_NEW: return Properties.Settings.Default.HotkeyNewSession; case HotKeyId.HKID_MINIMIZE: return Properties.Settings.Default.HotkeyMinimize; case HotKeyId.HKID_SESSION_1: return Properties.Settings.Default.HotkeySession1; case HotKeyId.HKID_SESSION_2: return Properties.Settings.Default.HotkeySession2; case HotKeyId.HKID_SESSION_3: return Properties.Settings.Default.HotkeySession3; case HotKeyId.HKID_SESSION_4: return Properties.Settings.Default.HotkeySession4; case HotKeyId.HKID_SESSION_5: return Properties.Settings.Default.HotkeySession5; case HotKeyId.HKID_SESSION_6: return Properties.Settings.Default.HotkeySession6; case HotKeyId.HKID_SESSION_7: return Properties.Settings.Default.HotkeySession7; case HotKeyId.HKID_SESSION_8: return Properties.Settings.Default.HotkeySession8; case HotKeyId.HKID_SESSION_9: return Properties.Settings.Default.HotkeySession9; case HotKeyId.HKID_SESSION_10: return Properties.Settings.Default.HotkeySession10; default: return Properties.Settings.Default.HotkeySession1; } }
public bool UnregisterHotKey(Form form, HotKeyId id) { bool result = User32.UnregisterHotKey(form.Handle, (int)id); hotkeyDictionary.Remove(getHotKeyCharFromId(id)); return result; }
public bool saveSessionnameToHotkey(Form window, HotKeyId hkid, Session s, bool saveSettings) { bool result = false; UnregisterHotKey(window, hkid); if (RegisterHotkey(window, hkid)) { String sessionKey = ""; if (s != null) sessionKey = s.SessionKey; switch (hkid) { case HotKeyId.HKID_SESSION_1: Properties.Settings.Default.FavouriteSession1 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_2: Properties.Settings.Default.FavouriteSession2 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_3: Properties.Settings.Default.FavouriteSession3 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_4: Properties.Settings.Default.FavouriteSession4 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_5: Properties.Settings.Default.FavouriteSession5 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_6: Properties.Settings.Default.FavouriteSession6 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_7: Properties.Settings.Default.FavouriteSession7 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_8: Properties.Settings.Default.FavouriteSession8 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_9: Properties.Settings.Default.FavouriteSession9 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_10: Properties.Settings.Default.FavouriteSession10 = sessionKey; result = true; break; default: result = false; break; } } // Fire the refresh event if (result) { refreshHotkeys(); if (saveSettings) { Properties.Settings.Default.Save(); } } return result; }
public bool saveSessionnameToHotkey(Form window, HotKeyId hkid, Session s) { return saveSessionnameToHotkey(window, hkid, s, false); }
public bool RegisterHotkey(Form form, char key, HotKeyId id) { bool result = User32.RegisterHotKey(form.Handle, (int)id, getModifier().Modifier, (int)(Char.ToUpper(key))); if (result) saveHotkey(key, id); return result; }
public bool RegisterHotkey(Form form, HotKeyId id) { return RegisterHotkey(form, getHotKeyCharFromId(id), id); }
public bool isSessionHotkeyEnabled(HotKeyId hkid) { bool result = false; switch (hkid) { case HotKeyId.HKID_SESSION_1: result = Properties.Settings.Default.Hotkey1Enabled; break; case HotKeyId.HKID_SESSION_2: result = Properties.Settings.Default.Hotkey2Enabled; break; case HotKeyId.HKID_SESSION_3: result = Properties.Settings.Default.Hotkey3Enabled; break; case HotKeyId.HKID_SESSION_4: result = Properties.Settings.Default.Hotkey4Enabled; break; case HotKeyId.HKID_SESSION_5: result = Properties.Settings.Default.Hotkey5Enabled; break; case HotKeyId.HKID_SESSION_6: result = Properties.Settings.Default.Hotkey6Enabled; break; case HotKeyId.HKID_SESSION_7: result = Properties.Settings.Default.Hotkey7Enabled; break; case HotKeyId.HKID_SESSION_8: result = Properties.Settings.Default.Hotkey8Enabled; break; case HotKeyId.HKID_SESSION_9: result = Properties.Settings.Default.Hotkey9Enabled; break; case HotKeyId.HKID_SESSION_10: result = Properties.Settings.Default.Hotkey10Enabled; break; default: result = false; break; } return result; }
public string getHotKeyFromId(HotKeyId hkid) { return(getHotKeyCharFromId(hkid).ToString()); }
private String getSessionKeyFromHotkey(HotKeyId hkid) { switch (hkid) { case HotKeyId.HKID_SESSION_1: return Properties.Settings.Default.FavouriteSession1; case HotKeyId.HKID_SESSION_2: return Properties.Settings.Default.FavouriteSession2; case HotKeyId.HKID_SESSION_3: return Properties.Settings.Default.FavouriteSession3; case HotKeyId.HKID_SESSION_4: return Properties.Settings.Default.FavouriteSession4; case HotKeyId.HKID_SESSION_5: return Properties.Settings.Default.FavouriteSession5; case HotKeyId.HKID_SESSION_6: return Properties.Settings.Default.FavouriteSession6; case HotKeyId.HKID_SESSION_7: return Properties.Settings.Default.FavouriteSession7; case HotKeyId.HKID_SESSION_8: return Properties.Settings.Default.FavouriteSession8; case HotKeyId.HKID_SESSION_9: return Properties.Settings.Default.FavouriteSession9; case HotKeyId.HKID_SESSION_10: return Properties.Settings.Default.FavouriteSession10; default: return ""; } }
private bool saveHotkey(char hotkey, HotKeyId hkid) { hotkey = Char.ToUpper(hotkey); bool result = false; // Check the hotkey is available if (isHotkeyAvailable(hotkey)) { result = true; // Save the new value in the dictionary hotkeyDictionary[hotkey] = hkid; // And update the setting switch (hkid) { case HotKeyId.HKID_NEW: Properties.Settings.Default.HotkeyNewSession = hotkey; break; case HotKeyId.HKID_MINIMIZE: Properties.Settings.Default.HotkeyMinimize = hotkey; break; case HotKeyId.HKID_SESSION_1: Properties.Settings.Default.HotkeySession1 = hotkey; break; case HotKeyId.HKID_SESSION_2: Properties.Settings.Default.HotkeySession2 = hotkey; break; case HotKeyId.HKID_SESSION_3: Properties.Settings.Default.HotkeySession3 = hotkey; break; case HotKeyId.HKID_SESSION_4: Properties.Settings.Default.HotkeySession4 = hotkey; break; case HotKeyId.HKID_SESSION_5: Properties.Settings.Default.HotkeySession5 = hotkey; break; case HotKeyId.HKID_SESSION_6: Properties.Settings.Default.HotkeySession6 = hotkey; break; case HotKeyId.HKID_SESSION_7: Properties.Settings.Default.HotkeySession7 = hotkey; break; case HotKeyId.HKID_SESSION_8: Properties.Settings.Default.HotkeySession8 = hotkey; break; case HotKeyId.HKID_SESSION_9: Properties.Settings.Default.HotkeySession9 = hotkey; break; case HotKeyId.HKID_SESSION_10: Properties.Settings.Default.HotkeySession10 = hotkey; break; } } return result; }
public bool saveSessionnameToHotkey(Form window, HotKeyId hkid, Session s, bool saveSettings) { bool result = false; UnregisterHotKey(window, hkid); if (RegisterHotkey(window, hkid)) { String sessionKey = ""; if (s != null) { sessionKey = s.SessionKey; } switch (hkid) { case HotKeyId.HKID_SESSION_1: Properties.Settings.Default.FavouriteSession1 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_2: Properties.Settings.Default.FavouriteSession2 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_3: Properties.Settings.Default.FavouriteSession3 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_4: Properties.Settings.Default.FavouriteSession4 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_5: Properties.Settings.Default.FavouriteSession5 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_6: Properties.Settings.Default.FavouriteSession6 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_7: Properties.Settings.Default.FavouriteSession7 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_8: Properties.Settings.Default.FavouriteSession8 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_9: Properties.Settings.Default.FavouriteSession9 = sessionKey; result = true; break; case HotKeyId.HKID_SESSION_10: Properties.Settings.Default.FavouriteSession10 = sessionKey; result = true; break; default: result = false; break; } } // Fire the refresh event if (result) { refreshHotkeys(); if (saveSettings) { Properties.Settings.Default.Save(); } } return(result); }
public bool RegisterHotkey(Form form, HotKeyId id) { return(RegisterHotkey(form, getHotKeyCharFromId(id), id)); }
private bool saveHotkey(char hotkey, HotKeyId hkid) { hotkey = Char.ToUpper(hotkey); bool result = false; // Check the hotkey is available if (isHotkeyAvailable(hotkey)) { result = true; // Save the new value in the dictionary hotkeyDictionary[hotkey] = hkid; // And update the setting switch (hkid) { case HotKeyId.HKID_NEW: Properties.Settings.Default.HotkeyNewSession = hotkey; break; case HotKeyId.HKID_MINIMIZE: Properties.Settings.Default.HotkeyMinimize = hotkey; break; case HotKeyId.HKID_SESSION_1: Properties.Settings.Default.HotkeySession1 = hotkey; break; case HotKeyId.HKID_SESSION_2: Properties.Settings.Default.HotkeySession2 = hotkey; break; case HotKeyId.HKID_SESSION_3: Properties.Settings.Default.HotkeySession3 = hotkey; break; case HotKeyId.HKID_SESSION_4: Properties.Settings.Default.HotkeySession4 = hotkey; break; case HotKeyId.HKID_SESSION_5: Properties.Settings.Default.HotkeySession5 = hotkey; break; case HotKeyId.HKID_SESSION_6: Properties.Settings.Default.HotkeySession6 = hotkey; break; case HotKeyId.HKID_SESSION_7: Properties.Settings.Default.HotkeySession7 = hotkey; break; case HotKeyId.HKID_SESSION_8: Properties.Settings.Default.HotkeySession8 = hotkey; break; case HotKeyId.HKID_SESSION_9: Properties.Settings.Default.HotkeySession9 = hotkey; break; case HotKeyId.HKID_SESSION_10: Properties.Settings.Default.HotkeySession10 = hotkey; break; } } return(result); }
public string getHotKeyFromId(HotKeyId hkid) { return getHotKeyCharFromId(hkid).ToString(); }