コード例 #1
0
        private async void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (e.Cancel)
            {
                return;
            }
            e.Cancel = true;
            if (_shutdown)
            {
                return;
            }

            var mySettings = new MetroDialogSettings()
            {
                AffirmativeButtonText = Get_language_text("Quit"),
                NegativeButtonText    = Get_language_text("Cancel"),
                AnimateShow           = true,
                AnimateHide           = false,
                ColorScheme           = MetroDialogColorScheme.Inverted
            };

            var result = await this.ShowMessageAsync(Get_language_text("Quit_application?"),
                                                     Get_language_text("Sure_you_want_to_quit_application"),
                                                     MessageDialogStyle.AffirmativeAndNegative, mySettings);

            _shutdown = result == MessageDialogResult.Affirmative;

            if (_shutdown)
            {
                Save_Load.SaveData();
                CMDinput("quit");
                try { cmd.cmd.Kill(); } catch { }
                Application.Current.Shutdown();
            }
        }
コード例 #2
0
        public MainWindow()
        {
            status    = Status.preparing;
            _instance = this;     // 1
            Save_Load.LoadData(); //2

            InitializeComponent();
            language_manager.LoadLanguage(LanguagePack);
            preparing.Visibility = Visibility.Visible;

            SetStatusBar(Get_language_text("preparing"), 1);
            cmd = new Core();
            cmd.init();
        }