/// <summary> /// Method called on language changed click event. /// </summary> /// <param name="sender">The <see cref="object"/> sender of the event.</param> /// <param name="e">The routed event arguments <see cref="RoutedEventArgs"/>.</param> private void LanguageChanged_Click(object sender, RoutedEventArgs e) { // Ask for user confirmation. var result = MessageBoxs.YesNo(Layouts.Dialogs.Properties.Translations.ApplicationRestartRequired, Local.Properties.Translations.Language); if (result != MessageBoxResult.Yes) { return; } // Get culture parameters. MenuItem menu = (MenuItem)sender; string culture = (string)menu.Tag; CultureInfo before = Thread.CurrentThread.CurrentCulture; // Change application culture info. try { Thread.CurrentThread.CurrentCulture = new CultureInfo(culture); } catch { Thread.CurrentThread.CurrentUICulture = before; } // Save language to the application preferences. ApplicationBase.Language = Thread.CurrentThread.CurrentCulture.ToString(); ApplicationBase.Save(); // Restart the application. System.Windows.Forms.Application.Restart(); Application.Current.Shutdown(); }
/// <summary> /// Method to save the application settings. /// </summary> private void SaveSettings() { Trace.WriteLine("-------------------------------------------------------------------------------------------------------"); Trace.TraceInformation(Local.Properties.Logs.WaitingApplicationSave); Settings.Controls.Default.Save(); Settings.Sections.Default.Save(); ApplicationBase.Save(); }
/// <summary> /// Method called before the application closing. /// </summary> /// <param name="sender">The object sender of the event</param> /// <param name="e">Exit event arguments.</param> private void App_Exit(object sender, ExitEventArgs e) { Trace.WriteLine(string.Format("# {0}.{1} ------------------------------------------------", MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name)); Trace.WriteLine("Saving the application options & parameters before exit. Please wait..."); ApplicationBase.Save(); Trace.WriteLine("-------------------------------------------------------------------------------------------------------"); Trace.WriteLine(""); }