private void Timer_Elapsed(object sender, ElapsedEventArgs e) { Point currentMousePos = MouseDetector.GetMousePosition(); if (currentMousePos != lastMousePos) { OnMouseMoved(currentMousePos); lastMousePos = currentMousePos; } }
public MouseDetector(Resolution resolution, DataPrecision precision) { lastMousePos = MouseDetector.GetMousePosition(); double frequency = CalcTimerFrequency(resolution, precision); timer = new Timer(frequency); timer.Elapsed += Timer_Elapsed; timer.AutoReset = true; timer.Start(); }