/// <summary> /// Saves the application settings to a file called TLCGenSettings.xml in the folder where the application runs /// </summary> public void SaveApplicationSettings() { try { string settingsfile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "TLCGen", "settings.xml"); TLCGenSerialization.Serialize(settingsfile, _Settings); } catch (Exception e) { MessageBox.Show("Error saving application settings:\n\n" + e.ToString() + "\n\nReverting to defaults.", "Error saving application settings"); _Settings = new TLCGenSettingsModel(); } }
/// <summary> /// Loads the application settings from a file called TLCGenSettings.xml if it exists in the folder where the application runs /// </summary> public void LoadApplicationSettings() { string settingsfile = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "TLCGenSettings.xml"); if (File.Exists(settingsfile)) { TLCGen.DataAccess.DeserializeT <TLCGenSettingsModel> deserializer = new TLCGen.DataAccess.DeserializeT <TLCGenSettingsModel>(); _Settings = deserializer.DeSerialize(settingsfile); } if (_Settings == null) { _Settings = new TLCGenSettingsModel(); } }
/// <summary> /// Loads the application settings from a file called TLCGenSettings.xml if it exists in the folder where the application runs /// </summary> public void LoadApplicationSettings() { try { string settingsfile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "TLCGen", "settings.xml"); if (File.Exists(settingsfile)) { _Settings = TLCGenSerialization.DeSerialize <TLCGenSettingsModel>(settingsfile); } if (_Settings == null) { _Settings = new TLCGenSettingsModel(); } } catch (Exception e) { MessageBox.Show("Error loading application settings:\n\n" + e.ToString() + "\n\nReverting to defaults.", "Error loading application settings"); _Settings = new TLCGenSettingsModel(); } }
/// <summary> /// Loads the application settings from a file called TLCGenSettings.xml if it exists in the folder where the application runs /// </summary> public void LoadApplicationSettings() { try { #warning Move this to app data... string settingsfile = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "TLCGenSettings.xml"); if (File.Exists(settingsfile)) { _Settings = TLCGenSerialization.DeSerialize <TLCGenSettingsModel>(settingsfile); } if (_Settings == null) { _Settings = new TLCGenSettingsModel(); } } catch (Exception e) { MessageBox.Show("Error loading application settings:\n\n" + e.ToString() + "\n\nReverting to defaults.", "Error loading application settings"); _Settings = new TLCGenSettingsModel(); } }