private static void currentDomain_ThreadException(object sender, ThreadExceptionEventArgs t)
{
System.Runtime.InteropServices.COMException comEx = t.Exception as System.Runtime.InteropServices.COMException;
if (comEx != null)
{
// RPC server fault.
if (comEx.ErrorCode == -2147417851 || comEx.ErrorCode == -2147023174)
{
// Connection
HandleConnectionLost();
return;
}
}
formErrorMessage dialog = new formErrorMessage(t);
dialog.ShowDialog();
Instances.MainForm.Repaint();
}