本文整理汇总了C#中ApplicationContext.ExitThread方法的典型用法代码示例。如果您正苦于以下问题:C# ApplicationContext.ExitThread方法的具体用法?C# ApplicationContext.ExitThread怎么用?C# ApplicationContext.ExitThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApplicationContext
的用法示例。
在下文中一共展示了ApplicationContext.ExitThread方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Context_ExitThread_NoForm
static void Context_ExitThread_NoForm ()
{
Console.WriteLine ("Context_ExitThread_NoForm");
Console.WriteLine ("*******************************");
Application.ApplicationExit += application_applicationexit;
Application.ThreadExit += application_threadexit;
ApplicationContext ctx = new ApplicationContext ();
ctx.ThreadExit += applicationcontext_threadexit;
Timer t = new Timer ();
t.Tick += delegate (object sender, EventArgs e) { ctx.ExitThread (); };
t.Enabled = true;
Application.Run (ctx);
Application.ApplicationExit -= application_applicationexit;
Application.ThreadExit -= application_threadexit;
}
示例2: Context_ExitThread_Form
static void Context_ExitThread_Form ()
{
Console.WriteLine ("Context_ExitThread_Form");
Console.WriteLine ("*******************************");
Application.ApplicationExit += application_applicationexit;
Application.ThreadExit += application_threadexit;
Form f = new Form ();
f.HandleDestroyed += form_handle_destroyed;
f.Closed += form_closed;
ApplicationContext ctx = new ApplicationContext (f);
ctx.ThreadExit += applicationcontext_threadexit;
Timer t = new Timer ();
t.Tick += delegate (object sender, EventArgs e) { ctx.ExitThread (); };
t.Enabled = true;
Application.Run (ctx);
Application.ApplicationExit -= application_applicationexit;
Application.ThreadExit -= application_threadexit;
}