private void setDefaults() { defaultSettings = new SIEEDefaultValues(); if (!string.IsNullOrEmpty(Properties.Settings.Default.DefaultSettings)) { try { defaultSettings.Initialize(Properties.Settings.Default.DefaultSettings); } catch (Exception e) { MessageBox.Show("Could not load default settings from " + Properties.Settings.Default.DefaultSettings + ":\n" + e.Message); defaultSettings = null; } } defaultFieldValues = new SIEEDefaultValues(); if (!string.IsNullOrEmpty(Properties.Settings.Default.DefaultValues)) { try { defaultFieldValues.Initialize(Properties.Settings.Default.DefaultValues); } catch (Exception e) { MessageBox.Show("Could not load default values from " + Properties.Settings.Default.DefaultValues + ":\n" + e.Message); defaultFieldValues = null; } } defaultDocument = Properties.Settings.Default.DefaultDocument; }
private void initializeDefaultSetting() { defaultSettings = new SIEEDefaultValues(); var ds = Properties.Settings.Default.DefaultSettings; if (!string.IsNullOrEmpty(ds)) { try { defaultSettings.Initialize(ds); } catch (Exception e) { SIEEMessageBox.Show( "Could not load default settings from " + ds + ":\n" + e.Message, "Default settings", System.Windows.MessageBoxImage.Error); } } }
public void LoadDefaultsFile(object sender, ExecutedRoutedEventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Document (*.xml)|*.xml"; dialog.Title = "Select default settings file"; if (dialog.ShowDialog() == true) { Properties.Settings.Default.DefaultSettings = dialog.FileName; Properties.Settings.Default.Save(); try { defaultSettings.Initialize(dialog.FileName); } catch (Exception ex) { SIEEMessageBox.Show( "Can't load " + dialog.FileName + ":\n" + ex.Message, "Default settings", System.Windows.MessageBoxImage.Error); } } }