Skip to content

Commit

Permalink
Added ability to export and import settings via XML file.
Browse files Browse the repository at this point in the history
Closes #1561
  • Loading branch information
phw198 committed Jul 15, 2023
1 parent 9eb3fb6 commit 7481a9c
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 6 deletions.
40 changes: 37 additions & 3 deletions src/OutlookGoogleCalendarSync/Forms/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 33 additions & 3 deletions src/OutlookGoogleCalendarSync/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ public void SyncNote(SyncNotes syncNote, Object extraData, Boolean show = true)
" Thank you for your subscription and support! " + cr +
" ";
break;

case SyncNotes.SubscriptionPendingExpire:
DateTime expiration = (DateTime)extraData;
note = " Your annual subscription for guaranteed quota " + cr +
Expand All @@ -831,15 +831,15 @@ public void SyncNote(SyncNotes syncNote, Object extraData, Boolean show = true)
url = urlStub + "OGCS Premium renewal from " + expiration.ToString("dd-MMM-yy", new System.Globalization.CultureInfo("en-US")) +
" for " + Settings.Instance.GaccountEmail;
break;

case SyncNotes.SubscriptionExpired:
expiration = (DateTime)extraData;
note = " Your annual subscription for guaranteed quota " + cr +
" for Google calendar usage expired on " + expiration.ToString("dd-MMM") + "." + cr +
" Click to renew for just £1/month. ";
url = urlStub + "OGCS Premium renewal for " + Settings.Instance.GaccountEmail;
break;

case SyncNotes.NotLogFile:
note = " This is not the log file. " + cr +
" --------- " + cr +
Expand Down Expand Up @@ -1042,6 +1042,7 @@ private void tbSyncNote_Click(object sender, EventArgs e) {
}
#endregion

#region Save settings
private void tabAppSettings_DrawItem(object sender, DrawItemEventArgs e) {
//Want to have horizontal sub-tabs on the left of the Settings tab.
//Need to handle this manually
Expand Down Expand Up @@ -1114,6 +1115,35 @@ private void Save_Click(object sender, EventArgs e) {
bSave.Text = "Save";
}
}
private void miExportSettings_Click(object sender, EventArgs e) {
SaveFileDialog exportFile = new SaveFileDialog {
Title = "Backup OGCS Settings to File",
FileName = "OGCS_v" + Settings.Instance.Version + ".xml",
Filter = "XML File|*.xml|All Files|*",
DefaultExt = "xml",
AddExtension = true,
OverwritePrompt = true
};
if (exportFile.ShowDialog() == DialogResult.OK) {
log.Info("Exporting settings to " + exportFile.FileName);
Settings.Instance.Save(exportFile.FileName);
}
}
private void miImportSettings_Click(object sender, EventArgs e) {
OpenFileDialog importFile = new OpenFileDialog {
Title = "Import OGCS Settings from File",
Filter = "XML File|*.xml|All Files|*",
DefaultExt = "xml",
CheckFileExists = true,
Multiselect = false
};
if (importFile.ShowDialog() == DialogResult.OK) {
log.Info("Importing settings from " + importFile.FileName);
Settings.Load(importFile.FileName);
updateGUIsettings();
}
}
#endregion
#region Profile
/// <summary>
/// The calendar settings profile currently displayed in the GUI.
Expand Down
3 changes: 3 additions & 0 deletions src/OutlookGoogleCalendarSync/Forms/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ Obtain new values from the Google Developer Console.
You'll need to enable the Calendar API in your project:
</value>
</data>
<metadata name="msSettingsActions.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="label21.Text" xml:space="preserve">
<value>On the "Google" tab, select the calendar you wish to synchronise.

Expand Down

0 comments on commit 7481a9c

Please sign in to comment.