跳到主要内容

github/tai

公开

Tai · Windows 软件与网站使用时长统计。上游 Planshit/Tai 的源码镜像,非灵栈原创;MIT 许可。来源:https://github.com/Planshit/Tai 。本次为手动同步,暂不提供安装包。

提交记录
修改Core/Servicers/Instances/Sleepdiscover.cs+16 −2看文件
@@ -45,10 +45,24 @@ namespace Core.Servicers.Instances
4545 this.observer = observer;
4646 observer.OnAppActive += Observer_OnAppActive;
4747 SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(OnPowerModeChanged);
48删除:
48新增: SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
4949 keyboardProc = HookCallback;
5050 }
5151
52新增: private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
53新增: {
54新增: if (e.Reason == SessionSwitchReason.RemoteDisconnect || e.Reason == SessionSwitchReason.ConsoleDisconnect)
55新增: {
56新增: // 与这台设备远程桌面连接断开
57新增: Debug.WriteLine("与这台设备远程桌面连接断开");
58新增: if (status == SleepStatus.Wake)
59新增: {
60新增: status = SleepStatus.Sleep;
61新增: SleepStatusChanged?.Invoke(status);
62新增: }
63新增: }
64新增: }
65新增:
5266 private IntPtr HookCallback(
5367 int nCode, IntPtr wParam, IntPtr lParam)
5468 {
@@ -97,7 +111,7 @@ namespace Core.Servicers.Instances
97111 if (status == SleepStatus.Sleep)
98112 {
99113 TimeSpan timeSpan = DateTime.Now - pressKeyboardLastTime;
100删除:
114新增:
101115 Point point;
102116 Win32API.GetCursorPos(out point);
103117 if (lastPoint.ToString() == point.ToString() && timeSpan.TotalSeconds > 10)