Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
upgrade settings on outlok update (fixes #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristi993 committed Sep 1, 2018
1 parent 2686800 commit 2bee8c5
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 7 deletions.
19 changes: 16 additions & 3 deletions Room17DE.MeetingDecline/AddIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,27 @@ public partial class AddIn

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
#region settings
// check for settings upgrade after outlook update
if(Properties.Settings.Default.UpgradeRequired)
{
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.UpgradeRequired = false;
Properties.Settings.Default.Save();
}

// check if we have settings
if (Properties.Settings.Default.MeetingDeclineRules == null)
{
Properties.Settings.Default.MeetingDeclineRules = new Dictionary<string, DeclineRule>();

Properties.Settings.Default.Save();
}
if (Properties.Settings.Default.LastMailCheck == null)
{
Properties.Settings.Default.LastMailCheck = new Dictionary<string, DateTime>();

Properties.Settings.Default.Save();
Properties.Settings.Default.Save();
}
#endregion

// make sure that a deleted folder removes the meetingdecline rule
Folder deletedItemsFolder = (Folder)Application.Session.GetDefaultFolder(OlDefaultFolders.olFolderDeletedItems);
Expand Down
12 changes: 12 additions & 0 deletions Room17DE.MeetingDecline/Properties/Settings.Designer.cs

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

8 changes: 6 additions & 2 deletions Room17DE.MeetingDecline/Properties/Settings.settings
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Room17DE.MeetingDecline.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings />
<Settings>
<Setting Name="UpgradeRequired" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>
2 changes: 1 addition & 1 deletion Room17DE.MeetingDecline/Room17DE.MeetingDecline.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<PublishUrl>publish\</PublishUrl>
<InstallUrl />
<TargetCulture>en</TargetCulture>
<ApplicationVersion>1.0.0.5</ApplicationVersion>
<ApplicationVersion>1.0.0.6</ApplicationVersion>
<AutoIncrementApplicationRevision>true</AutoIncrementApplicationRevision>
<UpdateEnabled>true</UpdateEnabled>
<UpdateInterval>7</UpdateInterval>
Expand Down
2 changes: 1 addition & 1 deletion Room17DE.MeetingDecline/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public IDictionary<string, DateTime> LastMailCheck
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Add code to handle the SettingChangingEvent event here.
}

private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Add code to handle the SettingsSaving event here.
}
Expand Down
10 changes: 10 additions & 0 deletions Room17DE.MeetingDecline/app.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Room17DE.MeetingDecline.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup>
<userSettings>
<Room17DE.MeetingDecline.Properties.Settings>
<setting name="UpgradeRequired" serializeAs="String">
<value>True</value>
</setting>
</Room17DE.MeetingDecline.Properties.Settings>
</userSettings>
</configuration>

0 comments on commit 2bee8c5

Please sign in to comment.