private void frmMain_FormClosing(object sender, FormClosingEventArgs e) { if (podCastManager.DownloadInProgress && e.CloseReason != CloseReason.WindowsShutDown) { List <frmTaskDialog.Option> options = new List <frmTaskDialog.Option>(); options.Add(new frmTaskDialog.Option("Stop Podcast Download", "QuuxPlayer will exit.", 0)); options.Add(new frmTaskDialog.Option("Continue Podcast Download", "QuuxPlayer will not exit.", 1)); frmTaskDialog td = new frmTaskDialog("Podcast Download in Progress", "A podcast download is in progress. Do you want to quit anyway?", options); td.ShowDialog(this); switch (td.ResultIndex) { case 1: e.Cancel = true; break; } } // mnuMain is disabled if a panel is showing if (Locked && mnuMain.Enabled && e.CloseReason == CloseReason.UserClosing) { e.Cancel = true; } if (!e.Cancel) { this.Visible = false; SingletonApp.Close(); controller.Close(); Lib.ScreenSaverIsActive = screenSaverWasActive; closed = true; } }