Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to know if a WPF application is shutting down?

Tags:

wpf

I am writing some code that checks that my resources are properly cleaned up.

When the application is shutdown, resources are not cleaned up, which is fine. However, this makes my check code fail.

Is there a way to know if a WPF application is in the process of shutting down? - Something like Application.Current.IsShuttingDown?

like image 650
user380719 Avatar asked Feb 21 '11 20:02

user380719


1 Answers

There is Application.Exit event, you should be able to do with that.

If you really need it to be a property, then create a property into your App class (your class inheriting Windows.Application) and set it to true in with the Application.Exit event.

like image 171
Matěj Zábský Avatar answered Sep 21 '22 15:09

Matěj Zábský