I have a c# WPF application that needs to save data when it closes. The Window Closing/Closed events work fine if the user closes the program, but they do not get called if the user logs off/shutdown the computer.
I have found ways to catch this event in winforms programs (here, and here). but i cant figure out how to achieve this in a WPF application.
I'm trying to halt the shutdown until my program is ready to exit