Imports EgtUILib Public Class MachineCNPageUC ' Riferimento alla MainWindow Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow) Friend m_CN As CN_generico Private m_bFirst As Boolean = True Private Sub TestingPage_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized StartBtn.Content = EgtMsg(MSG_MACHINECNPAGEUC + 1) StopBtn.Content = EgtMsg(MSG_MACHINECNPAGEUC + 2) ResetBtn.Content = EgtMsg(MSG_MACHINECNPAGEUC + 3) AutoBtn.Content = EgtMsg(MSG_MACHINECNPAGEUC + 4) SingleBtn.Content = EgtMsg(MSG_MACHINECNPAGEUC + 5) MDIBtn.Content = EgtMsg(MSG_MACHINECNPAGEUC + 6) ManualBtn.Content = EgtMsg(MSG_MACHINECNPAGEUC + 7) HomeBtn.Content = EgtMsg(MSG_MACHINECNPAGEUC + 8) DownloadBtn.Content = EgtMsg(MSG_MACHINECNPAGEUC + 9) UploadBtn.Content = EgtMsg(MSG_MACHINECNPAGEUC + 10) ActivateBtn.Content = EgtMsg(MSG_MACHINECNPAGEUC + 11) DeleteBtn.Content = EgtMsg(MSG_MACHINECNPAGEUC + 12) MDIConfirmBtn.Content = EgtMsg(MSG_MACHINECNPAGEUC + 13) CNModeGpBx.Header = EgtMsg(MSG_MACHINECNPAGEUC + 14) CommandsGpBx.Header = EgtMsg(MSG_MACHINECNPAGEUC + 15) MDICommandGpBx.Header = EgtMsg(MSG_MACHINECNPAGEUC + 16) PartProgTransferGpBx.Header = EgtMsg(MSG_MACHINECNPAGEUC + 17) ErrorLstGpBx.Header = EgtMsg(MSG_ALARMSPAGEUC + 12) ' Attivo gruppo PartProgTransferGpBx leggendo la variabile nel file ini If GetPrivateProfileInt(S_GENERAL, K_TESTINGPAGE, 0, m_MainWindow.GetIniFile()) = 1 Then PartProgTransferGpBx.Visibility = Windows.Visibility.Visible Else PartProgTransferGpBx.Visibility = Windows.Visibility.Hidden End If End Sub Private Sub TestingPage_Loaded(sender As Object, e As RoutedEventArgs) 'If m_bFirst Then ' m_bFirst = False 'End If End Sub Private Sub StartBtn_Click(sender As Object, e As RoutedEventArgs) Handles StartBtn.Click m_CN.DGeneralFunctions_CycleStart() End Sub Private Sub StopBtn_Click(sender As Object, e As RoutedEventArgs) Handles StopBtn.Click m_CN.DGeneralFunctions_FeedHold() End Sub Private Sub ResetBtn_Click(sender As Object, ghe As RoutedEventArgs) Handles ResetBtn.Click Call m_CN.DGeneralFunctions_Reset() End Sub Private Sub AutoBtn_Click(sender As Object, e As RoutedEventArgs) Handles AutoBtn.Click m_CN.DGeneralFunctions_WriteCncMode(0) End Sub Private Sub SingleBtn_Click(sender As Object, e As RoutedEventArgs) Handles SingleBtn.Click m_CN.DGeneralFunctions_WriteCncMode(1) End Sub Private Sub MDIBtn_Click(sender As Object, e As RoutedEventArgs) Handles MDIBtn.Click m_CN.DGeneralFunctions_WriteCncMode(2) End Sub Private Sub ManualBtn_Click(sender As Object, e As RoutedEventArgs) Handles ManualBtn.Click m_CN.DGeneralFunctions_WriteCncMode(7) End Sub Private Sub HomeBtn_Click(sender As Object, e As RoutedEventArgs) Handles HomeBtn.Click m_CN.DGeneralFunctions_WriteCncMode(8) End Sub Private Sub MDITxBx_KeyDown(sender As Object, e As KeyEventArgs) Handles MDITxBx.KeyDown If e.Key = Key.Return Then m_CN.sz_ManualDataInput = MDITxBx.Text m_CN.MDI_command() MDITxBx.Background = Brushes.LightGray 'Keyboard.ClearFocus() End If End Sub Private Sub MDITxBx_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs) Handles MDITxBx.PreviewMouseDown MDITxBx.Background = Brushes.White End Sub Friend Sub DownloadBtn_Click(sender As Object, e As RoutedEventArgs) Handles DownloadBtn.Click If m_MainWindow.m_CNCommunication.m_nNCType = 1 Then m_CN.Delete_NC_prog(DULoadTxBx.Text) End If Dim DownloadName As String = String.Empty If m_MainWindow.m_CNCommunication.m_nNCType = 1 Or m_MainWindow.m_CNCommunication.m_nNCType = 2 Then DownloadName = "%" & DULoadTxBx.Text Else DownloadName = DULoadTxBx.Text End If Dim sPcFile As String = m_MainWindow.GetCncDir() & "\" & DULoadTxBx.Text & m_MainWindow.m_CurrentMachine.sIsoFileExt m_CN.Download_NC_prog(sPcFile, DownloadName) End Sub Private Sub UploadBtn_Click(sender As Object, e As RoutedEventArgs) Handles UploadBtn.Click Dim DownloadName As String = String.Empty If m_MainWindow.m_CNCommunication.m_nNCType = 1 Or m_MainWindow.m_CNCommunication.m_nNCType = 2 Then DownloadName = "%" & DULoadTxBx.Text Else DownloadName = DULoadTxBx.Text End If Dim sPcFile As String = m_MainWindow.GetCncDir() & "\" & DULoadTxBx.Text & m_MainWindow.m_CurrentMachine.sIsoFileExt m_CN.Upload_NC_prog(sPcFile, DownloadName) End Sub Private Sub ActivateBtn_Click(sender As Object, e As RoutedEventArgs) Handles ActivateBtn.Click If m_MainWindow.m_CNCommunication.m_nNCType = 1 Or m_MainWindow.m_CNCommunication.m_nNCType = 2 Then Dim nName As Integer = 0 StringToInt(DULoadTxBx.Text, nName) m_CN.ActivateProgram(nName) ' integer version Else m_CN.ActivateProgram(DULoadTxBx.Text) ' string version End If End Sub Private Sub DeleteBtn_Click(sender As Object, e As RoutedEventArgs) Handles DeleteBtn.Click Dim DeleteName As String = String.Empty If m_MainWindow.m_CNCommunication.m_nNCType = 1 Or m_MainWindow.m_CNCommunication.m_nNCType = 2 Then DeleteName = "%" & DULoadTxBx.Text Else DeleteName = DULoadTxBx.Text End If m_CN.Delete_NC_prog(DeleteName) End Sub Private Sub MDIConfirmBtn_Click(sender As Object, e As RoutedEventArgs) Handles MDIConfirmBtn.Click m_CN.sz_ManualDataInput = MDITxBx.Text m_CN.MDI_command() MDITxBx.Background = Brushes.LightGray End Sub End Class