/// <summary> /// Event received when a set of keys are down. /// </summary> /// <param name="pressedKeys">The down keys.</param> public void OnUpdateAllDownKeys(HashSet <Key> pressedKeys) { if (this.HotKey is KeyboardHotkey) { KeyboardHotkey keyboardHotkey = this.HotKey as KeyboardHotkey; } }
public static void TestGetVisitor() { var visitor = A.Fake <IKeyboardHotkeyVisitor>(); var hotkey = new KeyboardHotkey { HotkeyVisitor = visitor }; Assert.That(hotkey.GetVisitor(), Is.SameAs(visitor)); }
/// <summary> /// Clears the active hotkey value. /// </summary> private void ClearActiveHotkey() { lock (this.AccessLock) { this.keyboardHotkey = new KeyboardHotkey(); this.ActiveHotkey = this.keyboardHotkey; } this.RaisePropertyChanged(nameof(this.Hotkeys)); }
public static void TestActiveAndInit([NotNull] KeyboardHotkey hotkey, Action <KeyboardHotkey> setup, Action <KeyboardHotkey> test, Action <KeyboardHotkey> tearDown) { setup?.Invoke(hotkey); if (test == null) { Assert.That(true); } else { test.Invoke(hotkey); } tearDown?.Invoke(hotkey); }
/// <summary> /// Initializes a new instance of the <see cref="HotkeyEditorViewModel" /> class. /// </summary> public HotkeyEditorViewModel() : base("Hotkey Editor") { this.ContentId = HotkeyEditorViewModel.ToolContentId; this.AddHotkeyCommand = new RelayCommand(() => this.AddHotkey(), () => true); this.RemoveHotkeyCommand = new RelayCommand(() => this.RemoveSelectedHotkey(), () => true); this.ClearHotkeysCommand = new RelayCommand(() => this.ClearActiveHotkey(), () => true); this.keyboardHotkey = new KeyboardHotkey(); this.AccessLock = new Object(); Task.Run(() => EngineCore.GetInstance()?.Input?.GetKeyboardCapture().Subscribe(this)); Task.Run(() => EngineCore.GetInstance()?.Input?.GetControllerCapture().Subscribe(this)); Task.Run(() => EngineCore.GetInstance()?.Input?.GetMouseCapture().Subscribe(this)); Task.Run(() => MainViewModel.GetInstance().Subscribe(this)); }
public void SetActiveHotkey(Hotkey hotkey) { lock (this.AccessLock) { if (hotkey == null || hotkey is KeyboardHotkey) { KeyboardHotkey keyboardHotkey = hotkey as KeyboardHotkey; if (this.keyboardHotKeyBuilder == null) { this.keyboardHotKeyBuilder = new KeyboardHotkeyBuilder(this.OnHotkeysUpdated, keyboardHotkey); } else { this.keyboardHotKeyBuilder.SetHotkey(keyboardHotkey); } this.RaisePropertyChanged(nameof(this.ActiveHotkey)); } } }
public static bool TestIsValid([NotNull] KeyboardHotkey hotkey, Action <KeyboardHotkey> setup) { setup?.Invoke(hotkey); return(hotkey.IsValid()); }