示例#1
0
 private void ReadSettings()
 {
     try
     {
         if (Directory.Exists(AppDirectory.rootDirectory) == false)
         {
             Directory.CreateDirectory(AppDirectory.rootDirectory);
         }
         if (File.Exists(AppDirectory.defaultSettings) == false)
         {
             UserSettings.defaults.WriteToFile(AppDirectory.defaultSettings);
         }
         if (File.Exists($"{AppDirectory.rootDirectory}/user.json") == false)
         {
             try { this.settings = UserSettings.LoadFromFile(AppDirectory.defaultSettings); }
             catch (System.Exception ex) { Console.WriteLine(ex); }
             return;
         }
         else
         {
             try { this.settings = UserSettings.LoadFromFile(AppDirectory.userSettings); }
             catch (System.Exception ex) { Console.WriteLine(ex); }
         }
         if (settings == null)
         {
             Console.WriteLine("SETTINGS IS NULL");
         }
     }
     catch (System.IO.IOException exc) { Console.WriteLine(exc); }
     catch (System.Exception exc) { Console.WriteLine(exc); }
 }
示例#2
0
        private void ConfirmSettingReset()
        {
            MessageBoxResult result = MessageBox.Show("Are you sure you want to reset the colors?", "Confirm", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                try { this.settings = UserSettings.LoadFromFile(AppDirectory.defaultSettings); }
                catch (System.Exception ex) { Console.WriteLine(ex); }
                this.Delegate.ResetSettings();
            }
        }
 public void ResetSettings()
 {
     try { if (File.Exists(AppDirectory.userSettings))
           {
               File.Delete(AppDirectory.userSettings);
           }
     }
     catch (System.Exception ex) { Console.WriteLine(ex); }
     finally
     {
         try { this.settings = UserSettings.LoadFromFile(AppDirectory.defaultSettings); }
         catch (System.Exception ex) { Console.WriteLine(ex); }
         ApplySettings();
     }
 }
示例#4
0
 private void CheckForSettingsFile()
 {
     if (File.Exists($"{AppDirectory.rootDirectory}/user.json"))
     {
         try { this.settings = UserSettings.LoadFromFile(AppDirectory.userSettings); }
         catch (System.Exception ex) { Console.WriteLine(ex); }
     }
     else
     {
         try { this.settings = UserSettings.LoadFromFile(AppDirectory.defaultSettings); }
         catch (System.Exception ex) { Console.WriteLine(ex); }
     }
     if (this.settings == null)
     {
         Console.WriteLine("SETTINGS ARE NULL");
     }
 }