private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { Settings.SaveFileLocation = SaveLocationBox.Text; Settings.BackupLocation = BackupLocationBox.Text; SettingsDao.SaveSettings("fm7backupsettings.json", Settings); }
// Yeah I know, quick and dirty code in the view class private void Initialize() { Settings = SettingsDao.LoadSettings("fm7backupsettings.json"); // Load was a failure, auto generate settings if (Settings == null) { Settings = new AppSettings(); try { Settings.SaveFileLocation = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Packages\\Microsoft.ApolloBaseGame_8wekyb3d8bbwe\\SystemAppData"; Settings.BackupLocation = Environment.CurrentDirectory + "\\FM7Backups"; } catch (Exception e) { Console.WriteLine(e); } } // Update view SaveLocationBox.Text = Settings.SaveFileLocation; BackupLocationBox.Text = Settings.BackupLocation; if (Settings.DateType == DateType.Readable) { NamingHumanButton.IsChecked = true; } else { NamingUnixButton.IsChecked = true; } return; }