Example #1
0
 //Muestra el diĆ”logo para salir de la aplicaciĆ³n
 public void ExitDialog(ExitDialog ventanaSalir)
 {
     if (ventanaSalir.ShowDialog() == true)
     {
         Application.Current.Shutdown();
     }
 }
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            var confirmation = GeneralSettings.ExitConfirmationType == ExitConfirmationType.Always ||
                               (GeneralSettings.ExitConfirmationType == ExitConfirmationType.InSortieOnly && KanColleClient.Current.IsInSortie);

            if (confirmation)
            {
                var vmodel = new DialogViewModel();
                var window = new ExitDialog
                {
                    DataContext = vmodel,
                    Owner       = this.MainWindow,
                };
                window.ShowDialog();

                e.Cancel = !vmodel.DialogResult;
            }

            base.OnSessionEnding(e);
        }
Example #3
0
        /// <summary>
        /// Handles the click on Quit menu item.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Quit_Click(object sender, RoutedEventArgs e)
        {
            if (this.projectstate.Saved == false && this.projectstate.Active == true)
            {
                //Ask to save
                ExitDialog exit = new ExitDialog();

                //Inject event
                exit.ProjectQuitted +=
                    new ExitDialog.QuitProjectEventHandler(QuitProject_Quit);

                //Set dialog to the center of MainWindow
                exit.Owner = this;

                exit.ShowDialog();
            }
            else
            {
                //Exit
                Environment.Exit(0);
            }
        }