Fixed timer problem with issue #67

This commit is contained in:
MikeMaximus
2017-02-26 15:48:48 -06:00
parent a5dd1d547b
commit a490e6d1f2
+8 -7
View File
@@ -47,8 +47,10 @@ Public Class frmMain
Private bProcessDebugMode As Boolean = False Private bProcessDebugMode As Boolean = False
WithEvents oFileWatcher As New FileSystemWatcher WithEvents oFileWatcher As New FileSystemWatcher
'Timers - There may only be one System.Windows.Forms.Timer and it must be tmScanTimer.
WithEvents tmScanTimer As New Timer WithEvents tmScanTimer As New Timer
WithEvents tmRestoreCheck As New Timer WithEvents tmRestoreCheck As New System.Timers.Timer
Public WithEvents oProcess As New mgrProcesses Public WithEvents oProcess As New mgrProcesses
Public WithEvents oBackup As New mgrBackup Public WithEvents oBackup As New mgrBackup
@@ -368,7 +370,7 @@ Public Class frmMain
Private Sub StartRestoreCheck() Private Sub StartRestoreCheck()
iRestoreTimeOut = -1 iRestoreTimeOut = -1
tmRestoreCheck.Interval = 60000 tmRestoreCheck.Interval = 60000
tmRestoreCheck.Enabled = True tmRestoreCheck.AutoReset = True
tmRestoreCheck.Start() tmRestoreCheck.Start()
AutoRestoreCheck() AutoRestoreCheck()
End Sub End Sub
@@ -389,7 +391,6 @@ Public Class frmMain
'Shut down the timer and bail out if there's nothing to do 'Shut down the timer and bail out if there's nothing to do
If slRestoreData.Count = 0 Then If slRestoreData.Count = 0 Then
tmRestoreCheck.Stop() tmRestoreCheck.Stop()
tmRestoreCheck.Enabled = False
Exit Sub Exit Sub
End If End If
@@ -484,13 +485,11 @@ Public Class frmMain
'Shutdown if we are finished 'Shutdown if we are finished
If bFinished Then If bFinished Then
tmRestoreCheck.Stop() tmRestoreCheck.Stop()
tmRestoreCheck.Enabled = False
End If End If
'Time out after 15 minutes 'Time out after 15 minutes
If iRestoreTimeOut = 15 Then If iRestoreTimeOut = 15 Then
tmRestoreCheck.Stop() tmRestoreCheck.Stop()
tmRestoreCheck.Enabled = False
End If End If
End Sub End Sub
@@ -1676,8 +1675,10 @@ Public Class frmMain
End If End If
End Sub End Sub
Private Sub AutoRestoreEventProcessor(myObject As Object, ByVal myEventArgs As EventArgs) Handles tmRestoreCheck.Tick Private Sub AutoRestoreEventProcessor(myObject As Object, ByVal myEventArgs As EventArgs) Handles tmRestoreCheck.Elapsed
AutoRestoreCheck() If eCurrentStatus <> eStatus.Paused Then
AutoRestoreCheck()
End If
End Sub End Sub
Private Sub ScanTimerEventProcessor(myObject As Object, ByVal myEventArgs As EventArgs) Handles tmScanTimer.Tick Private Sub ScanTimerEventProcessor(myObject As Object, ByVal myEventArgs As EventArgs) Handles tmScanTimer.Tick