Fire event in WPF
I have a textbox that stores data from INotifyPropertyChanged
an MVVM model.
I want to optimize it as such: when I close the window, no data should fit into the textbox; and when i open the textbox it should start transmitting data again.
This is my viewmodel code:
public class serial : NotifyPropertyChanged
{
private string luminRecevied;
public string LuminRecevied
{
get { return luminRecevied; }
set
{
if (this.luminRecevied == value)
return;
this.luminRecevied = value ;
this.InvokePropertyChanged("LuminRecevied");
}
}
}
this is my model code:
//This is where the Outgoing Ports are Tapped and the data is displayed to the serial Monitor.
var rawPacket = e.Value as RawPacket; // Data recived from the port after tapped
StringBuilder sb = new StringBuilder();
for (int i = 0; i < rawPacket.RawData.Length; i++)
{
sb.Append(rawPacket.RawData[i].ToString("X2"));
}
this.serialData.LuminRecevied += "RX:"+sb.ToString() + Environment.NewLine;
+3
source to share
No one has answered this question yet
Check out similar questions: