/// <summary> /// Prevent the user from closing the window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if ((!this.Yes.IsEnabled) && (!data.installed)) { if (data.isConfiguring) { data.waitTerminateInstallation(); } else { var result = MessageBox.Show("Are you sure that you want to cancel the installation?", "Cancel installation?", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.No) { e.Cancel = true; } else { if (data.isConfiguring) { data.waitTerminateInstallation(); } else { data.cancelInstallation(); data.installed = false; data.Error = "Download cancelled by the user. You must be able to debug only after completing the download."; } } } } }