Imports System.Collections.ObjectModel Imports EgtWPFLib5 Imports EgtBEAMWALL.Core Public Class VariablesListVM Private m_VariablesList As New ObservableCollection(Of Variable) Public ReadOnly Property VariablesList As ObservableCollection(Of Variable) Get Return m_VariablesList End Get End Property Sub New(VarIniParagraph As String) ' inizializzo tutte le variabili Dim Index As Integer = 1 Dim CommVariable As CommVar = MachManaging.InitVar(VarIniParagraph, Index) While Not IsNothing(CommVariable) m_VariablesList.Add(New Variable(CommVariable)) Index += 1 CommVariable = MachManaging.InitVar(VarIniParagraph, Index) End While End Sub End Class Public Class Variable Inherits VMBase Private m_CommVar As CommVar Public ReadOnly Property CommVar As CommVar Get Return m_CommVar End Get End Property Public Property sName As String Get Return CommVar.sName End Get Set(value As String) CommVar.sName = value End Set End Property Public ReadOnly Property sDescription As String Get Return CommVar.sDescription End Get End Property Public Property sAddress As String Get Return CommVar.sAddress End Get Set(value As String) CommVar.sAddress = value End Set End Property Public Property sValue As String Get Return CommVar.sValue End Get Set(value As String) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.WRITE, {CommVar.nType}, Nothing, {CommVar.sAddress, value})) NotifyPropertyChanged(NameOf(sValue)) End Set End Property Sub New(CommVar As CommVar) m_CommVar = CommVar AddHandler CommVar.NewValue, AddressOf CommVar_NewValue End Sub Private Sub CommVar_NewValue(sender As Object, e As NewValueEventArgs) NotifyPropertyChanged(NameOf(sValue)) End Sub End Class