Files
EgtCAM5/ProjectPage/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderViewModel.vb
T
Emmanuele Sassi 26c118a96f EgtCAM5 :
- Migliorie varie.
2016-07-08 15:36:20 +00:00

192 lines
6.2 KiB
VB.net

Imports System.Collections.ObjectModel
Imports EgtUILib
Namespace EgtCAM5
Public Class ManageLayerExpanderViewModel
#Region "Fields & Properties"
' Definizione comandi
Private m_cmdNewPart As ICommand
Private m_cmdNewLayer As ICommand
Private m_cmdLayerColor As ICommand
' Lista dei layer
Private m_LayerList As New ObservableCollection(Of LayerTreeViewItem)
Public Property LayerList As ObservableCollection(Of LayerTreeViewItem)
Get
Return m_LayerList
End Get
Set(value As ObservableCollection(Of LayerTreeViewItem))
m_LayerList = value
End Set
End Property
#End Region
#Region "COMMANDS"
#Region "NewPartCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property NewPartCommand As ICommand
Get
If m_cmdNewPart Is Nothing Then
m_cmdNewPart = New RelayCommand(AddressOf NewPart, AddressOf CanNewPart)
End If
Return m_cmdNewPart
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub NewPart(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.NEWPART)
End Sub
''' <summary>
''' Returns always true.
''' </summary>
Private Function CanNewPart(ByVal param As Object) As Boolean
Return True
End Function
#End Region ' NewPartCommand
#Region "NewLayerCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property NewLayerCommand As ICommand
Get
If m_cmdNewLayer Is Nothing Then
m_cmdNewLayer = New RelayCommand(AddressOf NewLayer, AddressOf CanNewLayer)
End If
Return m_cmdNewLayer
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub NewLayer(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.NEWLAYER)
End Sub
''' <summary>
''' Returns always true.
''' </summary>
Private Function CanNewLayer(ByVal param As Object) As Boolean
Return True
End Function
#End Region ' NewLayerCommand
#Region "LayerColorCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property LayerColorCommand As ICommand
Get
If m_cmdLayerColor Is Nothing Then
m_cmdLayerColor = New RelayCommand(AddressOf LayerColor, AddressOf CanLayerColor)
End If
Return m_cmdLayerColor
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub LayerColor(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.LAYERCOLOR)
End Sub
''' <summary>
''' Returns always true.
''' </summary>
Private Function CanLayerColor(ByVal param As Object) As Boolean
Return True
End Function
#End Region ' NewLayerCommand
#End Region ' Commands
#Region "Methods"
'Public Sub LoadLayerTree()
' 'Dim nOldId As Integer = ClearObjTree()
' AddGroupInObjTree(GDB_ID.ROOT, GDB_LV.USER, 0, TreeView1.Nodes)
' If nOldId <> GDB_ID.NULL Then
' SelectIdInObjTree(nOldId)
' UpdateObjDataInObjTree(m_nObjTreeOldId)
' Else
' tBoxInfo.Text = String.Empty
' End If
'End Sub
'Private Sub AddGroupInObjTree(ByVal nGroupId As Integer, ByVal nLevel As Integer, ByVal nDepth As Integer, ByRef PrevNodColl As TreeNodeCollection)
' Dim CurrNodColl As TreeNodeCollection
' If nGroupId = GDB_ID.ROOT Then
' CurrNodColl = PrevNodColl
' Else
' ' livello
' Dim nObjLev As Integer = GDB_LV.USER
' EgtGetLevel(nGroupId, nObjLev)
' If nObjLev = GDB_LV.TEMP Then
' nLevel = GDB_LV.TEMP
' ElseIf nLevel = GDB_LV.USER Then
' nLevel = nObjLev
' End If
' ' tipo
' Dim nGroupType As Integer = 0 ' 0=gruppo generico, 1=pezzo, 2=layer
' If nLevel = GDB_LV.USER Then
' nGroupType = nDepth
' End If
' ' nome
' Dim sName As String = String.Empty
' Dim sText As String = String.Empty
' If EgtGetName(nGroupId, sName) Then
' If nGroupType = 1 Then
' sText = sName + " (Part " + nGroupId.ToString + ")"
' ElseIf nGroupType = 2 Then
' sText = sName + " (Layer " + nGroupId.ToString + ")"
' Else
' sText = sName + " (Group " + nGroupId.ToString + ")"
' End If
' Else
' If nGroupType = 1 Then
' sText = "Part " + nGroupId.ToString
' ElseIf nGroupType = 2 Then
' sText = "Layer " + nGroupId.ToString
' Else
' sText = "Group " + nGroupId.ToString
' End If
' End If
' ' per visualizzare oggetti di livello diverso da utente, si deve avere il permesso
' If nLevel <> GDB_LV.USER And GetUserLevel() < 5 Then
' Return
' End If
' ' inserisco il nodo nell'albero
' Dim nImage As Integer = TypeToImageInObjTree(GDB_TY.GROUP, nGroupType)
' Dim CurrNod As TreeNode = PrevNodColl.Add(nGroupId.ToString(), sText, nImage, nImage)
' CurrNodColl = CurrNod.Nodes
' Dim nStat As GDB_ST = GDB_ST.ON_
' EgtGetStatus(nGroupId, nStat)
' CurrNod.Checked = (nStat <> GDB_ST.OFF)
' End If
#End Region
End Class
End Namespace