I have app with lot of windows and Im just curious is there (in WPF) something like global.asax which was in ASP.NET? I just want to clean some data after somebody shutdown application with alt-f4 for example.
Thanks for answers!
I have app with lot of windows and Im just curious is there (in WPF) something like global.asax which was in ASP.NET? I just want to clean some data after somebody shutdown application with alt-f4 for example.
Thanks for answers!
The rough equivalent of Global.asax
in WPF is app.xaml
/app.xaml.cs
. You can override methods there to handle startup and shutdown.
For example, in your app.xaml.cs
, you can add this:
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
// custom exit code here
}