diff --git a/Application.xaml.vb b/Application.xaml.vb index d320232..ea74b1e 100644 --- a/Application.xaml.vb +++ b/Application.xaml.vb @@ -176,6 +176,7 @@ Class Application Friend Const NEWMACHININGMODEISACTIVE As String = "NewMachiningModeIsActive" Friend Const SIMULATIONEXPANDER_GET_ISEXPANDED As String = "Get_SimulationExpander_IsExpanded" Friend Const SIMULATIONEXPANDER_SET_ISEXPANDED As String = "Set_SimulationExpander_IsExpanded" + Friend Const SIMULATIONEXPANDER_UPDATE_CNCDATA As String = "SimulationExpander_Update_CncData" Friend Const CANCELOPERATIONCOMMAND As String = "CancelOperationCommand" Friend Const UPDATEOPERATIONMACHININGLIST As String = "UpdateOperationMachiningList" diff --git a/MainWindow/MainWindowViewModel.vb b/MainWindow/MainWindowViewModel.vb index e6905a2..a724c0b 100644 --- a/MainWindow/MainWindowViewModel.vb +++ b/MainWindow/MainWindowViewModel.vb @@ -19,8 +19,6 @@ Namespace EgtCAM5 Private m_sDataRoot As String = String.Empty Private m_sConfigDir As String = String.Empty Private m_nDebug As Integer = 0 - Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents) - Private m_OutTextCallback As New OutTextCallback(AddressOf OutText) ' EGALTECH ENVIRONMENT FIELDS WITH PROPERTY @@ -377,10 +375,6 @@ Namespace EgtCAM5 m_MruNewGunStock.Init(S_MRUGUNSTOCKMOD, 8) m_MruModifyGunStock.Init(S_MRUGUNSTOCKPEZ, 8) End If - ' Installo funzione gestione eventi per lua - EgtSetProcessEvents(m_ProcEventsCallback) - ' Installo funzione output testo su status per lua - EgtSetOutText(m_OutTextCallback) ' Info su opzioni chiave EgtOutLog("KeyOptions : " & bKey.ToString() & " " & IniFile.m_nKeyOptions.ToString()) @@ -446,30 +440,6 @@ Namespace EgtCAM5 End If End Sub - Public Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer - ' Se previsto, imposto progress - If nProg > 0 Then - Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSPROGRESS, nProg) - End If - ' Costringo ad aggiornare - Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, New Action(Sub() - End Sub)) - ' Eventuale attesa - Thread.Sleep(nPause) - ' Ritorno eventuale stop - If m_bStopScript Then - m_bStopScript = False - Return 0 - Else - Return 1 - End If - End Function - - Public Function OutText(ByRef psText As IntPtr) As Boolean - Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, Marshal.PtrToStringUni(psText)) - Return True - End Function - #End Region #Region "Events" diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 9bacb35..712491d 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -70,5 +70,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb index 959b4d6..30abea5 100644 --- a/ProjectPage/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb +++ b/ProjectPage/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb @@ -22,7 +22,7 @@ Namespace EgtCAM5 End Enum Private m_nStatus As Integer = SIM_ST.ST_STOP ' Stato bottone Play - Private m_bPlay As Boolean = True + Private m_bShowPlay As Boolean = True ' Coefficiente per valore Slider Private m_SliderX As Double = 1 @@ -313,14 +313,11 @@ Namespace EgtCAM5 Private m_PlayPauseImage As String Public ReadOnly Property PlayPauseImage As String Get - Select Case m_bPlay - Case False - Return "/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Pause.png" - Case True - Return "/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Play.png" - Case Else - Return "" - End Select + If m_bShowPlay Then + Return "/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Play.png" + Else + Return "/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Pause.png" + End If End Get End Property @@ -392,6 +389,11 @@ Namespace EgtCAM5 Application.Msn.Register(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, Sub(bValue As Boolean) IsExpanded = bValue End Sub) + Application.Msn.Register(Application.SIMULATIONEXPANDER_UPDATE_CNCDATA, Sub() + If IsExpanded Then + ShowCncData() + End If + End Sub) End Sub #End Region @@ -416,22 +418,23 @@ Namespace EgtCAM5 ''' Creata the new tool. This method is invoked by the NewCommand. ''' Public Sub StepCmd(ByVal param As Object) - 'm_CurrProjPage.ClearMessage() + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "") ' Se stato stop, devo avviare simulazione If m_nStatus = SIM_ST.ST_STOP Then m_nStatus = SIM_ST.ST_STEP + ' Aggiorno bottone + m_bShowPlay = False + OnPropertyChanged("PlayPauseImage") ExecSim() ' Aggiorno bottone - m_bPlay = True + m_bShowPlay = True OnPropertyChanged("PlayPauseImage") - 'SetPlayPauseBtnToPlay() - ' Alrimenti imposto solo il nuovo stato + ' Alrimenti imposto solo il nuovo stato Else m_nStatus = SIM_ST.ST_STEP ' Aggiornamenti per bottone Play/Pause - m_bPlay = False + m_bShowPlay = False OnPropertyChanged("PlayPauseImage") - 'SetPlayPauseBtnToPause() End If End Sub @@ -455,10 +458,10 @@ Namespace EgtCAM5 ''' Creata the new tool. This method is invoked by the NewCommand. ''' Public Sub PlayPause(ByVal param As Object) - 'm_CurrProjPage.ClearMessage() - If m_bPlay Then + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "") + If m_bShowPlay Then ' Aggiorno bottone - m_bPlay = False + m_bShowPlay = False OnPropertyChanged("PlayPauseImage") ' Eseguo If m_nStatus = SIM_ST.ST_STOP Then @@ -466,18 +469,19 @@ Namespace EgtCAM5 m_nStatus = SIM_ST.ST_PLAY ExecSim() ' Aggiorno bottone - m_bPlay = True + m_bShowPlay = True OnPropertyChanged("PlayPauseImage") ElseIf m_nStatus = SIM_ST.ST_PAUSE Then m_nStatus = SIM_ST.ST_PLAY End If Else ' Aggiorno bottone - m_bPlay = True + m_bShowPlay = True OnPropertyChanged("PlayPauseImage") ' Se play o step, imposto stato pausa If m_nStatus = SIM_ST.ST_PLAY Or m_nStatus = SIM_ST.ST_STEP Then m_nStatus = SIM_ST.ST_PAUSE + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_SIMULATION + 11)) ' Pausa End If End If End Sub @@ -503,7 +507,7 @@ Namespace EgtCAM5 ''' Creata the new tool. This method is invoked by the NewCommand. ''' Public Sub StopCmd(ByVal param As Object) - 'm_CurrProjPage.ClearMessage() + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "") ' Se stato giĆ  stop, porto in home If m_nStatus = SIM_ST.ST_STOP Then ' Vado in home @@ -514,7 +518,12 @@ Namespace EgtCAM5 EgtDraw() ' Aggiorno dati CNC ShowCncData() + Else + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_SIMULATION + 12)) ' Simulazione interrotta End If + ' Aggiorno bottone + m_bShowPlay = True + OnPropertyChanged("PlayPauseImage") ' Imposto il nuovo stato m_nStatus = SIM_ST.ST_STOP End Sub @@ -566,7 +575,7 @@ Namespace EgtCAM5 UpdateUI() ' Imposto stato corrente m_nStatus = SIM_ST.ST_STOP - m_bPlay = True + m_bShowPlay = True m_SliderX = GetPrivateProfileDouble(S_SIMUL, K_SLIDERX, 1) Dim SliderVal As Double = GetPrivateProfileDouble(S_SIMUL, K_SLIDERVAL, 10) SliderValue = SliderVal @@ -579,6 +588,7 @@ Namespace EgtCAM5 End Sub Private Sub CloseSimulation() + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "") ' Mi assicuro di terminare la simulazione ResetSimulation() EgtDraw() @@ -612,19 +622,21 @@ Namespace EgtCAM5 If m_nStatus = SIM_ST.ST_STEP And nMove = MCH_SIM.END_STEP Then ' Imposto stato Pausa m_nStatus = SIM_ST.ST_PAUSE + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_SIMULATION + 11)) ' Pausa ' Aggiornamenti per bottone Play/Pause - m_bPlay = True + m_bShowPlay = True OnPropertyChanged("PlayPauseImage") End If - ' Se movimento non riuscito + ' Se movimento non riuscito Else m_nStatus = SIM_ST.ST_STOP ' Aggiornamenti per bottone Play/Pause - m_bPlay = True + m_bShowPlay = True OnPropertyChanged("PlayPauseImage") Select Case nMove Case MCH_SIM.END_ - 'MsgBox(EgtMsg(MSG_SIMULATION + 1)) 'Simulazione completata + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_SIMULATION + 1)) + ' MessageBox.Show(EgtMsg(MSG_SIMULATION + 1), "", MessageBoxButton.OK) 'Simulazione completata Case MCH_SIM.OUTSTROKE Dim sInfo As String = String.Empty EgtGetOutstrokeInfo(sInfo) diff --git a/StatusBar/StatusBarViewModel.vb b/StatusBar/StatusBarViewModel.vb index 9cab96c..ce1670b 100644 --- a/StatusBar/StatusBarViewModel.vb +++ b/StatusBar/StatusBarViewModel.vb @@ -515,6 +515,8 @@ Namespace EgtCAM5 If nProg > 0 Then StatusProgress = nProg End If + ' Notifico a simulazione aggiornamento dati + Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_UPDATE_CNCDATA) ' Costringo ad aggiornare UpdateUI() ' Eventuale attesa