Imports EgtUILib Namespace EgtCAM5 Public Class DrawOptionPanelViewModel Inherits ViewModelBase Private m_DrawIsChecked As Boolean Public Property DrawIsChecked As Boolean Get Return m_DrawIsChecked End Get Set(value As Boolean) If value <> m_DrawIsChecked Then m_DrawIsChecked = value If value Then Application.Msn.NotifyColleagues(Application.PROJECTPAGE_DRAWMODE) EgtResetCurrMachGroup() EgtZoom(ZM.ALL) End If OnPropertyChanged("ManageLayerExpander") OnPropertyChanged("InfoExpander") OnPropertyChanged("InputExpander") End If End Set End Property Private m_WorkIsChecked As Boolean Public Property WorkIsChecked As Boolean Get Return m_WorkIsChecked End Get Set(value As Boolean) If value <> m_WorkIsChecked Then m_WorkIsChecked = value If value Then Application.Msn.NotifyColleagues(Application.PROJECTPAGE_MACHININGMODE) Dim nId = EgtGetFirstMachGroup() If nId <> GDB_ID.NULL Then EgtSetCurrMachGroup(nId) Else EgtAddMachGroup("Mach01", "CMS-PF122R8RR") End If EgtZoom(ZM.ALL) Else ' Deevidenzio l'ultima operazione evidenziata Application.Msn.NotifyColleagues(Application.REMOVEMARKFROMLASTOPERATION) End If OnPropertyChanged("ManageLayerExpander") OnPropertyChanged("InfoExpander") OnPropertyChanged("InputExpander") End If End Set End Property ' GRAPHICAL ELEMENTS Private m_OperationExpander As OperationExpanderView Private m_ManageLayerExpander As ManageLayerExpanderView Public ReadOnly Property ManageLayerExpander As ContentControl Get If m_DrawIsChecked Then If IsNothing(m_ManageLayerExpander) Then m_ManageLayerExpander = New ManageLayerExpanderView m_ManageLayerExpander.DataContext = New ManageLayerExpanderViewModel End If Return m_ManageLayerExpander Else If IsNothing(m_OperationExpander) Then m_OperationExpander = New OperationExpanderView m_OperationExpander.DataContext = New OperationExpanderViewModel End If Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST) Return m_OperationExpander End If End Get End Property Private m_MachiningsTreeExpander As MachiningTreeExpanderView Private m_InfoExpander As InfoExpanderView Public ReadOnly Property InfoExpander As ContentControl Get If m_DrawIsChecked Then If IsNothing(m_InfoExpander) Then m_InfoExpander = New InfoExpanderView m_InfoExpander.DataContext = New InfoExpanderViewModel End If Return m_InfoExpander Else If IsNothing(m_MachiningsTreeExpander) Then m_MachiningsTreeExpander = New MachiningTreeExpanderView m_MachiningsTreeExpander.DataContext = New MachiningTreeExpanderViewModel End If Return m_MachiningsTreeExpander End If End Get End Property Private m_SimulationExpander As SimulationExpanderView Private m_InputExpander As InputExpanderView Public ReadOnly Property InputExpander As ContentControl Get If m_DrawIsChecked Then If IsNothing(m_InputExpander) Then m_InputExpander = New InputExpanderView m_InputExpander.DataContext = New InputExpanderViewModel End If Return m_InputExpander Else If IsNothing(m_SimulationExpander) Then m_SimulationExpander = New SimulationExpanderView m_SimulationExpander.DataContext = New SimulationExpanderViewModel End If Return m_SimulationExpander End If End Get End Property Sub New() ' Inizializzo la selezione della modilità Draw all'apertura del programma DrawIsChecked = True Application.Msn.Register(Application.MACHININGISCHECKED, Sub() WorkIsChecked = True OnPropertyChanged("WorkIsChecked") End Sub) End Sub End Class End Namespace