public SettingsEditorForm( ApplicationPreferences preferences ) { Preferences = preferences; InitializeComponent(); }
public SettingsEditorForm( ) { _preferences = ApplicationPreferences.GetDefaultPreferences(); InitializeComponent(); // this.isolatedStorageSettingsControl }
private void settingsToolStripButton_Click(object sender, EventArgs e) { var editorForm = new SettingsEditorForm(); editorForm.Preferences = _preferences; editorForm.ShowDialog(); if (setNewPreferences(_preferences, editorForm.Preferences)) { _preferences = editorForm.Preferences; SerializationUtility.Serialize2File(_preferences, _preferences.Path, false, false); } }
private bool setNewPreferences( ApplicationPreferences oldPreferences, ApplicationPreferences newPreferences ) { try { // Call all recepients one by one and provide actions for rolling // changes back // = editorForm.Preferences; _preferences.IsolatedStorageSettings = newPreferences.IsolatedStorageSettings; return true; } catch (Exception ex) { MessageBox.Show("Changes will not be applied! Reason:" + ex); return false; } }
public static ApplicationPreferences GetDefaultPreferences() { var retVal = new ApplicationPreferences(); retVal.Path = AssemblyInfoUtility.ApplicationSettingsCommonDirectory + @"\preferences.xml"; return retVal; }