DekGenius.com
[ Team LiB ] Previous Section Next Section

ApplicationContext

System.Windows.Forms (system.windows.forms.dll)class

Normally, you call Application.Run(), passing in the Form you wish to use as the MainForm of the application. An alternative is to use this class, which then allows you to control several features, including starting the message loop (again, optionally with a MainForm), stopping the message loop, and handling ThreadExit events related to the application terminating. You can also override the OnMainFormClosed() method to determine whether the message pump is terminated when the main form is closed.

public class ApplicationContext {
// Public Constructors
   public ApplicationContext();
   public ApplicationContext(Form mainForm);
// Public Instance Properties
   public Form MainForm{set; get; }
// Public Instance Methods
   public void Dispose();
   public void ExitThread();
// Protected Instance Methods
   protected virtual void Dispose(bool disposing);
   protected virtual void ExitThreadCore();
   protected override void Finalize();  // overrides object
   protected virtual void OnMainFormClosed(object sender, EventArgs e);
// Events
   public event EventHandler ThreadExit;
}

Passed To

Application.Run()

    [ Team LiB ] Previous Section Next Section