twalrant / OutlookGnuPG

GnuPG addin for Outlook 2007
http://wiki.github.com/twalrant/OutlookGnuPG
GNU General Public License v3.0
18 stars 5 forks source link

Settings lost on Outlook upgrade #43

Open doegox opened 14 years ago

doegox commented 14 years ago

This is due to the fact that the path to user.config file where plugin settings are stored depends on application (Outlook) version (e.g. 12.0.6535.5005).

Abstract from http://www.windowsforms.com/Samples/Go%20To%20Market/Config/Client%20Settings%20FAQ.doc :

It is easy to upgrade settings from a previous version of the application to the latest. Simply call ApplicationSettingsBase.Upgrade() and it will retrieve settings from the previous version that match the current version of the class and store them out in the current version's user.config file. You also have the option of overriding this behavior either in your settings class or in your provider implementation.

Here is one idea for determining when to call Upgrade: Have a boolean setting called CallUpgrade with a default value of true. When your app starts up, do the following:

if (Properties.Settings.Value.CallUpgrade)
{
    Properties.Settings.Value.Upgrade();
    Properties.Settings.Value.CallUpgrade = false;
}

This will ensure that Upgrade( ) is called only the first time the application runs after a new version is deployed.

doegox commented 14 years ago

Maybe we should just store settings in the Registry...