private async Task SaveAndExit() { if (_useDiscordRpc && !Properties.Settings.Default.UseDiscordRpc) // previously enabled { DiscordIntegration.Deinitialize(); } if (Properties.Settings.Default.AssetsLanguage != Languages_CbBox.SelectedIndex) { Properties.Settings.Default.AssetsLanguage = Languages_CbBox.SelectedIndex; await Localizations.SetLocalization(Properties.Settings.Default.AssetsLanguage, true).ConfigureAwait(false); } if (!_inputPath.Equals(Properties.Settings.Default.PakPath) || !_outputPath.Equals(Properties.Settings.Default.OutputPath) || _useEnglish != Properties.Settings.Default.UseEnglish) { DarkMessageBoxHelper.Show(Properties.Resources.PathChangedRestart, Properties.Resources.PathChanged, MessageBoxButton.OK, MessageBoxImage.Information); DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Restarting]", "Path(s) changed"); Properties.Settings.Default.Save(); Process.Start(Process.GetCurrentProcess().MainModule.FileName); Application.Current.Shutdown(); } else { Properties.Settings.Default.Save(); DebugHelper.WriteUserSettings(); DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Window]", "Closing General Settings"); } }
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { string errorMessage = string.Format(FModel.Properties.Resources.UnhandledExceptionOccured, e.Exception.Message); DebugHelper.WriteException(e.Exception, "thrown in App.xaml.cs by OnDispatcherUnhandledException"); DarkMessageBoxHelper.Show(errorMessage, FModel.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); e.Handled = true; }
private void OnDeleteSettings(object sender, RoutedEventArgs e) { Properties.Settings.Delete(); DarkMessageBoxHelper.Show(Properties.Resources.PathChangedRestart, Properties.Resources.PathChanged, MessageBoxButton.OK, MessageBoxImage.Information); DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Restarting]", "Settings reset"); Process.Start(Process.GetCurrentProcess().MainModule.FileName); Application.Current.Shutdown(); }
public static void CreateDirectoryFromDirectoryPath(string directoryPath) { if (!string.IsNullOrEmpty(directoryPath) && !Directory.Exists(directoryPath)) { try { Directory.CreateDirectory(directoryPath); } catch (Exception e) { DebugHelper.WriteException(e); DarkMessageBoxHelper.Show(Properties.Resources.CouldNotCreateDirectory + "\r\n\r\n" + e, "FModel - " + Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void FModel_MI_Settings_ChangeGame_Click(object sender, RoutedEventArgs e) { var launcher = new FLauncher(); if ((bool)launcher.ShowDialog()) { Properties.Settings.Default.PakPath = launcher.Path; DarkMessageBoxHelper.Show(Properties.Resources.PathChangedRestart, Properties.Resources.PathChanged, MessageBoxButton.OK, MessageBoxImage.Information); DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Restarting]", "Path(s) changed"); Properties.Settings.Default.Save(); Process.Start(Process.GetCurrentProcess().MainModule.FileName); Application.Current.Shutdown(); } }