using CommunityToolkit.Mvvm.ComponentModel;
using MultiTerm.Protocols.Model;
namespace MultiTerm.Core.ViewModel;
public partial class DataViewModel : ObservableObject
{
///
/// Identifier for the frontend to group lines.
///
[ObservableProperty]
private int lineIdentifier;
///
/// Object of data model.
///
[ObservableProperty]
private ExtendedChar character;
///
/// Property that hosts a displayable string of the character (UTF-16 encoded).
///
[ObservableProperty]
private string displayStringUtf16 = String.Empty;
///
/// Property that hosts a string of the character (hexadecimal format).
///
[ObservableProperty]
private string displayStringHex = String.Empty;
///
/// Property that hosts a string of the character (binary format).
///
[ObservableProperty]
private string displayStringBin = String.Empty;
public DataViewModel(ExtendedChar character, int lineIdentifier)
{
this.character = character;
this.lineIdentifier = lineIdentifier;
this.DisplayStringUtf16 = character.ToUtf16String();
this.DisplayStringHex = character.ToHexString();
this.DisplayStringBin = character.ToBinaryString();
}
}