Exemple #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            AppState.Current.Window = this;
            ScriptEngine.Create();
            AppEvents.InvokeStartup();

#pragma warning disable CS4014 // This call is executed on an another thread entirely, the await is thus not needed.
            new Thread(() => VersionChecker.CheckVersion(false, true, (s) => this.Dispatcher.Invoke(() => UpdateManager.Update(s)))).Start();
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

            if (!string.IsNullOrEmpty(this.OldWindowSaveData))
            {
                AppState.Current.Load(this.OldWindowSaveData, out _);
                this.OldWindowSaveData = null;
            }
            else
            {
                // opening a new empty window
                AppState.Current.Save();
                AppState.Current.ResetDefaultSaveFile();
            }

            this.Language_English.IsChecked = Settings.Default.Language.Equals("en-US");
            this.Language_Russian.IsChecked = Settings.Default.Language.Equals("ru-RU");
            this.Skin_Default.IsChecked     = Settings.Default.Skin == 0;
            this.Skin_Bright.IsChecked      = Settings.Default.Skin == 1;
            this.Skin_Dark.IsChecked        = Settings.Default.Skin == 2;
            this.Skin_Soft.IsChecked        = Settings.Default.Skin == 3;
            this.CB_Autoupdate.IsChecked    = Settings.Default.AutoUpdate;
            this.CB_PromptUpdates.IsChecked = !Settings.Default.HideUpdateNotification;
        }