Link to home
Start Free TrialLog in
Avatar of Parth48
Parth48Flag for India

asked on

What is the use of ApplicationContext Class in C#.net window application ??

What is the use of ApplicationContext Class in C#.net window application ??

can u please tell me step by step so that i can understand ?

can i use it in form (code behind) or i have to use it only in program.cs file ??
Avatar of Asim Nazir
Asim Nazir
Flag of Pakistan image

Application context specifies the contextual information about an application thread.
Details at http://msdn.microsoft.com/en-us/library/system.windows.forms.applicationcontext.aspx
Avatar of Parth48

ASKER

hi @asimnazir123: yes u r right , but what is the meaning of contextual information ??

can u please tell me some practical exam where we can use application context class ??
Avatar of Mike Tomlinson
Put simply, implementing your own ApplicationContext() allows YOU to decide how and when your application closes.

The default WinForms model is tied to the lifetime of the Form passed to Application.Run().  When that form is closed the entire application shuts down.

An ApplicationContext() gives you the ability to keep your application open under whatever circumstances you want.  The entry point becomes the constructor of the class from which you could display a form if you wanted to.   Even if that form is closed your app will continue running because the class still exists and has its own message pump.  When the conditions are right for your particular program, you tell the app to shutdown by calling Application.Exit().
ASKER CERTIFIED SOLUTION
Avatar of Asim Nazir
Asim Nazir
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial