& alarm Fixes
This commit is contained in:
Lucio Maranta
2018-11-21 17:26:58 +01:00
parent 929f8ffa53
commit 0e009dc6ec
7 changed files with 88 additions and 67 deletions
+7 -2
View File
@@ -38,7 +38,7 @@ namespace Step
ServerControlWindow.Start();
// Create unhandled exception handler
// AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandler);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandler);
// Read config
ServerConfigController.ReadStartupConfig();
@@ -117,7 +117,12 @@ namespace Step
private static void ExceptionHandler(object sender, UnhandledExceptionEventArgs args)
{
using (NcHandler ncHandler = new NcHandler())
ncHandler.Disconnect();
{
if (ncHandler.numericalControl.NC_IsConnected())
{
ncHandler.Disconnect();
}
}
LogException((Exception)args.ExceptionObject, ERROR_LEVEL.FATAL);
}