From 40ecf5f400a032d7d30952547fda55a1352a1c70 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 10 Jul 2018 09:13:48 +0000 Subject: [PATCH] OmagCUT : - migliorata gestione errori in tastatura lama. --- AlarmsPageUC.xaml | 5 ++--- AlarmsPageUC.xaml.vb | 42 +++++++++++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/AlarmsPageUC.xaml b/AlarmsPageUC.xaml index 5e14fc5..20bcb5f 100644 --- a/AlarmsPageUC.xaml +++ b/AlarmsPageUC.xaml @@ -356,9 +356,8 @@ - - diff --git a/AlarmsPageUC.xaml.vb b/AlarmsPageUC.xaml.vb index 0ce2ae4..37338ff 100644 --- a/AlarmsPageUC.xaml.vb +++ b/AlarmsPageUC.xaml.vb @@ -614,8 +614,17 @@ Public Class AlarmsPageUC ' Leggo variabili Dim CmdString As String = String.Empty EgtLuaGetGlobStringVar("CMD.CMDSTRING", CmdString) + Dim nErr As Integer = 0 + EgtLuaGetGlobIntVar("CMD.ERR", nErr) ' Reset lua EgtLuaResetGlobVar("CMD") + ' Verifico condizioni di errore + If nErr <> 0 Or String.IsNullOrWhiteSpace(CmdString) Then + ' Errore in tastatura lama + Dim MsgBoxError As New EgtMsgBox(m_MainWindow, "", EgtMsg(MSG_DIRECTCUTPAGEUC + 44), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.NULL) + EgtOutLog("ToolProbing Command error") + Return + End If ' Modifico stringa per inserire i newline CmdString = CmdString.Replace("
", Environment.NewLine) ' Creo file... @@ -625,11 +634,18 @@ Public Class AlarmsPageUC Writer.Write(CmdString) Writer.Close() ' Verifico se sono connesso alla macchina prima di continuare - If Not m_MainWindow.m_bNCLink Then Return + If Not m_MainWindow.m_bNCLink Then + EgtOutLog("ToolProbing NcLink error") + Return + End If ' Mando file al CN - If Not m_MainWindow.m_CNCommunication.SendProgram(FilePath, 900) Then Return + If Not m_MainWindow.m_CNCommunication.SendProgram(FilePath, 900) Then + ' Errore in tastatura lama + Dim MsgBoxError As New EgtMsgBox(m_MainWindow, "", EgtMsg(MSG_DIRECTCUTPAGEUC + 44), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.NULL) + EgtOutLog("ToolProbing Send error") + Return + End If m_MainWindow.m_CurrentProjectPageUC.ClearMessage() - EgtOutLog("ToolProbing : sent NC program") ' Aspetto e lo avvio System.Threading.Thread.Sleep(300) m_MainWindow.m_CNCommunication.m_CN.DGeneralFunctions_CycleStart() @@ -666,8 +682,13 @@ Public Class AlarmsPageUC UpdateUI() ' Verifico se interrotto dall'utente If MsgBoxStateInfo.m_nPressedBtn = 0 Then - bProbingOk = False - Exit For + MsgBoxStateInfo.Close() + UpdateUI() + System.Threading.Thread.Sleep(100) + EgtOutLog("ToolProbing canceled by user") + ' Tastatura interrotta dall'utente + Dim MsgBoxError As New EgtMsgBox(m_MainWindow, "", EgtMsg(MSG_DIRECTCUTPAGEUC + 46), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.NULL) + Return End If Next ' Se tastatura riuscita @@ -722,13 +743,12 @@ Public Class AlarmsPageUC End If ' Se tastatura non riuscita If Not bProbingOk Then - MsgBoxStateInfo.Text = EgtMsg(MSG_DIRECTCUTPAGEUC + 44) ' Errore in tastatura lama - m_MainWindow.m_CurrentProjectPageUC.SetErrorMessage(EgtMsg(MSG_DIRECTCUTPAGEUC + 44)) - EgtOutLog("ToolProbing error") - ' Costringo ad aggiornare UI - UpdateUI() - System.Threading.Thread.Sleep(3000) MsgBoxStateInfo.Close() + UpdateUI() + System.Threading.Thread.Sleep(100) + EgtOutLog("ToolProbing error") + ' Errore in tastatura lama + Dim MsgBoxError As New EgtMsgBox(m_MainWindow, "", EgtMsg(MSG_DIRECTCUTPAGEUC + 44), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.NULL) End If End Sub