public override void Handle(SocketSession session, ePacketType reqType, object reqObj) { var req = reqObj as RequestMouseEvent; DoOutput(string.Format("button:{0},operation:{1},location:{2},{3}", req.MouseButton, req.MouseOperation, req.MouseLocation.X, req.MouseLocation.Y)); if (req.MouseOperation == eMouseOperations.MouseDown) { MouseOpeUtil.MouseDown(req.MouseButton, req.MouseLocation); } else if (req.MouseOperation == eMouseOperations.MouseUp) { MouseOpeUtil.MouseUp(req.MouseButton, req.MouseLocation); } else if (req.MouseOperation == eMouseOperations.MousePress) { MouseOpeUtil.MousePress(req.MouseButton, req.MouseLocation); } else if (req.MouseOperation == eMouseOperations.MouseDoubleClick) { MouseOpeUtil.MouseDoubleClick(req.MouseButton, req.MouseLocation); } else if (req.MouseOperation == eMouseOperations.MouseMove) { MouseOpeUtil.MouseMove(req.MouseLocation); } else { return; } }
private void StartLockMouse(SocketSession session) { for (int i = 0; i < _request.LockSeconds; i++) { if (!_isRunning) { break; } for (int j = 0; j < 100; j++) { MouseOpeUtil.MouseMove(0, 0); Thread.Sleep(10); } } _isRunning = false; _request = null; }