public InputStateManager(string startingApplicationName, int maxElapsedTimeMilliseconds, int inputUpdateFrequencyMilliseconds) { _lastApplicationName = startingApplicationName; _maxElapsedTimeMilliseconds = maxElapsedTimeMilliseconds; _inputUpdateFrequencyMilliseconds = inputUpdateFrequencyMilliseconds; _inputSources = new AllInputSources(); _windowHelper = new WindowHelper(); var stateChangeTimer = new Timer(UpdateFrequencyMilliseconds); stateChangeTimer.Elapsed += UpdateInputState; stateChangeTimer.Elapsed += UpdateApplicationState; stateChangeTimer.AutoReset = true; stateChangeTimer.Enabled = true; }
public MainWindow() { InitializeComponent(); keyboard = new KeyboardInput(); keyboard.KeyBoardKeyPressed += keyboard_KeyBoardKeyPressed; mouse = new MouseInput(); mouse.MouseMoved += mouse_MouseMoved; lastInput = new AllInputSources(); timer = new DispatcherTimer(); timer.Interval = new TimeSpan(); timer.Interval = new TimeSpan(0, 0, 0, 0, 100); timer.Tick += timer_Tick; timer.Start(); }