Handle the WPF Close event if WPF application Shut down Forcefully or Crashed -
i have 1 server called gameserver , continusly run. , more 1 clientapplication running on different different machine.
while user login server saving data server on base of logged in user, , after logout doing changes database , instance made server logged in user.
but how if user machine forcefully shut-down or somethings bad happent client application user force close client application.
so @ time want handel 1 in whihc can call game server , may changes server.
how know application shutting down
the above link see use mormally close event.
you have handle application_dispatcherunhandledexception when application crashed , currentdomain_unhandledexception when unhandled occured.
private void application_dispatcherunhandledexception(object sender,dispatcherunhandledexceptioneventargs e) { if(exceptionview != null) exceptionview.errorloger(e.exception); e.handled = true; } void currentdomain_unhandledexception(object sender, unhandledexceptioneventargs e) { var ex = e.exceptionobject exception; if(exceptionview != null) exceptionview.errorloger(ex); }
and @ app.xaml use application_dispatcherunhandledexception handler.
like:- dispatcherunhandledexception="application_dispatcherunhandledexception"
Comments
Post a Comment