File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ Public Class IdleDetector
1414
1515 Public Shared Property IsEnabled As Boolean = True
1616
17+ Public Shared Property IsAlreadyIdle As Boolean = False
18+
1719 Shared Sub New ()
1820 _idletimer = New PeriodicTimer(TimeSpan.FromSeconds( 5 ))
1921 End Sub
@@ -35,9 +37,13 @@ Public Class IdleDetector
3537 While Await _idletimer.WaitForNextTickAsync(_cts.Token) AndAlso Not _cts.Token.IsCancellationRequested
3638
3739 If GetIdleTime() > 300 AndAlso Not Paused AndAlso IsEnabled Then
38- RaiseEvent IsIdle( Nothing , EventArgs.Empty)
40+ If Not IsAlreadyIdle Then
41+ IsAlreadyIdle = True
42+ RaiseEvent IsIdle( Nothing , EventArgs.Empty)
43+ End If
3944
4045 ElseIf Not Paused AndAlso IsEnabled Then
46+ IsAlreadyIdle = False
4147 RaiseEvent IsNotIdle( Nothing , EventArgs.Empty)
4248 End If
4349
You can’t perform that action at this time.
0 commit comments