Ejemplo n.º 1
0
        /// <param name="e"></param>
        /// <param name="sender"></param>
        /// </summary>
        /// Handles the Window Closing event.
        /// </summary>
        private void Manager_WindowClosing(object sender, WindowClosingEventArgs e)
// try
        {
            e.Cancel = !exit && exitConfirmation;

// Need to create the exit confirmation dialog?
            if (!exit && exitConfirmation && exitDialog == null)
// try
            {
                exitDialog = new ExitDialog(Manager);
                exitDialog.Init();
                exitDialog.Closed += closeDialog_Closed;
                exitDialog.ShowModal();
                Manager.Add(exitDialog);
            }
// Nope, just exit.
            else if (!exitConfirmation)
// try
            {
                Exit();
            }
        }
Ejemplo n.º 2
0
        /// <param name="e"></param>
        /// <param name="sender"></param>
        /// </summary>
        /// Handles the Dialog Closed event.
        /// </summary>
        private void closeDialog_Closed(object sender, WindowClosedEventArgs e)
// try
        {
// Check dialog resule and see if we need to shut down.
            if ((sender as Dialog).ModalResult == ModalResult.Yes)
// try
            {
                Exit();
            }
// Unhook event handlers and dispose of the dialog.
            else
// try
            {
                exit = false;
                exitDialog.Closed -= closeDialog_Closed;
                exitDialog.Dispose();
                exitDialog = null;
                if (mainWindow != null)
                {
                    mainWindow.Focused = true;
                }
            }
        }