Merge commit 'adedbe64ea2711355e33c9b2db21f33beaabe12d'

This commit is contained in:
Dario Sassi
2025-08-01 08:33:08 +02:00
3 changed files with 126 additions and 9 deletions
+51 -5
View File
@@ -1,6 +1,5 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports Microsoft.VisualBasic.Devices
''' <summary>
''' Class that represent a FamilyMachining in the treeview.
@@ -4666,6 +4665,8 @@ Public Class MachiningTreeViewItem
' Controllo per la visualizzazione di una textbox o checkbox
If m_SelNoteItemCombo.Type.Equals("d") OrElse m_SelNoteItemCombo.Type.Equals("l") OrElse m_SelNoteItemCombo.Type.Equals("s") Then
m_SelNoteItemCombo.SelTypeValue = 0 ' Seleziona la TextBox
ElseIf m_SelNoteItemCombo.Type.Equals("i") Then
m_SelNoteItemCombo.SelTypeValue = 2 ' Seleziona la ComboBox
Else
m_SelNoteItemCombo.SelTypeValue = 1 ' Seleziona la CheckBox
' Trasformo il valore della checkbox da stringa a booleano
@@ -7337,6 +7338,8 @@ Public Class MachiningTreeViewItem
Dim tmpType As String = If(m_Type.Equals(MCH_MY.FIVEAXISMILLING), "5AxMilling", m_Type.ToString())
Dim IndexNote As Integer = 0
Dim sNoteDescription As String = ""
Dim value As New ObservableCollection(Of ComboParameter)
Dim keyValue As String() = Nothing
While EgtUILib.GetPrivateProfileString(tmpType, IndexNote.ToString(), "", sNoteDescription, sMachDir & "\" & MACH_NOTES) > 0
Dim sNotes() As String = sNoteDescription.Split(","c)
For Index As Integer = 0 To sNotes.Count - 1
@@ -7345,7 +7348,28 @@ Public Class MachiningTreeViewItem
For IndexNoteUser As Integer = 0 To tmpDsc.Count - 1
' Aggiungo alla lista NoteList le note presenti nel file ini
If tmpDsc(IndexNoteUser) = sNotes(1) Then
m_NotesList.Add(New NoteListBoxItem(IndexNote, sNotes(0), sNotes(1), tmpVal(IndexNoteUser)))
' Controllo se è una combobox
If sNotes(0) = "i" Then
Dim tmpsNote As String = sNotes(2)
' Rimuovo le parentesi quadre all'inizio e alla fine
Dim trimmedString As String = tmpsNote.Trim("["c, "]"c)
' Divido la stringa per il punto e virgola (;)
Dim pairs As String() = trimmedString.Split(";"c)
' Itero su ogni coppia e dividila per l'uguale (=)
For Each pair As String In pairs
keyValue = pair.Split("="c)
value.Add(New ComboParameter(CInt(keyValue(0)), keyValue(1)))
Next
m_NotesList.Add(New NoteListBoxItem(IndexNote, sNotes(0), sNotes(1), value))
' Controllo per visualizzare in modo corretto il selezionato
For Each ItemValue As ComboParameter In value
If tmpVal(IndexNoteUser).Contains(ItemValue.Index.ToString()) Then
m_NotesList(m_NotesList.Count - 1).SelKeyValue.KeyValue = ItemValue.KeyValue
End If
Next
Else
m_NotesList.Add(New NoteListBoxItem(IndexNote, sNotes(0), sNotes(1), tmpVal(IndexNoteUser)))
End If
Exit For
End If
Next
@@ -7373,6 +7397,8 @@ Public Class MachiningTreeViewItem
' Controllo per la visualizzazione di una textbox o checkbox
If ItemNote.Type.Equals("d") OrElse ItemNote.Type.Equals("l") OrElse ItemNote.Type.Equals("s") Then
ItemNote.SelTypeValue = 0 ' Seleziona la TextBox
ElseIf ItemNote.Type.Equals("i") Then
ItemNote.SelTypeValue = 2 ' Seleziona la ComboBox
Else
ItemNote.SelTypeValue = 1 ' Seleziona la CheckBox
' Trasformo il valore della checkbox da stringa a booleano
@@ -7402,13 +7428,30 @@ Public Class MachiningTreeViewItem
Dim sNoteDescription As String = ""
Dim tmpsNotes As New ObservableCollection(Of NoteListBoxItem)
Dim tmpDsc As New ObservableCollection(Of String)
Dim value As New ObservableCollection(Of ComboParameter)
While EgtUILib.GetPrivateProfileString(tmpType, IndexNote.ToString(), "", sNoteDescription, sMachDir & "\" & MACH_NOTES) > 0
Dim sNotes() As String = sNoteDescription.Split(","c)
For Index As Integer = 0 To sNotes.Count - 1
sNotes(Index) = sNotes(Index).Trim()
If sNotes(Index).StartsWith("[") Then
Dim tmpsNote As String = sNotes(Index)
' Rimuovo le parentesi quadre all'inizio e alla fine
Dim trimmedString As String = tmpsNote.Trim("["c, "]"c)
' Divido la stringa per il punto e virgola (;)
Dim pairs As String() = trimmedString.Split(";"c)
' Itero su ogni coppia e dividila per l'uguale (=)
For Each pair As String In pairs
Dim keyValue As String() = pair.Split("="c)
Dim key As String = keyValue(0)
value.Add(New ComboParameter(CInt(keyValue(0)), keyValue(1)))
Next
End If
Next
'Assegno valori alla lista temporanea
If sNotes.Count < 3 Then
' Assegno valori alla lista temporanea
If value.Count > 0 Then
tmpsNotes.Add(New NoteListBoxItem(IndexNote, sNotes(0), sNotes(1), value))
ElseIf sNotes.Count < 3 Then
tmpsNotes.Add(New NoteListBoxItem(IndexNote, sNotes(0), sNotes(1), ""))
ElseIf sNotes.Count >= 5 Then
tmpsNotes.Add(New NoteListBoxItem(IndexNote, sNotes(0), sNotes(1), sNotes(2) & "," & sNotes(3) & "," & sNotes(4)))
@@ -7460,6 +7503,8 @@ Public Class MachiningTreeViewItem
' Scrivo in MCH_MP.USERNOTES la nota modificata
If m_NotesList(IndexNote).Type.Equals("b") OrElse m_NotesList(IndexNote).Type.Equals("br") Then
sAdvNotes &= m_NotesList(IndexNote).Description & "=" & If(m_NotesList(IndexNote).Value.Equals("True"), "1", "0") & ";"
ElseIf m_NotesList(IndexNote).Type.Equals("i") AndAlso Not IsNothing(m_NotesList(IndexNote).SelKeyValue) Then
sAdvNotes &= m_NotesList(IndexNote).Description & "=" & m_NotesList(IndexNote).SelKeyValue.Index & ";"
Else
sAdvNotes &= m_NotesList(IndexNote).Description & "=" & m_NotesList(IndexNote).Value & ";"
End If
@@ -7514,6 +7559,7 @@ Public Class MachiningTreeViewItem
End If
NotifyPropertyChanged(NameOf(UserNotes))
NotifyPropertyChanged(NameOf(NotesList))
End Sub
''' <summary>
@@ -8140,4 +8186,4 @@ Public Class MachiningMaterial
m_refSetSystemNotes = refSetSystemNotes
End Sub
End Class
End Class
+75 -3
View File
@@ -101,7 +101,6 @@ Public Class NoteListBoxItem
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
@@ -113,6 +112,28 @@ Public Class NoteListBoxItem
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
@@ -121,19 +142,34 @@ Public Class NoteListBoxItem
#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 = Description
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 = Description
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"
@@ -173,3 +209,39 @@ Public Class NoteListBoxItem
End Class
Public Class ComboParameter
#Region "FIELDS % PROPERTIES"
Friend m_Index As Integer
Public Property Index As Integer
Get
Return m_Index
End Get
Set(value As Integer)
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 Integer, KeyValue As String)
m_Index = Index
m_KeyValue = KeyValue
End Sub
#End Region ' Constructor
End Class
-1
View File
@@ -1606,7 +1606,6 @@ Public Class ToolTreeViewItem
End Set
End Property
' Comandi
Private m_cmdShowNoteListCombo As ICommand