Click here to Skip to main content
15,889,839 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.

How to set the system to reload the window if there is no mouse action occurrence in 10 sec?


I have tried this code, but its not working. it didn't reload after 1 minute...


VB
 Class Window2
    Dim dt As DispatcherTimer = New DispatcherTimer()

    Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) _
      Handles MyBase.Loaded
        AddHandler dt.Tick, AddressOf dispatcherTimer_Tick
        dt.Interval = New TimeSpan(100000)
        dt.Start()

    End Sub

    Private Sub dispatcherTimer_Tick(ByVal sender As Object, ByVal e As EventArgs)
        
        If MouseAction.None Then
            dt.stop()
            Me.Close()
            CommandManager.InvalidateRequerySuggested()
        End If


    End Sub


End Class



what might be the problem?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900