Redesigned notifications for issue #67

This commit is contained in:
Michael J. Seiferling
2017-03-23 10:30:03 -06:00
parent 922103e5aa
commit 63ed3dac67
3 changed files with 28 additions and 29 deletions
+20 -21
View File
@@ -58,7 +58,7 @@ Public Class frmMain
Public hshScanList As Hashtable Public hshScanList As Hashtable
Public oSettings As New mgrSettings Public oSettings As New mgrSettings
Delegate Sub UpdateNotifierCallBack(ByVal iCount As Integer, ByVal bRestored As Boolean) Delegate Sub UpdateNotifierCallBack(ByVal iCount As Integer)
Delegate Sub UpdateLogCallBack(ByVal sLogUpdate As String, ByVal bTrayUpdate As Boolean, ByVal objIcon As System.Windows.Forms.ToolTipIcon, ByVal bTimeStamp As Boolean) Delegate Sub UpdateLogCallBack(ByVal sLogUpdate As String, ByVal bTrayUpdate As Boolean, ByVal objIcon As System.Windows.Forms.ToolTipIcon, ByVal bTimeStamp As Boolean)
Delegate Sub WorkingGameInfoCallBack(ByVal sTitle As String, ByVal sStatus1 As String, ByVal sStatus2 As String, ByVal sStatus3 As String) Delegate Sub WorkingGameInfoCallBack(ByVal sTitle As String, ByVal sStatus1 As String, ByVal sStatus2 As String, ByVal sStatus3 As String)
Delegate Sub UpdateStatusCallBack(ByVal sStatus As String) Delegate Sub UpdateStatusCallBack(ByVal sStatus As String)
@@ -334,29 +334,17 @@ Public Class frmMain
End If End If
End Sub End Sub
Private Sub UpdateNotifier(ByVal iCount As Integer, ByVal bRestored As Boolean) Private Sub UpdateNotifier(ByVal iCount As Integer)
'Thread Safe 'Thread Safe
If Me.InvokeRequired = True Then If Me.InvokeRequired = True Then
Dim d As New UpdateNotifierCallBack(AddressOf UpdateNotifier) Dim d As New UpdateNotifierCallBack(AddressOf UpdateNotifier)
Me.Invoke(d, New Object() {iCount, bRestored}) Me.Invoke(d, New Object() {iCount})
Else Else
Dim sNotification As String Dim sNotification As String
If iCount > 1 Then If iCount > 1 Then
If bRestored Then
sNotification = mgrCommon.FormatString(frmMain_RestoreNotificationMulti, iCount)
gMonNotification.Tag = 1
Else
sNotification = mgrCommon.FormatString(frmMain_NewSaveNotificationMulti, iCount) sNotification = mgrCommon.FormatString(frmMain_NewSaveNotificationMulti, iCount)
gMonNotification.Tag = 0
End If
Else
If bRestored Then
sNotification = mgrCommon.FormatString(frmMain_RestoreNotificationSingle, iCount)
gMonNotification.Tag = 1
Else Else
sNotification = mgrCommon.FormatString(frmMain_NewSaveNotificationSingle, iCount) sNotification = mgrCommon.FormatString(frmMain_NewSaveNotificationSingle, iCount)
gMonNotification.Tag = 0
End If
End If End If
gMonNotification.Image = Icon_Inbox gMonNotification.Image = Icon_Inbox
gMonTrayNotification.Image = Icon_Inbox gMonTrayNotification.Image = Icon_Inbox
@@ -387,6 +375,7 @@ Public Class frmMain
Dim hshRestore As Hashtable Dim hshRestore As Hashtable
Dim hshGames As Hashtable Dim hshGames As Hashtable
Dim oGame As clsGame Dim oGame As clsGame
Dim sGame As String
'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
@@ -465,15 +454,27 @@ Public Class frmMain
If oSettings.AutoRestore Then If oSettings.AutoRestore Then
If slRestoreData.Count > 0 Then If slRestoreData.Count > 0 Then
hshRestore = New Hashtable hshRestore = New Hashtable
sGame = String.Empty
For Each de As DictionaryEntry In slRestoreData For Each de As DictionaryEntry In slRestoreData
hshGames = mgrMonitorList.DoListGetbyName(de.Key) hshGames = mgrMonitorList.DoListGetbyName(de.Key)
If hshGames.Count = 1 Then If hshGames.Count = 1 Then
oGame = DirectCast(hshGames(0), clsGame) oGame = DirectCast(hshGames(0), clsGame)
sGame = oGame.CroppedName
hshRestore.Add(oGame, de.Value) hshRestore.Add(oGame, de.Value)
Else Else
UpdateLog(mgrCommon.FormatString(frmMain_AutoRestoreFailure, de.Key), False, ToolTipIcon.Info, True) UpdateLog(mgrCommon.FormatString(frmMain_AutoRestoreFailure, de.Key), False, ToolTipIcon.Info, True)
End If End If
Next Next
'Handle notifications
If oSettings.RestoreOnLaunch Then
If slRestoreData.Count > 1 Then
UpdateLog(mgrCommon.FormatString(frmMain_RestoreNotificationMulti, slRestoreData.Count), True, ToolTipIcon.Info, True)
Else
UpdateLog(mgrCommon.FormatString(frmMain_RestoreNotificationSingle, sGame), True, ToolTipIcon.Info, True)
End If
End If
RunRestore(hshRestore) RunRestore(hshRestore)
End If End If
End If End If
@@ -489,10 +490,10 @@ Public Class frmMain
End If End If
End If End If
'Update the notifier 'Update the menu notifier if we aren't using auto restore
If oSettings.RestoreOnLaunch Then If oSettings.RestoreOnLaunch And Not oSettings.AutoRestore Then
If slRestoreData.Count > 0 Then If slRestoreData.Count > 0 Then
UpdateNotifier(slRestoreData.Count, oSettings.AutoRestore) UpdateNotifier(slRestoreData.Count)
End If End If
End If End If
End Sub End Sub
@@ -1224,7 +1225,7 @@ Public Class frmMain
txtLog.ScrollToCaret() txtLog.ScrollToCaret()
gMonTray.BalloonTipText = sLogUpdate gMonTray.BalloonTipText = sLogUpdate
gMonTray.BalloonTipIcon = objIcon gMonTray.BalloonTipIcon = objIcon
If bTrayUpdate Then gMonTray.ShowBalloonTip(5000) If bTrayUpdate Then gMonTray.ShowBalloonTip(10000)
End If End If
Application.DoEvents() Application.DoEvents()
End Sub End Sub
@@ -1617,9 +1618,7 @@ Public Class frmMain
Private Sub gMonNotification_Click(sender As Object, e As EventArgs) Handles gMonNotification.Click, gMonTrayNotification.Click Private Sub gMonNotification_Click(sender As Object, e As EventArgs) Handles gMonNotification.Click, gMonTrayNotification.Click
gMonNotification.Visible = False gMonNotification.Visible = False
gMonTrayNotification.Visible = False gMonTrayNotification.Visible = False
If gMonNotification.Tag = 0 Then
OpenGameManager(True) OpenGameManager(True)
End If
End Sub End Sub
Private Sub btnLogToggle_Click(sender As Object, e As EventArgs) Handles btnLogToggle.Click Private Sub btnLogToggle_Click(sender As Object, e As EventArgs) Handles btnLogToggle.Click
+2 -2
View File
@@ -3193,7 +3193,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to [PARAM] New Backups Restored. ''' Looks up a localized string similar to [PARAM] new saved game backups are being automatically restored..
'''</summary> '''</summary>
Friend ReadOnly Property frmMain_RestoreNotificationMulti() As String Friend ReadOnly Property frmMain_RestoreNotificationMulti() As String
Get Get
@@ -3202,7 +3202,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to [PARAM] New Backup Restored. ''' Looks up a localized string similar to A new saved game backup for [PARAM] is being automatically restored..
'''</summary> '''</summary>
Friend ReadOnly Property frmMain_RestoreNotificationSingle() As String Friend ReadOnly Property frmMain_RestoreNotificationSingle() As String
Get Get
+2 -2
View File
@@ -1751,10 +1751,10 @@
<value>[PARAM] has multiple configurations and cannot be automatically restored.</value> <value>[PARAM] has multiple configurations and cannot be automatically restored.</value>
</data> </data>
<data name="frmMain_RestoreNotificationMulti" xml:space="preserve"> <data name="frmMain_RestoreNotificationMulti" xml:space="preserve">
<value>[PARAM] New Backups Restored</value> <value>[PARAM] new saved game backups are being automatically restored.</value>
</data> </data>
<data name="frmMain_RestoreNotificationSingle" xml:space="preserve"> <data name="frmMain_RestoreNotificationSingle" xml:space="preserve">
<value>[PARAM] New Backup Restored</value> <value>A new saved game backup for [PARAM] is being automatically restored.</value>
</data> </data>
<data name="frmMain_NoAutoMark" xml:space="preserve"> <data name="frmMain_NoAutoMark" xml:space="preserve">
<value>The saved game folder for [PARAM] does not exist or could not be determined, this backup has been skipped.</value> <value>The saved game folder for [PARAM] does not exist or could not be determined, this backup has been skipped.</value>