Exemple #1
0
        public bool CloseSelf()
        {
            if (AppState.Current.UnsavedChangesExist)
            {
                MessageBoxResult result = MessageBox.Show(Properties.Resources.Generic_Unsaved_Description, Properties.Resources.Generic_Unsaved_Title, MessageBoxButton.YesNoCancel);
                if (result == MessageBoxResult.Cancel)
                {
                    return(false);
                }

                if (result == MessageBoxResult.No)
                {
                    AppEvents.InvokeExit();
                    return(true);
                }

                if (result == MessageBoxResult.Yes)
                {
                    this.Save_Click(this.Save, null);
                    AppEvents.InvokeExit();
                    return(true);
                }
            }

            return(true);
        }
Exemple #2
0
        public void ChangeLanguage(string lang, bool forceChange = false, bool reloadApp = false)
        {
            // Legacy afapter
            if (lang.Length == 1 && char.IsNumber(lang[0]))
            {
                lang = lang[0] == '0' ? "en-US" : "ru-RU";
            }

            bool langEquals = Settings.Default.Language.Equals(lang);

            if (!langEquals || forceChange)
            {
                Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(lang);
                if (!langEquals)
                {
                    Settings.Default.Language = lang;
                    Settings.Default.Save();
                    if (reloadApp)
                    {
                        string s = AppState.Current.Save();
                        this._forceClose = true;
                        AppEvents.InvokeExit();
                        Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
                        this.Close();
                        new MainWindow()
                        {
                            OldWindowSaveData = s
                        }.Show();
                        Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
                        return;
                    }
                }
            }
        }
Exemple #3
0
 public void ChangeSkin(int skinID, bool reloadApp = false)
 {
     if (Settings.Default.Skin != skinID)
     {
         Settings.Default.Skin = skinID;
         Settings.Default.Save();
         ((App)Application.Current).ChangeSkin();
         if (reloadApp)
         {
             string s = AppState.Current.Save();
             this._forceClose = true;
             AppEvents.InvokeExit();
             Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
             this.Close();
             new MainWindow()
             {
                 OldWindowSaveData = s
             }.Show();
             Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
             return;
         }
     }
 }