private HotkeyController() { sc = SessionController.getInstance(); intitialiseModifierDictionary(); initialiseHotkeyDictionary(); currentHotkeyModifier = getModifier(); }
private void removeProtectedHotkeys( HotkeyModifier modifier ) { if (modifier != null) { foreach (char c in modifier.ProtectedKeys) { // Remove any protected keys hotkeyDictionary.Remove(c); } } }
private void addProtectedHotkeys(HotkeyModifier modifier) { foreach ( char c in modifier.ProtectedKeys) { // Add the default system hotkeys so they can't be duplicated hotkeyDictionary.Add(c, HotKeyId.HKID_PROTECTED); } }
/// <summary> /// Check to see if the exisiting set of hotkeys contains any protected /// hotkeys for the new modifier /// </summary> /// <param name="modifier"></param> /// <returns></returns> public bool validateNewModifier(HotkeyModifier modifier) { bool result = true; foreach (char c in modifier.ProtectedKeys) { if (hotkeyDictionary.ContainsKey(c)) { HotKeyId id; hotkeyDictionary.TryGetValue(c, out id); if (id != HotKeyId.HKID_PROTECTED) { result = false; } } } return result; }
public void setModifier(HotkeyModifier m) { // Remove any protected hotkeys for the old modifier removeProtectedHotkeys(currentHotkeyModifier); // Set the new modifier Properties.Settings.Default.HotkeyModifier = m.Modifier; // Save the current modifier currentHotkeyModifier = getModifier(); // Add in any protected keys for the new modifier addProtectedHotkeys(currentHotkeyModifier); }
public HotkeyModifier[] getAllModifiers() { HotkeyModifier[] array = new HotkeyModifier[modifierDictionary.Count]; modifierDictionary.Values.CopyTo(array, 0); return array; }