I have one server Called GameServer and its continusly run. and more then one ClientApplication is running on different different machine.
While user Login to the Server I am saving some data to server on base of logged in user, and after logout i am doing some changes to the database and also the instance which i made to the server for the logged in user.
But some how if user machine forcefully shut-Down or somethings really bad happent to the Client Application then user force fully close the client application.
So at that time i want to handel one even in whihc i can call Game Server and do may changes to the Server.
how to know the application is shutting down
The above link i see but it will use for mormally close the event.
you have to handle Application_DispatcherUnhandledException when application crashed and 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 as Exception;
if(ExceptionView != null)
ExceptionView.ErrorLoger(ex);
}
and at App.XAML use Application_DispatcherUnhandledException handler.
like:- DispatcherUnhandledException="Application_DispatcherUnhandledException"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With