Files
EgtCAM5/ProjectPage/OptionPanel/DrawOptionPanel/DrawOptionPanelViewModel.vb
T
Emmanuele Sassi f8b17066de EgtCAM5 :
- Migliorie varie.
2016-07-10 11:34:07 +00:00

175 lines
6.3 KiB
VB.net

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")
OnPropertyChanged("SimulationExpander")
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)
End If
OnPropertyChanged("ManageLayerExpander")
OnPropertyChanged("InfoExpander")
OnPropertyChanged("InputExpander")
OnPropertyChanged("SimulationExpander")
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_OperationPropertyExpander As OperationPropertyExpanderView
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_OperationPropertyExpander) Then
m_OperationPropertyExpander = New OperationPropertyExpanderView
m_OperationPropertyExpander.DataContext = New OperationPropertyExpanderViewModel
End If
Return m_OperationPropertyExpander
End If
End Get
End Property
Private m_MachiningsTreeExpander As MachiningTreeExpanderView
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_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
Public ReadOnly Property SimulationExpander As ContentControl
Get
If m_DrawIsChecked Then
Return Nothing
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
' Definizione comandi
Private m_cmdClosing As ICommand
Sub New()
' Inizializzo la selezione della modilità Draw all'apertura del programma
DrawIsChecked = True
End Sub
#Region "COMMANDS"
#Region "ClosingCommand"
''' <summary>
''' Returns a command that create a new tool.
''' </summary>
Public ReadOnly Property ClosingCommand As ICommand
Get
If m_cmdClosing Is Nothing Then
m_cmdClosing = New RelayCommand(AddressOf Closing, AddressOf CanClosing)
End If
Return m_cmdClosing
End Get
End Property
''' <summary>
''' Creata the new tool. This method is invoked by the NewCommand.
''' </summary>
Public Sub Closing(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.DRAWOPTIONPANEL_CLOSING)
End Sub
''' <summary>
''' Returns true if the selected treeviewitem is valid for new tool creation.
''' </summary>
Private Function CanClosing(ByVal param As Object) As Boolean
Return True
End Function
#End Region ' ClosingCommand
#End Region ' Commands
End Class
End Namespace