private void StartListeningToMouseMoves() { _spyState = SpyState.Spying; _timer.Interval = TimeInterval; _timer.Tick += HandelMouseMoveToUpdateHilight; _timer.Start(); _keyboardHook.SetHook(); KeyboardHook.OnKeyPress += ListenKeyPress; _systemTrayControl.Text = Resources.Stop_Spying; }
private void StopListening() { _spyState = SpyState.Idel; _timer.Stop(); KeyboardHook.OnKeyPress -= ListenKeyPress; _highlight.Visible = false; _livePropertyDisplay.Hide(); _systemTrayControl.Text = Resources.Start_Spying; _keyboardHook.UnHook(); }
private void ListenKeyPress(int keyChar) { if (keyChar != 27) { return; } switch (_spyState) { case SpyState.Spying: _timer.Stop(); _spyState = SpyState.ShowProperties; break; case SpyState.ShowProperties: StopListening(); break; } }