System.Windows.Forms.Form.OnFormClosing(System.Windows.Forms.FormClosingEventArgs)

Here are the examples of the csharp api class System.Windows.Forms.Form.OnFormClosing(System.Windows.Forms.FormClosingEventArgs) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

31 Examples 7

1. Example

Project: InnovatorAdmin
Source File: ProgressDialog.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
    {
      base.OnFormClosing(e);
      GlobalProgress.Instance.Stop();
      if (_box != null)
        _box.Dispose();
    }

2. Example

Project: mbunit-v3
Source File: ProgressMonitorDialog.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);
            progressMonitor.Changed -= OnProgressMonitorOnChanged;
        }

3. Example

Project: mutefm
Source File: WebBgMusicForm.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            if ((e.CloseReason == CloseReason.WindowsShutDown) || (e.CloseReason == CloseReason.TaskManagerClosing))
                return;

            MessageBoxEx msgBoxEx = new MessageBoxEx("Closing this window will stop your music.\n\nAre you sure you want to do this?", "Minimize");
            msgBoxEx.ShowDialog();
            switch (msgBoxEx.ButtonPressedIndex)
            {
                case 0:
                    base.OnFormClosing(e);
                    break;
                case 1:
                    e.Cancel = true;
                    break;
                case 2:
                    e.Cancel = true;
                    this.WindowState = FormWindowState.Minimized;
                    break;
            }
        }

4. Example

Project: lua-tilde
Source File: DockContent.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
		{
			if (HideOnClose)
			{
				m_dockHandler.Hide();
				e.Cancel = true;
			}
			else
				base.OnFormClosing(e);
		}

5. Example

Project: Speed-Test-Loggger
Source File: FormSettings.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            // Update configuration settings
            Settings.Default.AutoDownload = RadioAutoDownload.Checked;
            Settings.Default.DownloadURL = TextDownloadURL.Text;

            Settings.Default.AutoIPDetect = RadioAutoDetectIP.Checked;
            Settings.Default.IPDetectURL = TextIPDetectURL.Text;

            if (RadioISOFormat.Checked) Settings.Default.TimeFormat = 0;
            else if (RadioEUFormat.Checked) Settings.Default.TimeFormat = 1;
            else if (RadioUSFormat.Checked) Settings.Default.TimeFormat = 2;

            Settings.Default.SpeedUnits = !RadioBitsPerSecond.Checked;
            Settings.Default.LogFile = TextLogFile.Text;
            Settings.Default.CheckConnection = ComboCheckConnection.SelectedIndex;
            Settings.Default.AutoStart = CheckAutoStart.Checked;
            Settings.Default.Minimize = CheckMinimize.Checked;            

            // Continue processing the event as usual
            base.OnFormClosing(e);
        }

6. Example

Project: AntMeCore
Source File: LoaderForm.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            updateTimer.Enabled = false;
            base.OnFormClosing(e);
        }

7. Example

Project: Oxide.Patcher
Source File: PatchProcessForm.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            if (!thetask.IsCompleted)
            {
                e.Cancel = true;
                return;
            }
            base.OnFormClosing(e);
        }

8. Example

Project: Tor.NET
Source File: ProgramUI.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);

            if (client != null && client.IsRunning)
            {
                closing = true;
                client.Status.BandwidthChanged -= OnClientBandwidthChanged;
                client.Status.CircuitsChanged -= OnClientCircuitsChanged;
                client.Dispose();

                e.Cancel = true;
            }
        }

9. Example

Project: Gorgon
Source File: FormSplash.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
		{
			base.OnFormClosing(e);

			if (e.CloseReason == CloseReason.UserClosing)
			{
				e.Cancel = true;
			}
		}

10. Example

Project: Gorgon
Source File: formMain.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
		{
			base.OnFormClosing(e);

            if (_cursor != null)
            {
                _cursor.Dispose();
                _cursor = null;
            }

			if (_spray == null)
			{
				return;
			}

			_spray.Dispose();
			_spray = null;
		}

11. Example

Project: Gorgon
Source File: formMain.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
		{
			base.OnFormClosing(e);

			if (_surface == null)
			{
				return;
			}

			_surface.Dispose();
			_surface = null;
		}

12. Example

Project: Gorgon
Source File: FormSplash.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
		{
			base.OnFormClosing(e);

			if (e.CloseReason == CloseReason.UserClosing)
			{
				e.Cancel = true;
			}
		}

13. Example

Project: DiabloInterface
Source File: MainWindow.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            itemServer.Stop();
            base.OnFormClosing(e);
        }

14. Example

Project: duality
Source File: MainForm.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
		{
			base.OnFormClosing(e);
			bool isUserCloseReason;
			switch (e.CloseReason)
			{
				default:
				case CloseReason.ApplicationExitCall:
				case CloseReason.WindowsShutDown:
				case CloseReason.TaskManagerClosing:
					isUserCloseReason = false;
					break;
				case CloseReason.FormOwnerClosing:
				case CloseReason.MdiFormClosing:
				case CloseReason.UserClosing:
					isUserCloseReason = true;
					break;
			}

			// Save UserData before quitting
			DualityEditorApp.SaveUserData();
			DualityApp.SaveAppData();

			bool isClosedByUser = 
				isUserCloseReason && 
				!this.nonUserClosing && 
				!DualityEditorApp.IsReloadingPlugins;

			e.Cancel = !DualityEditorApp.Terminate(isClosedByUser);
		}

15. Example

Project: MiniMVP
Source File: View.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            e.Cancel = !CanClose();

            base.OnFormClosing(e);
        }

16. Example

Project: dp2
Source File: MyForm.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);
            if (this.SuppressFormClosing == false)
                this.OnMyFormClosing(e);
        }

17. Example

Project: SyncthingTray
Source File: BaseForm.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            if (WindowState != FormWindowState.Minimized)
            {
                e.Cancel = true;
                WindowState = FormWindowState.Minimized;
                Hide();
                return;
            }
            base.OnFormClosing(e);
        }

18. Example

Project: WzComparerR2
Source File: AlphaForm.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            if (e.CloseReason == System.Windows.Forms.CloseReason.UserClosing)
            {
                e.Cancel = true;
                this.Hide();
                return;
            }
            base.OnFormClosing(e);
        }

19. Example

Project: LegendCraft
Source File: MainForm.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            if (startupThread != null && !shutdownComplete)
            {
                Shutdown(ShutdownReason.ProcessClosing, true);
                e.Cancel = true;
            }
            else
            {
                base.OnFormClosing(e);
            }
        }

20. Example

Project: LegendCraft
Source File: MainForm.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            if (startupThread != null && !shutdownComplete)
            {
                Shutdown(ShutdownReason.ProcessClosing, true);
                e.Cancel = true;
            }
            else
            {
                base.OnFormClosing(e);
            }
        }

21. Example

Project: Sharp80
Source File: MainForm.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            if (computer.SaveChangedStorage())
            {
                settings.WindowX = Location.X;
                settings.WindowY = Location.Y;
                settings.WindowWidth = ClientSize.Width;
                settings.WindowHeight = ClientSize.Height;
                settings.Save();
                Task.Run(Stop);
            }
            else
            {
                e.Cancel = true;
            }
            base.OnFormClosing(e);
        }

22. Example

Project: CrewChiefV4
Source File: MainWindow.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);
            lock (cw)
            {
                cw.textbox = null;
                cw.Dispose();
            }
        }

23. Example

Project: poderosa
Source File: MacroTrace.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e) {
            if (_hideOnCloseButton && e.CloseReason == CloseReason.UserClosing) {
                e.Cancel = true;
                Hide();
                return;
            }
            base.OnFormClosing(e);
        }

24. Example

Project: CSVAnalyzerPro
Source File: Form1.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e) {
            base.OnFormClosing(e);

            if (e.CloseReason == CloseReason.WindowsShutDown) return;
            if (!_exiting) {
                switch (MessageBox.Show(this, "Are you sure you want to exit?", "Closing", MessageBoxButtons.YesNo)) {
                    case DialogResult.No:
                        e.Cancel = true;
                        break;
                    case DialogResult.Yes:
                        ExitAll();
                        break;
                    default:
                        break;
                }
            }
        }

25. Example

Project: Gorgon
Source File: formMain.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
		{
			base.OnFormClosing(e);

			if (_graphics != null)
				_graphics.Dispose();

			if (_formGraphics != null)
				_formGraphics.Dispose();

			if (_bitmap != null)
				_bitmap.Dispose();
		}

26. Example

Project: Gorgon
Source File: formMain.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
		{
			base.OnFormClosing(e);

			if (_graphics != null)
				_graphics.Dispose();

			if (_formGraphics != null)
				_formGraphics.Dispose();

			if (_bitmap != null)
				_bitmap.Dispose();
		}

27. Example

Project: AnotherSc2Hack
Source File: BaseRenderer.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            Hide();

            if (!IsAllowedToClose)
                e.Cancel = true;

            OnCloseCalled();

            base.OnFormClosing(e);
        }

28. Example

Project: cspacman
Source File: PacManUI.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            if (!ts.IsCancellationRequested)
            {
                ts.Cancel();

                lock (ts)
                {
                    Invoke(new Action(() => Close()));
                }
            }
            else
            {
                base.OnFormClosing(e);
            }
        }

29. Example

Project: Gorgon
Source File: formMain.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
		{
			base.OnFormClosing(e);

			try
			{
				if (_picture != null)
				{
					_picture.Dispose();
					_picture = null;
				}

				if (_image != null)
				{
					_image.Dispose();
					_image = null;
				}

				if (_textDisplay != null)
				{
					_textDisplay.Dispose();
					_textDisplay = null;
				}

				if (_textFont == null)
				{
					return;
				}

				_textFont.Dispose();
				_textFont = null;
			}
			catch (Exception ex)
			{
				GorgonException.Catch(ex, () => GorgonDialogs.ErrorBox(this, ex));
			}
		}

30. Example

Project: Speed-Test-Loggger
Source File: FormMain.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e)
        {
            // Stop the logg/n ..... /n //View Source file for more details /n }

31. Example

Project: Gmail-Notifier-Plus
Source File: Toast.cs
View license
protected override void OnFormClosing(FormClosingEventArgs e) {
			base.OnFormClosing(e);

			_closeTimer.Tick -= _closeTimer_Tick;

			Timer timer = new Timer() {
				Interval = 50
			};

			timer.Tick += delegate(object sender, EventArgs args) {
				this.Opacity = Math.Max(this.Opacity - 0.1, 0);

				if (this.Opacity == 0) {
					timer.Stop();
					timer.Dispose();
				}
			};

			timer.Start();
		}