Skip to content

Commit 247cde8

Browse files
committed
Display notifications about backups
1 parent f6dfc81 commit 247cde8

14 files changed

+375
-30
lines changed

src/GHOSTbackup/GHOSTbackup.Helpers/BackupHelper.vb

+4
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,12 @@ Public Class BackupHelper
123123
Form1.LatestBackupHelpLabel.Location = New Point(300, 14)
124124

125125
Logger.Log("[INFO] Performed the first backup " & "(" & SavegamesList.Length & " files copied to " & BackupDirectory & ").")
126+
Notification.Show("Performed first backup.")
126127

127128
Catch ex As Exception
128129
StopBackup()
129130
Logger.Log("[ERROR] Backup interrupted: " & ex.Message())
131+
Notification.Show("Backup interrupted because an error occurred.")
130132
CustomMsgBox.Show("{\rtf1 The backup process has been {\b interrupted due to an error.} Please check the logs for more details.}", "Backup interrupted", MessageBoxButtons.OKCancel, MessageBoxIcon.Error)
131133
End Try
132134
ElseIf IsGameRunning = False Then
@@ -155,10 +157,12 @@ Public Class BackupHelper
155157
Form1.LatestBackupHelpLabel.Location = New Point(300, 14)
156158

157159
Logger.Log("[INFO] Backup complete " & "(" & SavegamesList.Length & " files copied to " & BackupDirectory & ").")
160+
Notification.Show("Backup complete.")
158161

159162
Catch ex As Exception
160163
StopBackup()
161164
Logger.Log("[ERROR] Backup interrupted: " & ex.Message())
165+
Notification.Show("Backup interrupted because an error occurred.")
162166
CustomMsgBox.Show("{\rtf1 The backup process has been {\b interrupted due to an error.} Please check the logs for more details.}", "Backup interrupted", MessageBoxButtons.OKCancel, MessageBoxIcon.Error)
163167
End Try
164168
Else

src/GHOSTbackup/GHOSTbackup.Helpers/Settings.vb

+14
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Public Class Settings
2727
ConfigData("Backup")("SavegamesDirectory") = Nothing
2828
ConfigData("Backup")("BackupDirectory") = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\GHOSTbackup\Savegames"
2929
ConfigData("Backup")("BackupFrequency") = "5"
30+
ConfigData("Backup")("DisplayNotification") = "False"
3031
ConfigData("Backup")("WhichBackupToRestore") = "0" '0=Latest, 1=Second-to-Last, 2=Let me decide
3132
'Uplay
3233
ConfigData("Uplay")("DisableCloudSyncOnRestore") = "False"
@@ -60,6 +61,7 @@ Public Class Settings
6061
Form1.SavegamesLocTextBox.Text = SavegamesDirectory()
6162
Form1.BackupLocTextBox.Text = BackupDirectory()
6263
Form1.BackupFreqUpDown.Value = BackupFrequency()
64+
Form1.DisplayNotificationChkBox.Checked = DisplayNotification()
6365
Form1.WhichBackupDropdownCombo.SelectedIndex = WhichBackupToRestore()
6466
'Uplay
6567
Form1.DisableCloudSyncChkBox.Checked = DisableCloudSyncOnRestore()
@@ -87,6 +89,7 @@ Public Class Settings
8789
ConfigData("Backup")("SavegamesDirectory") = Form1.SavegamesLocTextBox.Text
8890
ConfigData("Backup")("BackupDirectory") = Form1.BackupLocTextBox.Text
8991
ConfigData("Backup")("BackupFrequency") = Form1.BackupFreqUpDown.Value
92+
ConfigData("Backup")("DisplayNotification") = Form1.DisplayNotificationChkBox.Checked
9093
ConfigData("Backup")("WhichBackupToRestore") = Form1.WhichBackupDropdownCombo.SelectedIndex
9194
'Uplay
9295
ConfigData("Uplay")("DisableCloudSyncOnRestore") = Form1.DisableCloudSyncChkBox.Checked
@@ -214,6 +217,17 @@ Public Class Settings
214217
End If
215218
End Function
216219

220+
Private Shared Function DisplayNotification() As Boolean
221+
Dim ConfigData As IniData = ConfigParser.ReadFile(SettingsFile)
222+
223+
Dim Value As String = ConfigData("Backup")("DisplayNotification")
224+
If Value <> Nothing Then
225+
Return Boolean.Parse(Value)
226+
Else
227+
Return False
228+
End If
229+
End Function
230+
217231
Private Shared Function WhichBackupToRestore() As Integer
218232
Dim ConfigData As IniData = ConfigParser.ReadFile(SettingsFile)
219233

src/GHOSTbackup/GHOSTbackup.UI/Banner.vb

+7-6
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
Form1.LogoBigPictureBox.Location = New Point(12, 115)
1919
Form1.PlayGameBtn.Location = New Point(12, 180)
2020
'Move checkboxes
21-
Form1.ConfirmExitChkBox.Location = New Point(14, 255)
22-
Form1.ConfirmStopBackupChkBox.Location = New Point(14, 280)
23-
Form1.DisableCloudSyncChkBox.Location = New Point(14, 305)
24-
Form1.EnableCloudSyncChkBox.Location = New Point(14, 330)
25-
Form1.CheckUpdatesChkBox.Location = New Point(14, 355)
26-
Form1.RememberFormPositionChkBox.Location = New Point(14, 380)
21+
Form1.ConfirmExitChkBox.Location = New Point(14, 250)
22+
Form1.ConfirmStopBackupChkBox.Location = New Point(14, 275)
23+
Form1.DisplayNotificationChkBox.Location = New Point(14, 300)
24+
Form1.DisableCloudSyncChkBox.Location = New Point(14, 325)
25+
Form1.EnableCloudSyncChkBox.Location = New Point(14, 350)
26+
Form1.CheckUpdatesChkBox.Location = New Point(14, 375)
27+
Form1.RememberFormPositionChkBox.Location = New Point(14, 400)
2728
'Center alert icon and message
2829
Form1.AlertDescriptionLabel.Location = New Point(Form1.AlertContainer.Width / 2 - Form1.AlertDescriptionLabel.Width / 2, Form1.AlertContainer.Height / 2 - Form1.AlertDescriptionLabel.Height / 2)
2930
Form1.AlertIcon.Location = New Point(Form1.AlertContainer.Width / 2 - Form1.AlertDescriptionLabel.Width / 2 - 28, Form1.AlertContainer.Height / 2 - Form1.AlertIcon.Height / 2)

src/GHOSTbackup/GHOSTbackup.UI/Form1.Designer.vb

+37-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GHOSTbackup/GHOSTbackup.UI/Form1.resx

+3
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,9 @@
631631
<metadata name="EnableCloudSyncChkBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
632632
<value>True</value>
633633
</metadata>
634+
<metadata name="DisplayNotificationChkBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
635+
<value>True</value>
636+
</metadata>
634637
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
635638
<value>True</value>
636639
</metadata>

src/GHOSTbackup/GHOSTbackup.UI/Form1.vb

+15-6
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,13 @@ Public Class Form1
191191
LogoBigPictureBox.Location = New Point(12, 85)
192192
PlayGameBtn.Location = New Point(12, 150)
193193
'Move checkboxes
194-
ConfirmExitChkBox.Location = New Point(14, 230)
195-
ConfirmStopBackupChkBox.Location = New Point(14, 255)
196-
DisableCloudSyncChkBox.Location = New Point(14, 280)
197-
EnableCloudSyncChkBox.Location = New Point(14, 305)
198-
CheckUpdatesChkBox.Location = New Point(14, 330)
199-
RememberFormPositionChkBox.Location = New Point(14, 355)
194+
ConfirmExitChkBox.Location = New Point(14, 225)
195+
ConfirmStopBackupChkBox.Location = New Point(14, 250)
196+
DisplayNotificationChkBox.Location = New Point(14, 275)
197+
DisableCloudSyncChkBox.Location = New Point(14, 300)
198+
EnableCloudSyncChkBox.Location = New Point(14, 325)
199+
CheckUpdatesChkBox.Location = New Point(14, 350)
200+
RememberFormPositionChkBox.Location = New Point(14, 375)
200201
End Sub
201202

202203
Private Sub PlayGameBtn_Click(sender As Object, e As EventArgs) Handles PlayGameBtn.Click
@@ -219,6 +220,14 @@ Public Class Form1
219220
End If
220221
End Sub
221222

223+
Private Sub DisplayNotificationChkBox_CheckedChanged(sender As Object, e As EventArgs) Handles DisplayNotificationChkBox.CheckedChanged
224+
If DisplayNotificationChkBox.Checked = True Then
225+
DisplayNotificationChkBox.ForeColor = Color.White
226+
Else
227+
DisplayNotificationChkBox.ForeColor = Color.FromArgb(255, 85, 170, 255)
228+
End If
229+
End Sub
230+
222231
Private Sub DisableCloudSyncChkBox_CheckedChanged(sender As Object, e As EventArgs) Handles DisableCloudSyncChkBox.CheckedChanged
223232
If DisableCloudSyncChkBox.Checked = True Then
224233
DisableCloudSyncChkBox.ForeColor = Color.White

0 commit comments

Comments
 (0)