5b647b0cde
- Aggiunta comunicazione con il Flexium e classe astratta da cui eredita anche comunicazione Axium.
486 lines
20 KiB
VB.net
486 lines
20 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports OmagCUT.TreeViewItem
|
|
Imports System.ComponentModel
|
|
Imports EgtUILib
|
|
|
|
|
|
Public Class ToolsDbPageUC
|
|
|
|
' Riferimento alla MainWindow
|
|
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
|
|
|
' Lista degli utensili
|
|
Dim ToolsList As New ObservableCollection(Of CathegoryItem)
|
|
' Proprietà
|
|
Private m_bFirst As Boolean = True
|
|
Private m_Annulla As Boolean = False
|
|
|
|
'Variabile che conserva l'utensile precedentemente selezionato usata nel caso si selezioni annulla quando si cambia utensile selezionato
|
|
Private m_OldItem As Object
|
|
|
|
' Dichiarazione Scene
|
|
Friend WithEvents ToolScene As New Scene
|
|
Dim ToolSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
|
|
|
|
Private Sub ToolsDbPage_Initialized(sender As Object, e As EventArgs)
|
|
|
|
'Assegnazione scena all'host e posizionamento nella ToolsDbPageGrid
|
|
ToolSceneHost.Child = ToolScene
|
|
ToolSceneHost.SetValue(Grid.ColumnProperty, 2)
|
|
ToolSceneHost.SetValue(Grid.RowProperty, 0)
|
|
Me.ToolsDbPageGrid.Children.Add(ToolSceneHost)
|
|
|
|
' Assegno la lista degli utensili come sorgente del treeview
|
|
ToolTreeView.ItemsSource = ToolsList
|
|
|
|
'Imposto i messaggi letti dal file dei messaggi
|
|
NameTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 1)
|
|
TCPosTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 2)
|
|
MaxMatTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 3)
|
|
LonOffsetTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 4)
|
|
RadOffsetTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 5)
|
|
CoolantTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 6)
|
|
CorrTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 7)
|
|
MaxSpeedTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 8)
|
|
SpeedTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 9)
|
|
FeedTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 10)
|
|
TipFeedTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 11)
|
|
StartFeedTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 12)
|
|
EndFeedTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 13)
|
|
MaxAbsorptionTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 14)
|
|
MinFeedTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 15)
|
|
HeadTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 16)
|
|
ExitTxBl.Text = EgtMsg(MSG_TOOLSDBPAGEUC + 17)
|
|
|
|
End Sub
|
|
|
|
Private Sub ToolsDbPage_Loaded(sender As Object, e As RoutedEventArgs)
|
|
If m_bFirst Then
|
|
' imposto colore di default
|
|
Dim DefColor As New Color3d(0, 0, 0)
|
|
GetPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor, m_MainWindow.GetIniFile())
|
|
ToolScene.SetDefaultMaterial(DefColor)
|
|
' imposto colori sfondo
|
|
Dim BackTopColor As New Color3d(192, 192, 192)
|
|
GetPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor, m_MainWindow.GetIniFile())
|
|
Dim BackBotColor As New Color3d(BackTopColor)
|
|
GetPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor, m_MainWindow.GetIniFile())
|
|
ToolScene.SetViewBackground(BackTopColor, BackBotColor)
|
|
' imposto colore di evidenziazione
|
|
Dim MarkColor As New Color3d(255, 255, 0)
|
|
GetPrivateProfileColor(S_SCENE, K_MARK, MarkColor, m_MainWindow.GetIniFile())
|
|
ToolScene.SetMarkMaterial(MarkColor)
|
|
' imposto colore per superfici selezionate
|
|
Dim SelSurfColor As New Color3d(255, 255, 192)
|
|
GetPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor, m_MainWindow.GetIniFile())
|
|
ToolScene.SetSelSurfMaterial(SelSurfColor)
|
|
' imposto tipo e colore del rettangolo di zoom
|
|
Dim bOutline As Boolean = True
|
|
Dim ZwColor As New Color3d(0, 0, 0)
|
|
GetPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor, m_MainWindow.GetIniFile())
|
|
ToolScene.SetZoomWinAttribs(bOutline, ZwColor)
|
|
' imposto colore della linea di distanza
|
|
Dim DstLnColor As New Color3d(255, 0, 0)
|
|
GetPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor, m_MainWindow.GetIniFile())
|
|
ToolScene.SetDistLineMaterial(DstLnColor)
|
|
' imposto parametri OpenGL
|
|
Dim nDriver As Integer = GetPrivateProfileInt(S_OPENGL, K_DRIVER, 3, m_MainWindow.GetIniFile())
|
|
Dim b2Buff As Boolean = (GetPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1, m_MainWindow.GetIniFile()) <> 0)
|
|
Dim nColorBits As Integer = GetPrivateProfileInt(S_OPENGL, K_COLORBITS, 32, m_MainWindow.GetIniFile())
|
|
Dim nDepthBits As Integer = GetPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32, m_MainWindow.GetIniFile())
|
|
ToolScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
|
|
' inizializzo la scena (DB geometrico + visualizzazione)
|
|
ToolScene.Init()
|
|
' leggo direttorio componenti
|
|
'GetPrivateProfileString(S_COMPO, K_COMPODIR, "", m_sCompoDir, m_MainWindow.GetIniFile())
|
|
'Inizializzo le famiglie di utensili nell'albero
|
|
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
|
InitializeToolFamily(K_SAWBLADE, MCH_TF.SAWBLADE, EgtMsg(MSG_TOOLSDBPAGEUC + 31))
|
|
InitializeToolFamily(K_DRILLBIT, MCH_TF.DRILLBIT, EgtMsg(MSG_TOOLSDBPAGEUC + 32))
|
|
InitializeToolFamily(K_MILL, MCH_TF.MILL, EgtMsg(MSG_TOOLSDBPAGEUC + 33))
|
|
m_bFirst = False
|
|
Else
|
|
EgtSetCurrentContext(ToolScene.GetCtx())
|
|
End If
|
|
|
|
If GetPrivateProfileInt(S_TOOLS, K_SHOWTOOLCHANGER, 0, m_MainWindow.m_sMachIniFile) <> 0 Then
|
|
TCPosTxBl.Visibility = Windows.Visibility.Visible
|
|
TCPosTxBx.Visibility = Windows.Visibility.Visible
|
|
Else
|
|
TCPosTxBl.Visibility = Windows.Visibility.Hidden
|
|
TCPosTxBx.Visibility = Windows.Visibility.Hidden
|
|
End If
|
|
|
|
If GetPrivateProfileInt(S_TOOLS, K_SHOWHEADEXIT, 0, m_MainWindow.m_sMachIniFile) <> 0 Then
|
|
HeadTxBl.Visibility = Windows.Visibility.Visible
|
|
HeadTxBx.Visibility = Windows.Visibility.Visible
|
|
ExitTxBl.Visibility = Windows.Visibility.Visible
|
|
ExitTxBx.Visibility = Windows.Visibility.Visible
|
|
Else
|
|
HeadTxBl.Visibility = Windows.Visibility.Hidden
|
|
HeadTxBx.Visibility = Windows.Visibility.Hidden
|
|
ExitTxBl.Visibility = Windows.Visibility.Hidden
|
|
ExitTxBx.Visibility = Windows.Visibility.Hidden
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub NewBtn_Click(sender As Object, e As RoutedEventArgs) Handles NewBtn.Click
|
|
If TypeOf ToolTreeView.SelectedItem Is CathegoryItem Then
|
|
Dim SelectedCathegory As CathegoryItem = ToolTreeView.SelectedItem
|
|
Dim NewName As String = SelectedCathegory.Title
|
|
EgtTdbGetToolNewName(NewName)
|
|
If EgtTdbAddTool(NewName, SelectedCathegory.nFType) Then
|
|
For Each ToolFamily In ToolsList
|
|
If ToolFamily.nFType = SelectedCathegory.nFType Then
|
|
Dim NewToolItem As New ToolItem(NewName, SelectedCathegory.nFType)
|
|
ToolFamily.Items.Add(NewToolItem)
|
|
NewToolItem.IsSelected = True
|
|
ToolFamily.IsExpanded = True
|
|
m_OldItem = ToolTreeView.SelectedItem
|
|
End If
|
|
Next
|
|
' Imposto testa ed uscita del nuovo utensile
|
|
Dim nTemp As Integer
|
|
EgtTdbGetCurrToolParam(MCH_TP.TYPE, nTemp)
|
|
If (nTemp And MCH_TF.SAWBLADE) <> 0 Then
|
|
EgtTdbSetCurrToolParam(MCH_TP.HEAD, "H1")
|
|
Else
|
|
EgtTdbSetCurrToolParam(MCH_TP.HEAD, "H2")
|
|
End If
|
|
EgtTdbSetCurrToolParam(MCH_TP.EXIT_, 1)
|
|
EgtTdbSaveCurrTool()
|
|
GetToolParam()
|
|
End If
|
|
ElseIf TypeOf ToolTreeView.SelectedItem Is ToolItem Then
|
|
Dim SelectedCathegory As ToolItem = ToolTreeView.SelectedItem
|
|
Dim NewName As String = SelectedCathegory.Title
|
|
EgtTdbGetToolNewName(NewName)
|
|
If EgtTdbCopyTool(SelectedCathegory.Title, NewName) Then
|
|
Dim CurrType As Integer
|
|
EgtTdbGetCurrToolParam(MCH_TP.TYPE, CurrType)
|
|
For Each ToolFamily In ToolsList
|
|
If (ToolFamily.nFType And CurrType) <> 0 Then
|
|
Dim NewToolItem As New ToolItem(NewName, CurrType)
|
|
ToolFamily.Items.Add(NewToolItem)
|
|
NewToolItem.IsSelected = True
|
|
GetToolParam()
|
|
m_OldItem = ToolTreeView.SelectedItem
|
|
End If
|
|
Next
|
|
End If
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub SaveBtn_Click(sender As Object, e As RoutedEventArgs) Handles SaveBtn.Click
|
|
EgtTdbSaveCurrTool()
|
|
End Sub
|
|
|
|
Private Sub RemoveBtn_Click(sender As Object, e As RoutedEventArgs) Handles RemoveBtn.Click
|
|
If TypeOf ToolTreeView.SelectedItem Is ToolItem Then
|
|
Dim SelectedItem As ToolItem = ToolTreeView.SelectedItem
|
|
EgtTdbRemoveTool(SelectedItem.Title)
|
|
For Each ToolFamily In ToolsList
|
|
If (ToolFamily.nFType And SelectedItem.nType) <> 0 Then
|
|
ToolFamily.Items.Remove(SelectedItem)
|
|
End If
|
|
Next
|
|
End If
|
|
'RefreshToolTree()
|
|
End Sub
|
|
|
|
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
|
|
EgtTdbSave()
|
|
m_MainWindow.m_MachinePageUC.MachinePageGrid.Children.Remove(m_MainWindow.m_MachinePageUC.m_ToolsDbUC)
|
|
End Sub
|
|
|
|
Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click
|
|
m_MainWindow.m_MachinePageUC.MachinePageGrid.Children.Remove(m_MainWindow.m_MachinePageUC.m_ToolsDbUC)
|
|
End Sub
|
|
|
|
Private Sub InitializeToolFamily(sFIniConst As String, nFType As Integer, sFName As String)
|
|
If GetPrivateProfileInt(S_TOOLS, sFIniConst, 0, m_MainWindow.m_sMachIniFile) = 1 Then
|
|
Dim ToolCathegory As New CathegoryItem(sFName, nFType)
|
|
Dim nType As Integer = 0
|
|
Dim ToolName As String = String.Empty
|
|
If EgtTdbGetFirstTool(nFType, ToolName, nType) Then
|
|
ToolCathegory.Items.Add(New ToolItem(ToolName, nType))
|
|
While EgtTdbGetNextTool(nFType, ToolName, nType)
|
|
ToolCathegory.Items.Add(New ToolItem(ToolName, nType))
|
|
End While
|
|
End If
|
|
ToolsList.Add(ToolCathegory)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub RefreshToolTree()
|
|
Dim ExpandedFamilyList As New List(Of CathegoryItem)
|
|
For Each ToolFamily In ToolsList
|
|
If ToolFamily.IsExpanded = True Then
|
|
ExpandedFamilyList.Add(ToolFamily)
|
|
End If
|
|
Next
|
|
ToolsList.Clear()
|
|
InitializeToolFamily(K_SAWBLADE, MCH_TF.SAWBLADE, EgtMsg(MSG_TOOLSDBPAGEUC + 31))
|
|
InitializeToolFamily(K_DRILLBIT, MCH_TF.DRILLBIT, EgtMsg(MSG_TOOLSDBPAGEUC + 32))
|
|
InitializeToolFamily(K_MILL, MCH_TF.MILL, EgtMsg(MSG_TOOLSDBPAGEUC + 33))
|
|
For Each ToolFamily In ToolsList
|
|
For Each ExpandedFamily In ExpandedFamilyList
|
|
If ExpandedFamily.Title = ToolFamily.Title Then
|
|
ToolFamily.IsExpanded = True
|
|
End If
|
|
Next
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub GetToolParam()
|
|
Dim ToolString As String = String.Empty
|
|
Dim ToolInt As Integer = 0
|
|
Dim ToolDouble As Double = 0
|
|
EgtTdbGetCurrToolParam(MCH_TP.NAME, ToolString)
|
|
NameTxBx.Text = ToolString
|
|
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, ToolString)
|
|
TCPosTxBx.Text = ToolString
|
|
EgtTdbGetCurrToolParam(MCH_TP.MAXMAT, ToolDouble)
|
|
MaxMatTxBx.Text = ToolDouble
|
|
EgtTdbGetCurrToolParam(MCH_TP.LONOFFSET, ToolDouble)
|
|
LonOffsetTxBx.Text = ToolDouble
|
|
EgtTdbGetCurrToolParam(MCH_TP.RADOFFSET, ToolDouble)
|
|
RadOffsetTxBx.Text = ToolDouble
|
|
EgtTdbGetCurrToolParam(MCH_TP.COOLANT, ToolInt)
|
|
CoolantTxBx.Text = ToolInt
|
|
EgtTdbGetCurrToolParam(MCH_TP.CORR, ToolInt)
|
|
CorrTxBx.Text = ToolInt
|
|
EgtTdbGetCurrToolParam(MCH_TP.MAXSPEED, ToolDouble)
|
|
MaxSpeedTxBx.Text = ToolDouble
|
|
EgtTdbGetCurrToolParam(MCH_TP.SPEED, ToolDouble)
|
|
SpeedTxBx.Text = ToolDouble
|
|
EgtTdbGetCurrToolParam(MCH_TP.FEED, ToolDouble)
|
|
FeedTxBx.Text = ToolDouble
|
|
EgtTdbGetCurrToolParam(MCH_TP.TIPFEED, ToolDouble)
|
|
TipFeedTxBx.Text = ToolDouble
|
|
EgtTdbGetCurrToolParam(MCH_TP.STARTFEED, ToolDouble)
|
|
StartFeedTxBx.Text = ToolDouble
|
|
EgtTdbGetCurrToolParam(MCH_TP.ENDFEED, ToolDouble)
|
|
EndFeedTxBx.Text = ToolDouble
|
|
EgtTdbGetCurrToolParam(MCH_TP.MAXABSORPTION, ToolDouble)
|
|
MaxAbsorptionTxBx.Text = ToolDouble
|
|
EgtTdbGetCurrToolParam(MCH_TP.MINFEED, ToolDouble)
|
|
MinFeedTxBx.Text = ToolDouble
|
|
EgtTdbGetCurrToolParam(MCH_TP.HEAD, ToolString)
|
|
HeadTxBx.Text = ToolString
|
|
EgtTdbGetCurrToolParam(MCH_TP.EXIT_, ToolInt)
|
|
ExitTxBx.Text = ToolInt
|
|
End Sub
|
|
|
|
Private Sub GetBlankToolParam()
|
|
NameTxBx.Text = ""
|
|
TCPosTxBx.Text = ""
|
|
MaxMatTxBx.Text = ""
|
|
LonOffsetTxBx.Text = ""
|
|
RadOffsetTxBx.Text = ""
|
|
CoolantTxBx.Text = ""
|
|
CorrTxBx.Text = ""
|
|
MaxSpeedTxBx.Text = ""
|
|
SpeedTxBx.Text = ""
|
|
FeedTxBx.Text = ""
|
|
TipFeedTxBx.Text = ""
|
|
StartFeedTxBx.Text = ""
|
|
EndFeedTxBx.Text = ""
|
|
MaxAbsorptionTxBx.Text = ""
|
|
MinFeedTxBx.Text = ""
|
|
HeadTxBx.Text = ""
|
|
ExitTxBx.Text = ""
|
|
End Sub
|
|
|
|
Private Sub SetToolParam()
|
|
Dim dTemp As Double
|
|
Dim nTemp As Integer
|
|
EgtTdbSetCurrToolParam(MCH_TP.NAME, NameTxBx.Text)
|
|
EgtTdbSetCurrToolParam(MCH_TP.TCPOS, TCPosTxBx.Text)
|
|
StringToDouble(MaxMatTxBx.Text, dTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.MAXMAT, dTemp)
|
|
StringToDouble(LonOffsetTxBx.Text, dTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.LONOFFSET, dTemp)
|
|
StringToDouble(RadOffsetTxBx.Text, dTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.RADOFFSET, dTemp)
|
|
Int32.TryParse(CoolantTxBx.Text, nTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.COOLANT, nTemp)
|
|
Int32.TryParse(CorrTxBx.Text, nTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.CORR, nTemp)
|
|
StringToDouble(MaxSpeedTxBx.Text, dTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.MAXSPEED, dTemp)
|
|
StringToDouble(SpeedTxBx.Text, dTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.SPEED, dTemp)
|
|
StringToDouble(FeedTxBx.Text, dTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.FEED, dTemp)
|
|
StringToDouble(TipFeedTxBx.Text, dTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.TIPFEED, dTemp)
|
|
StringToDouble(StartFeedTxBx.Text, dTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.STARTFEED, dTemp)
|
|
StringToDouble(EndFeedTxBx.Text, dTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.ENDFEED, dTemp)
|
|
StringToDouble(MaxAbsorptionTxBx.Text, dTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.MAXABSORPTION, dTemp)
|
|
StringToDouble(MinFeedTxBx.Text, dTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.MINFEED, dTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.HEAD, HeadTxBx.Text)
|
|
Int32.TryParse(ExitTxBx.Text, nTemp)
|
|
EgtTdbSetCurrToolParam(MCH_TP.EXIT_, nTemp)
|
|
End Sub
|
|
|
|
Private Sub ToolTreeView_PreviewMouseUp(sender As Object, e As MouseButtonEventArgs) Handles ToolTreeView.PreviewMouseUp
|
|
SetToolParam()
|
|
If EgtTdbIsCurrToolModified() And Not TypeOf m_OldItem Is CathegoryItem Then
|
|
Dim SaveCurrProj As New SaveCurrProjWD
|
|
SaveCurrProj.sTextString = "Salvare l'utensile corrente?"
|
|
SaveCurrProj.ShowDialog()
|
|
Select Case SaveCurrProj.DialogResult
|
|
Case 0 ' Annulla
|
|
Dim PreviousTool As ToolItem = m_OldItem
|
|
PreviousTool.IsSelected = True
|
|
Exit Sub
|
|
Case 1 ' Si
|
|
EgtTdbSaveCurrTool()
|
|
Case 2 ' No
|
|
' Non devo fare alcunchè
|
|
End Select
|
|
End If
|
|
|
|
If TypeOf ToolTreeView.SelectedItem Is CathegoryItem Then
|
|
Dim SelectedCathegory As CathegoryItem = ToolTreeView.SelectedItem
|
|
SelectedCathegory.IsExpanded = Not SelectedCathegory.IsExpanded
|
|
GetBlankToolParam()
|
|
ElseIf TypeOf ToolTreeView.SelectedItem Is ToolItem Then
|
|
Dim SelectedTool As ToolItem = ToolTreeView.SelectedItem
|
|
EgtTdbSetCurrTool(SelectedTool.Title)
|
|
GetToolParam()
|
|
End If
|
|
m_OldItem = ToolTreeView.SelectedItem
|
|
End Sub
|
|
|
|
Private Sub ToolParam_TextChanged(sender As Object, e As TextChangedEventArgs) Handles TCPosTxBx.TextChanged, MaxMatTxBx.TextChanged
|
|
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Namespace TreeViewItem
|
|
|
|
Public Class CathegoryItem
|
|
Inherits TreeViewItemBase
|
|
|
|
Private m_sTitle As String
|
|
Private m_sPictureString As String
|
|
Private m_nFType As Integer
|
|
Private m_Items As ObservableCollection(Of ToolItem)
|
|
|
|
Public Property Title As String
|
|
Get
|
|
Return m_sTitle
|
|
End Get
|
|
Set(value As String)
|
|
m_sTitle = value
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property PictureString As String
|
|
Get
|
|
Return "/Resources/ToolsTreeViewImages/Lama.png"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property nFType As Integer
|
|
Get
|
|
Return m_nFType
|
|
End Get
|
|
End Property
|
|
|
|
Public Property Items As ObservableCollection(Of ToolItem)
|
|
Get
|
|
Return m_Items
|
|
End Get
|
|
Set(value As ObservableCollection(Of ToolItem))
|
|
m_Items = value
|
|
End Set
|
|
End Property
|
|
|
|
Sub New(sName As String, nType As Integer)
|
|
Title = sName
|
|
m_nFType = nType
|
|
Me.Items = New ObservableCollection(Of ToolItem)
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class ToolItem
|
|
Inherits TreeViewItemBase
|
|
|
|
Private m_sTitle As String
|
|
Private m_nType As Integer
|
|
|
|
Public Property Title As String
|
|
Get
|
|
Return m_sTitle
|
|
End Get
|
|
Set(value As String)
|
|
m_sTitle = value
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property nType As Integer
|
|
Get
|
|
Return m_nType
|
|
End Get
|
|
End Property
|
|
|
|
Sub New(Title As String, nType As Integer)
|
|
Me.Title = Title
|
|
m_nType = nType
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class TreeViewItemBase
|
|
Implements INotifyPropertyChanged
|
|
|
|
Private m_isSelected As Boolean
|
|
Public Property IsSelected As Boolean
|
|
Get
|
|
Return m_isSelected
|
|
End Get
|
|
Set(value As Boolean)
|
|
If (value <> m_isSelected) Then
|
|
m_isSelected = value
|
|
NotifyPropertyChanged("IsSelected")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_isExpanded As Boolean
|
|
Public Property IsExpanded As Boolean
|
|
Get
|
|
Return m_isExpanded
|
|
End Get
|
|
Set(value As Boolean)
|
|
If (value <> m_isExpanded) Then
|
|
m_isExpanded = value
|
|
NotifyPropertyChanged("IsExpanded")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
|
|
|
|
|
Public Sub NotifyPropertyChanged(propName As String)
|
|
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
End Namespace
|
|
|