/// <summary> /// Saves the stored data /// </summary> public static void Save() { // Save all the settings one by one SGGlobals.SaveSetting(SGGlobals.BaseRegistryKey, "ShowPreviewButton", ShowPreviewButton); SGGlobals.SaveSetting(SGGlobals.BaseRegistryKey, "ShowCopyButton", ShowCopyButton); SGGlobals.SaveSetting(SGGlobals.BaseRegistryKey, "ShowHamButton", ShowHamButton); SGGlobals.SaveSetting(SGGlobals.BaseRegistryKey, "ShowSelectButton", ShowSelectButton); SGGlobals.SaveSetting(SGGlobals.BaseRegistryKey, "SuppressConfirm", SuppressConfirm); SGGlobals.SaveSetting(SGGlobals.BaseRegistryKey, "DefaultSpamProfileId", DefaultSpamProfileId); SGGlobals.SaveSetting(SGGlobals.BaseRegistryKey, "DefaultHamProfileId", DefaultHamProfileId); }
/// <summary> /// Resets the default Ham / Spam profile /// </summary> /// <param name="dftProfile">Which profile type to reset</param> public static void ResetDefaultProfile(DefaultType pdftProfile) { switch (pdftProfile) { case DefaultType.Ham: SGGlobals.SaveSetting(SGGlobals.BaseRegistryKey, "DefaultHamProfileId", string.Empty); break; case DefaultType.Spam: SGGlobals.SaveSetting(SGGlobals.BaseRegistryKey, "DefaultSpamProfileId", string.Empty); break; } }
/// <summary> /// Re-populates all the settings from the database, discarding any changes made /// </summary> public static void LoadSettings() { string strKey = SGGlobals.BaseRegistryKey; // Make sure the key exists if (!SGGlobals.DoesKeyExist(strKey)) { throw new Exception("The confguration key could not be found"); } _blnShowPreviewButton = SGGlobals.LoadValue(strKey, "ShowPreviewButton", true); _blnShowCopyButton = SGGlobals.LoadValue(strKey, "ShowCopyButton", true); _blnShowHamButton = SGGlobals.LoadValue(strKey, "ShowHamButton", true); _blnShowSelectButton = SGGlobals.LoadValue(strKey, "ShowSelectButton", false); _blnSuppressConfirm = SGGlobals.LoadValue(strKey, "SuppressConfirm", true); }