private void OnKeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.CapsLock) { if (Settings.Default.SuppressCapsKey) { Task.Run(() => SuppressCapsKeyPress()); } else { _model.SetCapsState(KeyboardHelper.IsCapsKeyLocked(), CapsStateSource.CapsKey); } } else { _model.SetCapsState(!_model.IsCapsActive, CapsStateSource.ShortcutKey); } }
public MainSupervisor(MainModel model, MainWindow view, GlobalKeyboardHook keyboardHook, SettingsController settings, HelpWindow helpWindow) { _model = model; _view = view; _view.DataContext = model; _model.CapsStateChanged += OnModelCapsStateChanged; _keyboardHook = keyboardHook; _keyboardHook.KeyUp += OnKeyUp; _model.SetCapsState(KeyboardHelper.IsCapsKeyLocked(), CapsStateSource.CapsKey); _settings = settings; _model.SettingsPressed = new RelayCommand(OnSettingsPressed); _helpWindow = helpWindow; _model.HelpPressed = new RelayCommand(OnHelpPressed); _model.MinimisePressed = new RelayCommand(OnMinimisePressed); _model.ClosePressed = new RelayCommand(OnClosePressed); }