private void Hook_KeyboardPressed(object sender, GlobalKeyboardHookEventArgs e) { var virtualCode = e.KeyboardData.VirtualCode; if (e.KeyboardState == GlobalKeyboardHook.KeyboardState.KeyDown || e.KeyboardState == GlobalKeyboardHook.KeyboardState.SysKeyDown) { if (!_currentlyPressedKeys.Contains(virtualCode)) { _currentlyPressedKeys.Add(virtualCode); } } else if (e.KeyboardState == GlobalKeyboardHook.KeyboardState.KeyUp || e.KeyboardState == GlobalKeyboardHook.KeyboardState.SysKeyUp) { if (_currentlyPressedKeys.Contains(virtualCode)) { _currentlyPressedKeys.Remove(virtualCode); } } _currentlyPressedKeys.Sort(); if (ArraysAreSame(_currentlyPressedKeys, _activationKeys)) { _appStateHandler.ShowColorPicker(); } if (_currentlyPressedKeys.Count == 1 && _currentlyPressedKeys[0] == 27) { _colorsHistoryWindowHelper.HideColorsHistory(); _zoomWindowHelper.CloseZoomWindow(); } }
private void AssociatedObject_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { _zoomWindowHelper.CloseZoomWindow(); }