// Preview prevWindow; public MainWindow() { this.InitializeComponent(); this.loadFileDialog = new OpenFileDialog(); this.settings = ProjectSettings.GetSettings(); this.IniializeVisibilities(); this.InitializeContent(); }
public ProjectSettings Deserialize(string path = "saved-settings.xml") { XmlSerializer x = new XmlSerializer(this.GetType()); StreamReader file = new StreamReader(path); _instance = (ProjectSettings)x.Deserialize(file); file.Close(); return _instance; }
// единтвения начин за инстанцииране е от тук public static ProjectSettings GetSettings() { if (_instance == null) { _instance = new ProjectSettings(); } return _instance; }
private void btnLoadSettings_Click(object sender, RoutedEventArgs e) { this.loadFileDialog = new OpenFileDialog(); this.loadFileDialog.Filter = "XML (.XMl)|*.xml"; this.loadFileDialog.Multiselect = false; this.loadFileDialog.ShowDialog(); if (!string.IsNullOrEmpty(this.loadFileDialog.FileName)) { this.settings = this.settings.Deserialize(this.loadFileDialog.FileName); this.InitializeSyncronization(); this.InitializeContent(); } }