diff --git a/Examples/Program.cs b/Examples/Program.cs index f142896..93736cf 100644 --- a/Examples/Program.cs +++ b/Examples/Program.cs @@ -30,6 +30,12 @@ namespace Examples { //reading a value from the register collection Console.WriteLine($"BitValue is: {registers.BitValue}"); + interf.GetRegister(nameof(registers.TestInt16)).PropertyChanged += (s, e) => { + Console.ForegroundColor = ConsoleColor.Green; + Console.WriteLine(interf.GetRegister(nameof(registers.TestInt16)).StringValue); + Console.ResetColor(); + }; + //writing a value to the registers Task.Factory.StartNew(async () => { diff --git a/MewtocolNet/Mewtocol/Subregisters/Register.cs b/MewtocolNet/Mewtocol/Subregisters/Register.cs index 83a6620..507491e 100644 --- a/MewtocolNet/Mewtocol/Subregisters/Register.cs +++ b/MewtocolNet/Mewtocol/Subregisters/Register.cs @@ -19,11 +19,37 @@ namespace MewtocolNet.Registers { public event Action ValueChanged; public event PropertyChangedEventHandler PropertyChanged; + /// + /// The register name or null of not defined + /// public string Name { get; set; } + /// + /// The registers memory adress if not a special register + /// public int MemoryAdress { get; set; } + /// + /// The rgisters memory length + /// public int MemoryLength { get; set; } + + /// + /// The value of the register auto converted to a string + /// + public string StringValue => GetValueString(); + + /// + /// The name the register would have in the PLC + /// + public string RegisterPLCName => GetRegisterPLCName(); + internal bool isUsedBitwise { get; set; } + internal Register () { + ValueChanged += (obj) => { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(StringValue))); + }; + } + public virtual string BuildMewtocolIdent() { StringBuilder asciistring = new StringBuilder("D"); diff --git a/MewtocolNet/MewtocolNet.csproj b/MewtocolNet/MewtocolNet.csproj index 02a0249..aac7806 100644 --- a/MewtocolNet/MewtocolNet.csproj +++ b/MewtocolNet/MewtocolNet.csproj @@ -2,7 +2,7 @@ netstandard2.0 MewtocolNet - 0.3.3 + 0.3.4 Felix Weiss Womed true