System.Windows.Forms.ApplicationContext.ExitThread()

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

22 Examples 7

1. Example

Project: tcp-moe
Source File: Worker.cs
View license
public void Shutdown()
        {
            running = false;

            /**
             * Disconnect from the server gracefully.
             */
            client.Disconnect();

            /**
             * Terminate the main thread.
             */
            context.ExitThread();
        }

2. Example

Project: Eddie
Source File: Program.cs
View license
private static void Engine_TerminateEvent()
        {
            m_context.ExitThread();

            //Application.Exit(); // Removed in 2.12, otherwise lock Core thread. Still required in Linux edition.
        }

3. Example

Project: Gwupe
Source File: GwupeClientAppContext.cs
View license
public void Shutdown()
        {
            ExitThread();
        }

4. Example

Project: GEDKeeper
Source File: WinFormsAppHost.cs
View license
public override void CloseWindow(IWindow window)
        {
            base.CloseWindow(window);

            if (fRunningForms.Count == 0) {
                fAppContext.ExitThread();
            }
        }

5. Example

Project: DeOps
Source File: AppContext.cs
View license
private void CheckExit()
        {
            // if context running inside a simulator dont exit thread
            if (Context.Sim != null)
                return;

            if (Logins.Count == 0 && Context.Cores.SafeCount == 0)
            {
                if (Context.Sim == null) // context not running inside a simulation
                {
                    Settings.Save();
                    Context.Dispose();

                    if (Simulator == null) // simulation interface closed
                        ExitThread();
                }
                else
                    Context.Sim.Internet.ExitInstance(Context.Sim);
            }
        }

6. Example

View license
private void OnExitClick(object sender, EventArgs e)
        {
            app.ExitThread();
        }

7. Example

Project: Eddie
Source File: Program.cs
View license
private static void Engine_TerminateEvent()
        {
            m_context.ExitThread();

            Application.Exit();
        }

8. Example

View license
private void form_Closed(object sender, EventArgs e)
        {
            try
            {
                // safely ensure form is disposed
                try { _form.Dispose(); }
                catch { }
            }
            catch (Exception ex)
            {
                _exception = ex;
            }
            finally
            {
                ExitThread();
            }
        }

9. Example

Project: QuasarRAT
Source File: Program.cs
View license
private static void Cleanup()
        {
            CommandHandler.CloseShell();
            if (CommandHandler.StreamCodec != null)
                CommandHandler.StreamCodec.Dispose();
            if (Keylogger.Instance != null)
                Keylogger.Instance.Dispose();
            if (_msgLoop != null)
            {
                _msgLoop.ExitThread();
                _msgLoop.Dispose();
                _msgLoop = null;
            }
            MutexHelper.CloseMutex();
        }

10. Example

Project: Gorgon
Source File: AppContext.cs
View license
protected override void OnMainFormClosed(object sender, EventArgs e)
		{
			base.OnMainFormClosed(sender, e);
			ExitThread();
		}

11. Example

Project: Gorgon
Source File: Context.cs
View license
protected override void OnMainFormClosed(object sender, EventArgs e)
		{
			base.OnMainFormClosed(sender, e);
			ExitThread();
		}

12. Example

Project: Gorgon
Source File: AppContext.cs
View license
protected override void OnMainFormClosed(object sender, EventArgs e)
		{
			base.OnMainFormClosed(sender, e);
			ExitThread();
		}

13. Example

View license
public void Stop()
        {
            if (context == null)
                return;

            context.ExitThread();
            context.Dispose();
            context = null;
        }

14. Example

View license
protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // free managed resources
                if (context != null)
                {
                    context.ExitThread();
                    context.Dispose();
                    context = null;
                }

            }
        }

15. Example

View license
public void Stop()
        {
            if (context == null)
                return;

            context.ExitThread();
            context.Dispose();
            context = null;
        }

16. Example

View license
protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // free managed resources
                if (context != null)
                {
                    context.ExitThread();
                    context.Dispose();
                    context = null;
                }
            }
        }

17. Example

View license
private void ExitCommand(object sender, EventArgs e)
        {
            Disconnect();
            ExitThread();
        }

18. Example

Project: Aurora
Source File: MessagePumpThread.cs
View license
public void Dispose()
		{
			if (!disposed)
			{
				disposed = true;
				if (applicationContext != null)
				{
					applicationContext.ExitThread();
					thread.Join(TimeSpan.Zero);
					applicationContext.Dispose();
				}
			}
		}

19. Example

Project: mwinapi
Source File: MainForm.cs
View license
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e != null && e.CloseReason == CloseReason.UserClosing)
            {
                e.Cancel = true;
                Hide();
                return;
            }
            SetHotkeysEnabled(false);
            ac.ExitThread();
        }

20. Example

View license
private void OnUiClosed(object sender, EventArgs e)
        {
            DisableCursorIndicator();
            DisableButtonIndicator();
            ExitThread();
        }

21. Example

Project: Saraff.Twain.NET
Source File: Twain32.cs
View license
private bool _DisableDataSource() {
            if((this._TwainState&TwainStateFlag.DSEnabled)!=0) {
                try {
                    TwUserInterface _guif=new TwUserInterface() {
                        ParentHand=this._hwnd,
                        ShowUI=false
                    };
                    for(TwRC _rc=this._dsmEntry.DsInvoke(this._AppId,this._srcds,TwDG.Control,TwDAT.UserInterface,TwMSG.DisableDS,ref _guif); _rc!=TwRC.Success; ) {
                        throw new TwainException(this._GetTwainStatus(),_rc);
                    }
                } finally {
                    this._TwainState&=~TwainStateFlag.DSEnabled;
                    if(this._context!=null) {
                        this._context.ExitThread();
                        this._context.Dispose();
                        this._context=null;
                    }
                }
                return (this._TwainState&TwainStateFlag.DSEnabled)==0;
            }
            return false;
        }

22. Example

Project: poderosa
Source File: WindowManager.cs
View license
private void WindowClosedHandler(object sender, FormClosedEventArgs arg) {
            MainWindow w = (MainWindow)sender;
            if (!_executingAllWindowClose) { //???????????????????
                _preferences.WindowArray.Clear();
                _preferences.FormatWindowPreference(w);
            }
            _windows.Remove(w);
            NotifyMainWindowUnloaded(w);
            if (_windows.Count == 0 && GetStartMode() == StartMode.StandAlone) {
                CloseAllPopupWindows();
                _appContext.ExitThread();
            }
        }