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; } }
public frmMain() { instance = this; if (SingletonApp.AlreadyExists) { if (Environment.GetCommandLineArgs().Length < 2) { QMessageBox.Show(this, Localization.Get(UI_Key.Dialog_Already_Running, Application.ProductName), Localization.Get(UI_Key.Dialog_Already_Running_Title), QMessageBoxIcon.Information); } else { SingletonApp.NotifyExistingInstance(Environment.GetCommandLineArgs()); } abort = true; return; } else { string arg = String.Empty; if (Environment.GetCommandLineArgs().Length > 1) { arg = Environment.GetCommandLineArgs()[1]; } switch (arg.ToLowerInvariant()) { case "/reinstall": case "/hideicons": case "/showicons": abort = true; return; default: SingletonApp.Initialize(); SingletonApp.NewInstanceMessage += new NewInstanceMessageEventHandler(SingleInstanceApplication_NewInstanceMessage); break; } } settingView = false; locked = false; setupControls(); init(); initialized = true; initalizeController(); mnuMain.Renderer = new MenuItemRenderer(); screenSaverWasActive = Lib.ScreenSaverIsActive; if (Setting.DisableScreensaver) { Lib.ScreenSaverIsActive = false; } this.KeyPreview = true; SetView(ViewType.Normal, false); preventPowerEvent(); QSplitContainer.Initialized = true; #if DEBUG setupTestMenu(); Started = true; #endif }