// Move mouse public void MoveMouse() { // Get current position var curr_pos = CursorHelper.GetCurrentPosition(); // Move cursor only if position is not changed, in order to not disturb if the user is working if (curr_pos == mLastCursorPos) { // Get pixel movement depending on the direction int mov_pixel_rel = (mMovingDir == eMovingDirections.BACKWARD) ? (-1 * mMovingPixel) : mMovingPixel; // Move cursor MoveCursor(mov_pixel_rel); // Update moving direction UpdateMovingDir(); } // Reset last cursor position mLastCursorPos = CursorHelper.GetCurrentPosition(); }
// Initialize public void Initialize(int cMovingPixel) { mMovingDir = eMovingDirections.FORWARD; mMovingPixel = cMovingPixel; mLastCursorPos = CursorHelper.GetCurrentPosition(); }