コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: ifidakov/trunk
 //-------------------------------------------------------------------------
 private void SaveSettings()
 {
     var appSettings = new OcrWPFSettings();
     appSettings.Fields.WindowState = this.WindowState;
     if (double.IsNaN(Left))
         appSettings.Fields.WindowLeft = 0;
     else
         appSettings.Fields.WindowLeft = this.Left;
     if (double.IsNaN(Top))
         appSettings.Fields.WindowTop = 0;
     else
         appSettings.Fields.WindowTop = this.Top;
     appSettings.Fields.WindowWidth = this.Width;
     appSettings.Fields.WindowHeight = this.Height;
     appSettings.Fields.ThreadsCount = this.nudThreadsCount.Value;
     appSettings.Save();
 }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: ifidakov/trunk
 //-------------------------------------------------------------------------
 private void LoadSettings()
 {
     try
     {
         defaults = new OcrAppConfig();
         var appSettings = new OcrWPFSettings();
         appSettings.Load();
         if (!appSettings.SettingsExists)
         {
             SaveSettings();
         }
         else
         {
             this.WindowState = appSettings.Fields.WindowState;
             this.Left = appSettings.Fields.WindowLeft;
             this.Top = appSettings.Fields.WindowTop;
             if (appSettings.Fields.WindowWidth > 0)
                 this.Width = appSettings.Fields.WindowWidth;
             if (appSettings.Fields.WindowHeight > 0)
                 this.Height = appSettings.Fields.WindowHeight;
             this.nudThreadsCount.Value = appSettings.Fields.ThreadsCount;
         }
     }
     catch (Exception)
     {
         SaveSettings();
     }
 }