//------------------------------------------------------------------------- private void SaveSettings() { var appSettings = new OcrTestWPFSettings(); appSettings.Fields.WindowState = this.WindowState; appSettings.Fields.WindowLeft = this.Left; appSettings.Fields.WindowTop = this.Top; appSettings.Fields.WindowWidth = this.Width; appSettings.Fields.WindowHeight = this.Height; if (view.PathTextBox != MainWindowView.PathDef) appSettings.Fields.Path = view.PathTextBox; if (view.EtalonPathTextBox != MainWindowView.EtalonPathDef) appSettings.Fields.EtalonPath = view.EtalonPathTextBox; if (view.AppConfigPathTextBox != MainWindowView.AppConfigPathDef) appSettings.Fields.AppConfigPath = view.AppConfigPathTextBox; appSettings.Fields.IsTestingMode = view.IsTestingMode; appSettings.Save(); }
private void LoadSettings() { var appSettings = new OcrTestWPFSettings(); appSettings.Load(); if (!appSettings.SettingsExists) { SaveSettings(); } else { this.WindowState = appSettings.Fields.WindowState; this.Left = appSettings.Fields.WindowLeft; this.Top = appSettings.Fields.WindowTop; this.Width = appSettings.Fields.WindowWidth; this.Height = appSettings.Fields.WindowHeight; if (!String.IsNullOrEmpty(appSettings.Fields.Path)) view.PathTextBox = appSettings.Fields.Path; if (!String.IsNullOrEmpty(appSettings.Fields.EtalonPath)) view.EtalonPathTextBox = appSettings.Fields.EtalonPath; if (!String.IsNullOrEmpty(appSettings.Fields.AppConfigPath)) view.AppConfigPathTextBox = appSettings.Fields.AppConfigPath; view.TestingMode = (appSettings.Fields.IsTestingMode) ? 0 : 1; } }