Is it possible in .NET to ascertain whether my application is closing due to Windows being given a shutdown command (as opposed to any old application closing) in order to either write out some temporary cache files or even block the shutdown long enough to prompt for user input?
Whilst my current scope involves a Winform app and a windows service, I am interested in understanding this in a generic way if possible