提交记录修改Core/Servicers/Instances/Sleepdiscover.cs+15 −5看文件
| @@ -39,7 +39,7 @@ namespace Core.Servicers.Instances | ||
| 39 | 39 | |
| 40 | 40 | private Win32API.LowLevelKeyboardProc keyboardProc; |
| 41 | 41 | private static IntPtr hookKeyboardID = IntPtr.Zero; |
| 42 | 删除: | |
| 42 | 新增: private int emptyPointNum = 0; | |
| 43 | 43 | public Sleepdiscover(IObserver observer) |
| 44 | 44 | { |
| 45 | 45 | this.observer = observer; |
| @@ -148,9 +148,20 @@ namespace Core.Servicers.Instances | ||
| 148 | 148 | private void Timer_Tick(object sender, EventArgs e) |
| 149 | 149 | { |
| 150 | 150 | Point point; |
| 151 | 新增: | |
| 151 | 152 | Win32API.GetCursorPos(out point); |
| 152 | 删除: if (point == null) | |
| 153 | 新增: | |
| 154 | 新增: if (point.X + point.Y == 0) | |
| 153 | 155 | { |
| 156 | 新增: emptyPointNum++; | |
| 157 | 新增: | |
| 158 | 新增: if (emptyPointNum == 2) | |
| 159 | 新增: { | |
| 160 | 新增: emptyPointNum = 0; | |
| 161 | 新增: status = SleepStatus.Sleep; | |
| 162 | 新增: SleepStatusChanged?.Invoke(status); | |
| 163 | 新增: Logger.Info("empty point num:" + point.ToString()); | |
| 164 | 新增: } | |
| 154 | 165 | return; |
| 155 | 166 | } |
| 156 | 167 | |
| @@ -216,9 +227,8 @@ namespace Core.Servicers.Instances | ||
| 216 | 227 | } |
| 217 | 228 | |
| 218 | 229 | Logger.Info("【当前坐标】status:" + status + ",lastPoint:" + lastPoint.ToString() + ",now point:" + point.ToString()); |
| 219 | 删除: Win32API.GetCursorPos(out lastPoint); | |
| 220 | 删除: Logger.Info("【更新坐标】status:" + status + ",lastPoint:" + lastPoint.ToString() + ",now point:" + point.ToString()); | |
| 221 | 删除: | |
| 230 | 新增: lastPoint = point; | |
| 231 | 新增: //Win32API.GetCursorPos(out lastPoint); | |
| 222 | 232 | } |
| 223 | 233 | |
| 224 | 234 | |

