private void onIdleDetectionTimerTick(object sender, EventArgs e) { Win32.LASTINPUTINFO lastInputInfo; lastInputInfo.cbSize = Win32.LASTINPUTINFO.SizeOf; lastInputInfo.dwTime = 0; if (!Win32.GetLastInputInfo(out lastInputInfo)) { return; } var idleSeconds = (Environment.TickCount - lastInputInfo.dwTime) / 1000; if (idleSeconds < 1) { return; } Toggl.SetIdleSeconds((ulong)idleSeconds); }
private void timerIdleDetection_Tick(object sender, EventArgs e) { Win32.LASTINPUTINFO lastInputInfo = new Win32.LASTINPUTINFO(); lastInputInfo.cbSize = Marshal.SizeOf(lastInputInfo); lastInputInfo.dwTime = 0; if (!Win32.GetLastInputInfo(out lastInputInfo)) { return; } int idle_seconds = unchecked (Environment.TickCount - (int)lastInputInfo.dwTime) / 1000; if (idle_seconds < 1) { return; } Toggl.SetIdleSeconds((ulong)idle_seconds); }