using CommunityToolkit.Mvvm.ComponentModel; using MultiTerm.Protocols.Model; using System.Text; namespace MultiTerm.Core.ViewModel; public partial class ByteDataViewModel : ObservableObject, IDataViewModel { /// /// Object of data model. /// private readonly ExtendedByte data; #region IDataViewModel Implementation [ObservableProperty] private int lineIdentifier; [ObservableProperty] private TimeOnly time; [ObservableProperty] private string displayStringChar = String.Empty; [ObservableProperty] private string displayStringHex = String.Empty; [ObservableProperty] private string displayStringBin = String.Empty; #endregion /// /// Allows access to the low level data byte. /// public byte Byte => this.data.Byte; /// /// Instanciates new . /// Initializes internal variables with data according to . /// /// data /// identifies line in which this byte is located public ByteDataViewModel(ExtendedByte extendedByte, int lineIdentifier) { this.data = extendedByte; this.lineIdentifier = lineIdentifier; this.DisplayStringChar = extendedByte.ToCharacterString(); this.DisplayStringHex = extendedByte.ToHexString(); this.DisplayStringBin = extendedByte.ToBinaryString(); this.Time = extendedByte.Time; } }