Files
EgtWPFLib5/Note/NoteListBoxItem.vb
2025-08-01 08:42:19 +02:00

247 lines
7.3 KiB
VB.net

Imports System.Collections.ObjectModel
Imports EgtWPFLib5.MachiningTreeViewItem
Public Class NoteListBoxItem
Inherits VMBase
#Region "FIELD & PROPERTIES"
' 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
Dim SelTool As ToolTreeViewItem = If(Not IsNothing(LibMap.refToolDbWindowVM), LibMap.refToolDbWindowVM.SelTool, Nothing)
Dim SelMach As MachiningTreeViewItem = Nothing
If Not IsNothing(LibMap.refMachiningDbWindowVM) AndAlso Not IsNothing(LibMap.refMachiningDbWindowVM.SelMachining) Then
SelMach = LibMap.refMachiningDbWindowVM.SelMachining
Else
SelMach = MachiningTreeViewItem.sh_SelMach
End If
If Not IsNothing(SelMach) Then
SelMach.IsModifiedNote(Me)
ElseIf Not IsNothing(SelTool) Then
SelTool.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
Dim SelTool As ToolTreeViewItem = If(Not IsNothing(LibMap.refToolDbWindowVM), LibMap.refToolDbWindowVM.SelTool, Nothing)
If Not IsNothing(SelTool) Then SelTool.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
Friend m_ListKeyValue As New ObservableCollection(Of ComboParameter)
Public Property ListKeyValue As ObservableCollection(Of ComboParameter)
Get
Return m_ListKeyValue
End Get
Set(value As ObservableCollection(Of ComboParameter))
m_ListKeyValue = value
NotifyPropertyChanged(NameOf(ListKeyValue))
End Set
End Property
Friend m_SelKeyValue As ComboParameter
Public Property SelKeyValue As ComboParameter
Get
Return m_SelKeyValue
End Get
Set(value As ComboParameter)
m_SelKeyValue = value
NotifyPropertyChanged(NameOf(SelKeyValue))
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)
Dim nDescription As Integer = -1
m_Id = Id
m_Type = Type
m_Description = If(Integer.TryParse(Description, nDescription), EgtUILib.EgtMsg(nDescription), Description)
m_Value = Value
End Sub
Sub New(Id As Integer, Type As String, Description As String, ListValue As ObservableCollection(Of String))
Dim nDescription As Integer = -1
m_Id = Id
m_Type = Type
m_Description = If(Integer.TryParse(Description, nDescription), EgtUILib.EgtMsg(nDescription), Description)
m_ListValue = ListValue
End Sub
Sub New(Id As Integer, Type As String, Description As String, ListKeyValue As ObservableCollection(Of ComboParameter))
Dim nDescription As Integer = -1
Dim nKeyValue As Integer = -1
m_Id = Id
m_Type = Type
m_Description = If(Integer.TryParse(Description, nDescription), EgtUILib.EgtMsg(nDescription), Description)
For Each KeyItemValue As ComboParameter In ListKeyValue
KeyItemValue.KeyValue = If(Integer.TryParse(KeyItemValue.KeyValue, nKeyValue), EgtUILib.EgtMsg(nKeyValue), KeyItemValue.KeyValue)
Next
m_ListKeyValue = ListKeyValue
If IsNothing(m_SelKeyValue) Then m_SelKeyValue = m_ListKeyValue(0)
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)
Dim SelTool As ToolTreeViewItem = If(Not IsNothing(LibMap.refToolDbWindowVM), LibMap.refToolDbWindowVM.SelTool, Nothing)
Dim SelMach As MachiningTreeViewItem = Nothing
If Not IsNothing(LibMap.refMachiningDbWindowVM) AndAlso Not IsNothing(LibMap.refMachiningDbWindowVM.SelMachining) Then
SelMach = LibMap.refMachiningDbWindowVM.SelMachining
Else
SelMach = MachiningTreeViewItem.sh_SelMach
End If
If Not IsNothing(SelTool) Then
SelTool.RemoveNote(Me)
ElseIf Not IsNothing(SelMach) AndAlso SelMach.m_CurrMachTreeViewItemType = MachTreeViewItemType.OPERATION Then
SelMach.RemoveNote(Me)
ElseIf Not IsNothing(SelMach) AndAlso SelMach.m_CurrMachTreeViewItemType = MachTreeViewItemType.MACH_DB Then
SelMach.RemoveNote(Me)
End If
End Sub
#End Region ' RemoveItemNoteCommand
#End Region ' Commands
End Class
Public Class ComboParameter
#Region "FIELDS % PROPERTIES"
Friend m_Index As String
Public Property Index As String
Get
Return m_Index
End Get
Set(value As String)
m_Index = value
End Set
End Property
Friend m_KeyValue As String
Public Property KeyValue As String
Get
Return m_KeyValue
End Get
Set(value As String)
m_KeyValue = value
End Set
End Property
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Public Sub New(Index As String, KeyValue As String)
m_Index = Index
m_KeyValue = KeyValue
End Sub
#End Region ' Constructor
End Class