Fix for issue #112

This commit is contained in:
MikeMaximus
2017-12-08 09:48:58 -06:00
parent 5165ae27e7
commit ff0f3b9dd4
3 changed files with 48 additions and 22 deletions
+36 -22
View File
@@ -1826,36 +1826,50 @@ Public Class frmMain
End Sub End Sub
Private Sub Main_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Private Sub Main_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim oMutex As New System.Threading.Mutex
Dim bNewInstance As Boolean
'Init 'Init
Try Try
SetForm() oMutex = New System.Threading.Mutex(True, "GameBackupMonitor", bNewInstance)
VerifyGameDataPath()
LoadAndVerify()
If Not bInitFail Then
VerifyCustomPathVariables()
If oSettings.StartToTray And Not mgrCommon.IsUnix Then 'Ensure only one instance is running
bShowToggle = False If Not bNewInstance Then
Me.Visible = False mgrCommon.ShowMessage(frmMain_ErrorAlreadyRunning, MsgBoxStyle.Exclamation)
Me.ShowInTaskbar = False ShutdownApp(False)
End If Else
SetForm()
VerifyGameDataPath()
LoadAndVerify()
If Not bInitFail Then
VerifyCustomPathVariables()
If oSettings.MonitorOnStartup Then If oSettings.StartToTray And Not mgrCommon.IsUnix Then
eCurrentStatus = eStatus.Stopped bShowToggle = False
Else Me.Visible = False
eCurrentStatus = eStatus.Running Me.ShowInTaskbar = False
End If End If
HandleScan() If oSettings.MonitorOnStartup Then
CheckForNewBackups() eCurrentStatus = eStatus.Stopped
Else
eCurrentStatus = eStatus.Running
End If
'Unix Handler HandleScan()
If mgrCommon.IsUnix Then CheckForNewBackups()
Me.MinimizeBox = True
Else 'Unix Handler
Me.gMonTray.Visible = True If mgrCommon.IsUnix Then
Me.MinimizeBox = True
Else
Me.gMonTray.Visible = True
End If
GC.KeepAlive(oMutex)
End If End If
End If End If
Catch ex As Exception Catch ex As Exception
If mgrCommon.ShowMessage(frmMain_ErrorInitFailure, ex.Message, MsgBoxStyle.YesNo) = MsgBoxResult.No Then If mgrCommon.ShowMessage(frmMain_ErrorInitFailure, ex.Message, MsgBoxStyle.YesNo) = MsgBoxResult.No Then
bInitFail = True bInitFail = True
+9
View File
@@ -2832,6 +2832,15 @@ Namespace My.Resources
End Get End Get
End Property End Property
'''<summary>
''' Looks up a localized string similar to An instance of Game Backup Monitor is already running..
'''</summary>
Friend ReadOnly Property frmMain_ErrorAlreadyRunning() As String
Get
Return ResourceManager.GetString("frmMain_ErrorAlreadyRunning", resourceCulture)
End Get
End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to GBM is running from a new location, the Windows startup entry has been updated.. ''' Looks up a localized string similar to GBM is running from a new location, the Windows startup entry has been updated..
'''</summary> '''</summary>
+3
View File
@@ -1945,4 +1945,7 @@
<data name="frmSettings_chkSessionTracking" xml:space="preserve"> <data name="frmSettings_chkSessionTracking" xml:space="preserve">
<value>Enable session tracking</value> <value>Enable session tracking</value>
</data> </data>
<data name="frmMain_ErrorAlreadyRunning" xml:space="preserve">
<value>An instance of Game Backup Monitor is already running.</value>
</data>
</root> </root>