1

If I close my app with the back-button, the event Application_Closing is raised and the code is executing.

When I close my app in the list with active apps, no event is raised...

I really need an event for this.

Does anyone know a solution?

Wosi
  • 41,986
  • 17
  • 75
  • 82
ceuben
  • 319
  • 1
  • 4
  • 17

1 Answers1

0

There is no event to detect when your app is terminating from the app list. When your app goes to background it will be tombstoned.

You can react on this with the Application_Deactivated event. So you should handle both events Application_Deactivated and Application_Closing.

Learn more about the app's lifecycle here.

Wosi
  • 41,986
  • 17
  • 75
  • 82
  • The "problem" is that I want to "log out" when the app closes. With the Deactived-event, the app will log out several times when the app goes to the background... – ceuben Oct 30 '15 at 16:49
  • I understand what you want to do but you can't actually do it. When the app is about to be closed by dopping it from the app list it's the same like you kill a process via Windows' Taskmanager on a desktop system. You can't react on it. There are two choices: 1. Log out on deactivation of your app or 2. stay logged in when the app is being killed. – Wosi Oct 30 '15 at 16:53
  • Yeah, that was my plan B :-) – ceuben Oct 30 '15 at 18:36