I have a Winforms app and usually when a user runs an app the UI of the app visible only, but if you set in settings open as Console app
, as a result, each time when the app will be opened the terminal will be opened as well (BTW I need this option to be enabled in my case).
Problem is that I have a logic in Closing
form event and it works well if a user closes the app by clicking on the cross at the top of the app window, but if they close the app by click cross on the terminal window the app doesn't get any closing events. It just terminates the app process.
So, the question is - is there a way to catch the closing event if the user tries to close the app through the closing terminal instead of closing the app?