Files
EgtWPFLib5/Note/NoteListBoxItem.vb
T
2024-07-08 16:39:43 +02:00

163 lines
4.4 KiB
VB.net

Imports System.Collections.ObjectModel
Imports EgtWPFLib5.MachiningTreeViewItem
Public Class NoteListBoxItem
Inherits VMBase
#Region "FIELD & PROPERTIES"
Private WithEvents m_IsModified As MachiningTreeViewItem
' Indice dei valori nel file Note.ini
Friend m_Id As Integer
Public Property Id As Integer
Get
Return m_Id
End Get
Set(value As Integer)
m_Id = value
End Set
End Property
' Tipo del valore che può essere b = boolean, d = double, l=lenght
Friend m_Type As String
Public Property Type As String
Get
Return m_Type
End Get
Set(value As String)
m_Type = value
End Set
End Property
' Descrizione
Friend m_Description As String
Public Property Description As String
Get
Return m_Description
End Get
Set(value As String)
m_Description = value
End Set
End Property
Public m_IsModifiedValue As Boolean = False
Public Property IsModifiedValue As Boolean
Get
Return m_IsModifiedValue
End Get
Set(value As Boolean)
m_IsModifiedValue = value
NotifyPropertyChanged(NameOf(IsModifiedValue))
End Set
End Property
' Valore di default 0
Friend m_Value As String
Public Property Value As String
Get
Return m_Value
End Get
Set(value As String)
m_IsModifiedValue = True
NotifyPropertyChanged(NameOf(IsModifiedValue))
m_Value = value
If Not IsNothing(LibMap.refMachiningTreeViewItem) Then
LibMap.refMachiningTreeViewItem.IsModifiedNote(Me)
ElseIf Not IsNothing(LibMap.refToolTreeViewItem) Then
LibMap.refToolTreeViewItem.IsModifiedNote(Me)
End If
End Set
End Property
' Valore di default 0
Friend m_ListValue As New ObservableCollection(Of String)
Public Property ListValue As ObservableCollection(Of String)
Get
Return m_ListValue
End Get
Set(value As ObservableCollection(Of String))
m_ListValue = value
NotifyPropertyChanged(NameOf(ListValue))
End Set
End Property
' Valore di default 0
Friend m_SelListValue As String
Public Property SelListValue As String
Get
Return m_SelListValue
End Get
Set(value As String)
m_SelListValue = value
If Not IsNothing(LibMap.refToolTreeViewItem) Then LibMap.refToolTreeViewItem.SelNoteListValue(Me)
NotifyPropertyChanged(NameOf(SelListValue))
End Set
End Property
' Indice di selezione del tab per la scelta grafica se 0 viene mostrata la textbox se 1 la combobox
Friend m_SelTypeValue As Integer = 0
Public Property SelTypeValue As Integer
Get
Return m_SelTypeValue
End Get
Set(value As Integer)
m_SelTypeValue = value
End Set
End Property
' Comandi
Private m_cmdRemoveNoteItem As ICommand
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Sub New(Id As Integer, Type As String, Description As String, Value As String)
m_Id = Id
m_Type = Type
m_Description = Description
m_Value = Value
End Sub
Sub New(Id As Integer, Type As String, Description As String, ListValue As ObservableCollection(Of String))
m_Id = Id
m_Type = Type
m_Description = Description
m_ListValue = ListValue
End Sub
#End Region ' Constructor
#Region "COMMANDS"
#Region "RemoveItemNoteCommand"
Public ReadOnly Property RemoveItemNoteCommand As ICommand
Get
If m_cmdRemoveNoteItem Is Nothing Then
m_cmdRemoveNoteItem = New Command(AddressOf RemoveItemNote)
End If
Return m_cmdRemoveNoteItem
End Get
End Property
Public Sub RemoveItemNote(ByVal param As Object)
If Not IsNothing(LibMap.refMachiningTreeViewItem) AndAlso LibMap.refMachiningTreeViewItem.m_CurrMachTreeViewItemType = MachTreeViewItemType.OPERATION Then
LibMap.refMachiningTreeViewItem.RemoveNote(Me)
ElseIf Not IsNothing(LibMap.refToolTreeViewItem) Then
LibMap.refToolTreeViewItem.RemoveNote(Me)
ElseIf LibMap.refMachiningTreeViewItem.m_CurrMachTreeViewItemType = MachTreeViewItemType.MACH_DB Then
LibMap.refMachiningTreeViewItem.RemoveNoteDB(Me)
End If
End Sub
#End Region ' RemoveItemNoteCommand
#End Region ' Commands
End Class