From 5751bbed8141f98a7e90cf6e9d926e072526d811 Mon Sep 17 00:00:00 2001 From: fabjuuuh Date: Fri, 16 Oct 2020 16:23:50 +0200 Subject: [PATCH 1/3] Progress with structure to send data --- DoctorApp/DoctorApp.csproj | 8 +++ DoctorApp/Utils/Client.cs | 11 +-- DoctorApp/ViewModels/ClientInfoViewModel.cs | 12 ++++ DoctorApp/ViewModels/MainViewModel.cs | 25 +++++++ Hashing/DataParser.cs | 77 ++++++++++++++++++++- Server/Client.cs | 26 +++---- 6 files changed, 134 insertions(+), 25 deletions(-) diff --git a/DoctorApp/DoctorApp.csproj b/DoctorApp/DoctorApp.csproj index 1dd8012..152865f 100644 --- a/DoctorApp/DoctorApp.csproj +++ b/DoctorApp/DoctorApp.csproj @@ -6,6 +6,14 @@ true + + true + + + + true + + diff --git a/DoctorApp/Utils/Client.cs b/DoctorApp/Utils/Client.cs index a55151d..00f3832 100644 --- a/DoctorApp/Utils/Client.cs +++ b/DoctorApp/Utils/Client.cs @@ -123,13 +123,14 @@ namespace DoctorApp.Utils break; } } - else if (DataParser.isRawData(messageBytes)) + else if (DataParser.isRawDataBikeDoctor(messageBytes)) { - Console.WriteLine($"Received data: {BitConverter.ToString(payloadbytes)}"); + MainViewModel.TransferDataToClientBike(payloadbytes); + } + else if (DataParser.isRawDataBPMDoctor(messageBytes)) + { + MainViewModel.TransferDataToClientBPM(payloadbytes); } - - totalBufferReceived -= expectedMessageLength; - expectedMessageLength = BitConverter.ToInt32(totalBuffer, 0); } this.stream.BeginRead(this.buffer, 0, this.buffer.Length, new AsyncCallback(OnRead), null); diff --git a/DoctorApp/ViewModels/ClientInfoViewModel.cs b/DoctorApp/ViewModels/ClientInfoViewModel.cs index c40f6ea..faccc0a 100644 --- a/DoctorApp/ViewModels/ClientInfoViewModel.cs +++ b/DoctorApp/ViewModels/ClientInfoViewModel.cs @@ -76,6 +76,18 @@ namespace DoctorApp.ViewModels } + public void BPMData(byte [] bytes) + { + //TODO + //Parsen van de data you fuck + } + + public void BikeData(byte[] bytes) + { + //TODO + //Parsen van de data you fuck + } + } } diff --git a/DoctorApp/ViewModels/MainViewModel.cs b/DoctorApp/ViewModels/MainViewModel.cs index 90d4509..64df762 100644 --- a/DoctorApp/ViewModels/MainViewModel.cs +++ b/DoctorApp/ViewModels/MainViewModel.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; +using System.Security.Cryptography; using System.Text; using System.Windows.Controls; using Util; @@ -51,6 +52,30 @@ namespace DoctorApp.ViewModels } }); } + + public void TransferDataToClientBike(byte[] bytes) + { + string username = DataParser.getNameFromBytes(bytes); + foreach(ClientInfoViewModel item in Tabs) + { + if(item.Username == username) + { + item.BikeData(bytes); + } + } + } + + public void TransferDataToClientBPM(byte[] bytes) + { + string username = DataParser.getNameFromBytes(bytes); + foreach (ClientInfoViewModel item in Tabs) + { + if (item.Username == username) + { + item.BikeData(bytes); + } + } + } } diff --git a/Hashing/DataParser.cs b/Hashing/DataParser.cs index 20851f9..44141dc 100644 --- a/Hashing/DataParser.cs +++ b/Hashing/DataParser.cs @@ -4,6 +4,7 @@ using System; using System.Globalization; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; +using System.Security.Cryptography; using System.Text; namespace Util @@ -68,6 +69,27 @@ namespace Util return Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json)); } + internal static string getNameFromBytesBike(byte[] bytes) + { + return ASCIIBytesToString(bytes, 8, bytes.Length - 8); + } + + internal static string getNameFromBytesBPM(byte[] bytes) + { + return ASCIIBytesToString(bytes, 2, bytes.Length - 2); + } + + private static string ASCIIBytesToString(byte[] bytes, int offset, int length) + { + unsafe + { + fixed (byte* pAscii = bytes) + { + return new String((sbyte*)pAscii, offset, length); + } + } + } + public static bool GetUsernamePassword(byte[] jsonbytes, out string username, out string password) { dynamic json = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(jsonbytes)); @@ -146,7 +168,7 @@ namespace Util /// /// message /// if message contains raw data - public static bool isRawData(byte[] bytes) + public static bool isRawDataBikeServer(byte[] bytes) { if (bytes.Length <= 5) { @@ -155,6 +177,34 @@ namespace Util return bytes[4] == 0x02; } + public static bool isRawDataBPMServer(byte[] bytes) + { + if (bytes.Length <= 5) + { + throw new ArgumentException("bytes to short"); + } + return bytes[4] == 0x03; + } + + public static bool isRawDataBikeDoctor(byte[] bytes) + { + if (bytes.Length <= 5) + { + throw new ArgumentException("bytes to short"); + } + return bytes[4] == 0x04; + } + + public static bool isRawDataBPMDoctor(byte[] bytes) + { + if (bytes.Length <= 5) + { + throw new ArgumentException("bytes to short"); + } + return bytes[4] == 0x05; + } + + /// /// constructs a message with the payload, messageId and clientId /// @@ -179,11 +229,34 @@ namespace Util /// /// /// the message ready for sending - public static byte[] GetRawDataMessage(byte[] payload) + public static byte[] GetRawBikeDataMessageServer(byte[] payload) { return getMessage(payload, 0x02); } + public static byte[] GetRawBPMDataMessageServer(byte[] payload) + { + return getMessage(payload, 0x03); + } + + public static byte[] GetRawBikeDataDoctor(byte[] payload, string username) + { + + return GetRawDataDoctor(payload, username, 0x04); + + } + + public static byte[] GetRawBPMDataDoctor(byte[] payload, string username) + { + return GetRawDataDoctor(payload,username,0x05); + } + + private static byte[] GetRawDataDoctor(byte[] payload, string username, byte messageID) + { + + return getMessage(payload.Concat(Encoding.ASCII.GetBytes(username)).ToArray(), messageID); + + } /// /// constructs a message with the payload and clientId and assumes the payload is json /// diff --git a/Server/Client.cs b/Server/Client.cs index 0d13187..f9625b2 100644 --- a/Server/Client.cs +++ b/Server/Client.cs @@ -136,26 +136,16 @@ namespace Server dynamic json = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(payloadbytes)); } - else if (DataParser.isRawData(message)) + else if (DataParser.isRawDataBikeServer(message)) { - // print the raw data - //Console.WriteLine(BitConverter.ToString(payloadbytes)); - // TODO change, checking for length is not that safe - if (payloadbytes.Length == 8) - { - saveData?.WriteDataRAWBike(payloadbytes); - } - else if (payloadbytes.Length == 2) - { - saveData?.WriteDataRAWBPM(payloadbytes); - } - else - { - Console.WriteLine("received raw data with weird lenght " + BitConverter.ToString(payloadbytes)); - } + saveData?.WriteDataRAWBike(payloadbytes); + } - - + else if (DataParser.isRawDataBPMServer(message)) + { + saveData?.WriteDataRAWBPM(payloadbytes); + } + } private bool handleLogin(byte[] payloadbytes) From 783c40d7d3b0d50dd47fa264fcc908cf4fae3ab9 Mon Sep 17 00:00:00 2001 From: fabjuuuh Date: Mon, 19 Oct 2020 11:14:05 +0200 Subject: [PATCH 2/3] rip --- ClientApp/ClientApp.csproj | 8 +++++++ ClientApp/Utils/Client.cs | 8 +++---- DoctorApp/ViewModels/ClientInfoViewModel.cs | 26 ++++++++++++++++++--- DoctorApp/ViewModels/MainViewModel.cs | 4 ++-- Hashing/DataParser.cs | 12 ++++------ 5 files changed, 42 insertions(+), 16 deletions(-) diff --git a/ClientApp/ClientApp.csproj b/ClientApp/ClientApp.csproj index 637f86c..13750b2 100644 --- a/ClientApp/ClientApp.csproj +++ b/ClientApp/ClientApp.csproj @@ -7,6 +7,14 @@ Images\Logo\icon1.ico + + true + + + + true + + diff --git a/ClientApp/Utils/Client.cs b/ClientApp/Utils/Client.cs index 69f9f1b..bebc366 100644 --- a/ClientApp/Utils/Client.cs +++ b/ClientApp/Utils/Client.cs @@ -164,10 +164,10 @@ namespace ClientApp.Utils break; } } - else if (DataParser.isRawData(messageBytes)) + /*else if (DataParser.isRawData(messageBytes)) { Console.WriteLine($"Received data: {BitConverter.ToString(payloadbytes)}"); - } + }*/ totalBufferReceived -= expectedMessageLength; expectedMessageLength = BitConverter.ToInt32(totalBuffer, 0); @@ -211,7 +211,7 @@ namespace ClientApp.Utils { throw new ArgumentNullException("no bytes"); } - byte[] message = DataParser.GetRawDataMessage(bytes); + byte[] message = DataParser.GetRawBPMDataMessageServer(bytes); if (engineConnection.Connected && engineConnection.FollowingRoute) { @@ -238,7 +238,7 @@ namespace ClientApp.Utils { throw new ArgumentNullException("no bytes"); } - byte[] message = DataParser.GetRawDataMessage(bytes); + byte[] message = DataParser.GetRawBikeDataMessageServer(bytes); bool canSendToEngine = engineConnection.Connected && engineConnection.FollowingRoute; switch (bytes[0]) { diff --git a/DoctorApp/ViewModels/ClientInfoViewModel.cs b/DoctorApp/ViewModels/ClientInfoViewModel.cs index faccc0a..d186d78 100644 --- a/DoctorApp/ViewModels/ClientInfoViewModel.cs +++ b/DoctorApp/ViewModels/ClientInfoViewModel.cs @@ -19,11 +19,11 @@ namespace DoctorApp.ViewModels public string Status { get; set; } - public int Speed { get; set; } + public double Speed { get; set; } public int BPM { get; set; } - public int Resistance { get; set; } + public float Resistance { get; set; } public int Acc_Power { get; set; } public int Curr_Power { get; set; } @@ -71,7 +71,8 @@ namespace DoctorApp.ViewModels SetResistance = new RelayCommand((parameter) => { - client.sendMessage(DataParser.getSetResistanceJson(Username, float.Parse(((TextBox)parameter).Text))); + client.sendMessage(DataParser.getSetResistanceJson(Username, float.Parse(((TextBox)parameter).Text))); + this.Resistance = float.Parse(((TextBox)parameter).Text); }); } @@ -80,12 +81,31 @@ namespace DoctorApp.ViewModels { //TODO //Parsen van de data you fuck + this.BPM = bytes[1]; } public void BikeData(byte[] bytes) { //TODO //Parsen van de data you fuck + switch (bytes[0]) + { + case 0x10: + if (bytes[1] != 25) + { + throw new Exception(); + } + this.Distance = bytes[3]; + this.Speed = (bytes[4] | (bytes[5] << 8)) * 0.01; + break; + case 0x19: + this.Acc_Power = bytes[3] | (bytes[4] << 8); + this.Curr_Power = (bytes[5]) | (bytes[6] & 0b00001111) << 8; + break; + default: + throw new Exception(); + } + } diff --git a/DoctorApp/ViewModels/MainViewModel.cs b/DoctorApp/ViewModels/MainViewModel.cs index 64df762..d245e2f 100644 --- a/DoctorApp/ViewModels/MainViewModel.cs +++ b/DoctorApp/ViewModels/MainViewModel.cs @@ -55,7 +55,7 @@ namespace DoctorApp.ViewModels public void TransferDataToClientBike(byte[] bytes) { - string username = DataParser.getNameFromBytes(bytes); + string username = DataParser.getNameFromBytesBike(bytes); foreach(ClientInfoViewModel item in Tabs) { if(item.Username == username) @@ -67,7 +67,7 @@ namespace DoctorApp.ViewModels public void TransferDataToClientBPM(byte[] bytes) { - string username = DataParser.getNameFromBytes(bytes); + string username = DataParser.getNameFromBytesBPM(bytes); foreach (ClientInfoViewModel item in Tabs) { if (item.Username == username) diff --git a/Hashing/DataParser.cs b/Hashing/DataParser.cs index 44141dc..ed132cd 100644 --- a/Hashing/DataParser.cs +++ b/Hashing/DataParser.cs @@ -54,6 +54,8 @@ namespace Util return Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json)); } + + public static byte[] LoginAsDoctor(string mUsername, string mPassword) { dynamic json = new @@ -81,13 +83,9 @@ namespace Util private static string ASCIIBytesToString(byte[] bytes, int offset, int length) { - unsafe - { - fixed (byte* pAscii = bytes) - { - return new String((sbyte*)pAscii, offset, length); - } - } + byte[] nameArray = new byte[length]; + Array.Copy(bytes, offset, nameArray, 0, length); + return Encoding.UTF8.GetString(nameArray); } public static bool GetUsernamePassword(byte[] jsonbytes, out string username, out string password) From 083f27411e6b8f922fd31a8f2c18de343015e238 Mon Sep 17 00:00:00 2001 From: fabjuuuh Date: Mon, 19 Oct 2020 14:02:42 +0200 Subject: [PATCH 3/3] chart --- ClientApp/Utils/Client.cs | 4 +- ClientApp/Utils/EngineConnection.cs | 2 +- DoctorApp/DoctorApp.csproj | 1 + DoctorApp/Models/Chart.cs | 127 ++++++++++++++++++++ DoctorApp/Models/PatientInfo.cs | 4 +- DoctorApp/Utils/Client.cs | 5 +- DoctorApp/ViewModels/ClientInfoViewModel.cs | 40 ++++-- DoctorApp/ViewModels/MainViewModel.cs | 4 +- DoctorApp/Views/ClientInfoView.xaml | 33 ++++- DoctorApp/Views/MainView.xaml | 2 +- DoctorApp/Views/MainWindow.xaml | 2 +- 11 files changed, 200 insertions(+), 24 deletions(-) create mode 100644 DoctorApp/Models/Chart.cs diff --git a/ClientApp/Utils/Client.cs b/ClientApp/Utils/Client.cs index bebc366..367fe2d 100644 --- a/ClientApp/Utils/Client.cs +++ b/ClientApp/Utils/Client.cs @@ -164,10 +164,10 @@ namespace ClientApp.Utils break; } } - /*else if (DataParser.isRawData(messageBytes)) + else if (DataParser.isRawDataBikeServer(messageBytes)) { Console.WriteLine($"Received data: {BitConverter.ToString(payloadbytes)}"); - }*/ + } totalBufferReceived -= expectedMessageLength; expectedMessageLength = BitConverter.ToInt32(totalBuffer, 0); diff --git a/ClientApp/Utils/EngineConnection.cs b/ClientApp/Utils/EngineConnection.cs index c852058..9ff92e6 100644 --- a/ClientApp/Utils/EngineConnection.cs +++ b/ClientApp/Utils/EngineConnection.cs @@ -27,7 +27,7 @@ namespace ClientApp.Utils //new PC("DESKTOP-M2CIH87", "Fabian"), //new PC("T470S", "Shinichi"), //new PC("DESKTOP-DHS478C", "semme"), - new PC("HP-ZBOOK-SEM", "Sem") + //new PC("HP-ZBOOK-SEM", "Sem") //new PC("DESKTOP-TV73FKO", "Wouter"), //new PC("DESKTOP-SINMKT1", "Ralf van Aert"), //new PC("NA", "Bart") diff --git a/DoctorApp/DoctorApp.csproj b/DoctorApp/DoctorApp.csproj index 2ff8d95..64333af 100644 --- a/DoctorApp/DoctorApp.csproj +++ b/DoctorApp/DoctorApp.csproj @@ -19,6 +19,7 @@ + diff --git a/DoctorApp/Models/Chart.cs b/DoctorApp/Models/Chart.cs new file mode 100644 index 0000000..1bab873 --- /dev/null +++ b/DoctorApp/Models/Chart.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.Serialization; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using LiveCharts; +using LiveCharts.Configurations; +using Util; + +namespace DoctorApp.Models +{ + class Chart : ObservableObject,INotifyPropertyChanged + { + + private double _axisMax; + private double _axisMin; + private double _trend; + + public event PropertyChangedEventHandler PropertyChanged; + + public ChartValues ChartValues { get; set; } + public Func DateTimeFormatter { get; set; } + + public PatientInfo PatientInfo { get; set; } + public double AxisStep { get; set; } + public double AxisUnit { get; set; } + + public double AxisMax + { + get { return _axisMax; } + set + { + _axisMax = value; + OnPropertyChanged("AxisMax"); + } + } + + public double AxisMin + { + get { return _axisMin; } + set + { + _axisMin = value; + OnPropertyChanged("AxisMin"); + } + } + + public bool IsReading { get; set; } + + + + + public Chart(PatientInfo patientInfo) + { + var mapper = Mappers.Xy() + .X(model => model.DateTime.Ticks) + .Y(model => model.Value); + + Charting.For(mapper); + + ChartValues = new ChartValues(); + + DateTimeFormatter = value => new DateTime((long)value).ToString("mm:ss"); + + AxisStep = TimeSpan.FromSeconds(1).Ticks; + + AxisUnit = TimeSpan.TicksPerSecond; + + SetAxisLimits(DateTime.Now); + + IsReading = true; + + ChartValues.Add(new MeasureModel + { + DateTime = DateTime.Now, + Value = 8 + }); + + } + + private void SetAxisLimits(DateTime now) + { + AxisMax = now.Ticks + TimeSpan.FromSeconds(1).Ticks; // lets force the axis to be 1 second ahead + AxisMin = now.Ticks - TimeSpan.FromSeconds(8).Ticks; // and 8 seconds behind + } + + protected virtual void OnPropertyChanged(string propertyName = null) + { + if (PropertyChanged != null) + PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + + public void NewValue(double value) + { + var now = DateTime.Now; + _trend = value; + ChartValues.Add(new MeasureModel + { + DateTime = now, + Value = _trend + }); + + SetAxisLimits(now); + + if (ChartValues.Count > 150) ChartValues.RemoveAt(0); + } + + public void Clear() + { + Debug.WriteLine("clear"); + ChartValues.Clear(); + } + + + + } + + public class MeasureModel + { + public DateTime DateTime { get; set; } + public double Value { get; set; } + } +} diff --git a/DoctorApp/Models/PatientInfo.cs b/DoctorApp/Models/PatientInfo.cs index c7ed295..e2ea0d0 100644 --- a/DoctorApp/Models/PatientInfo.cs +++ b/DoctorApp/Models/PatientInfo.cs @@ -10,11 +10,11 @@ namespace DoctorApp.Models public string Status { get; set; } - public int Speed { get; set; } + public double Speed { get; set; } public int BPM { get; set; } - public int Resistance { get; set; } + public float Resistance { get; set; } public int Acc_Power { get; set; } public int Curr_Power { get; set; } diff --git a/DoctorApp/Utils/Client.cs b/DoctorApp/Utils/Client.cs index bbd3674..dcb56f8 100644 --- a/DoctorApp/Utils/Client.cs +++ b/DoctorApp/Utils/Client.cs @@ -90,7 +90,7 @@ namespace DoctorApp.Utils string responseStatus = DataParser.getResponseStatus(payloadbytes); if (responseStatus == "OK") { - Debug.WriteLine("Username and password correct!"); + Debug.WriteLine("Doctor Username and password correct!"); this.LoginViewModel.setLoginStatus(true); this.connected = true; @@ -130,6 +130,9 @@ namespace DoctorApp.Utils { MainViewModel.TransferDataToClientBPM(payloadbytes); } + + totalBufferReceived -= expectedMessageLength; + expectedMessageLength = BitConverter.ToInt32(totalBuffer, 0); } this.stream.BeginRead(this.buffer, 0, this.buffer.Length, new AsyncCallback(OnRead), null); diff --git a/DoctorApp/ViewModels/ClientInfoViewModel.cs b/DoctorApp/ViewModels/ClientInfoViewModel.cs index c36f590..6a81617 100644 --- a/DoctorApp/ViewModels/ClientInfoViewModel.cs +++ b/DoctorApp/ViewModels/ClientInfoViewModel.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; +using System.Diagnostics; using System.Text; using System.Windows.Controls; using System.Windows.Input; @@ -18,6 +19,17 @@ namespace DoctorApp.ViewModels public PatientInfo PatientInfo { get; set; } public ObservableCollection ChatLog { get; set; } + private string _mySelectedItem; + public string MySelectedItem + { + get { return _mySelectedItem; } + set + { + Chart.Clear(); + _mySelectedItem = value; + } + } + public ICommand StartSession { get; set; } public ICommand StopSession { get; set; } @@ -33,10 +45,13 @@ namespace DoctorApp.ViewModels public MainWindowViewModel MainWindowViewModel { get; set; } private Client client; + public Chart Chart { get; set; } + public ClientInfoViewModel(MainWindowViewModel mainWindowViewModel, string username) { MainWindowViewModel = mainWindowViewModel; this.PatientInfo = new PatientInfo() { Username = username, Status = "Waiting to start" }; + this.Chart = new Chart(this.PatientInfo); PatientInfo.ChatLog = new ObservableCollection(); ChatLog = new ObservableCollection(); client = mainWindowViewModel.client; @@ -66,8 +81,9 @@ namespace DoctorApp.ViewModels SetResistance = new RelayCommand((parameter) => { - client.sendMessage(DataParser.getSetResistanceJson(Username, float.Parse(((TextBox)parameter).Text))); - this.Resistance = float.Parse(((TextBox)parameter).Text); + Debug.WriteLine("resistance"); + //client.sendMessage(DataParser.getSetResistanceJson(PatientInfo.Username, float.Parse(((TextBox)parameter).Text))); + PatientInfo.Resistance = float.Parse(((TextBox)parameter).Text); }); } @@ -76,7 +92,12 @@ namespace DoctorApp.ViewModels { //TODO //Parsen van de data you fuck - this.BPM = bytes[1]; + PatientInfo.BPM = bytes[1]; + if (MySelectedItem == "BPM") + { + Chart.NewValue(PatientInfo.BPM); + } + } public void BikeData(byte[] bytes) @@ -90,17 +111,20 @@ namespace DoctorApp.ViewModels { throw new Exception(); } - this.Distance = bytes[3]; - this.Speed = (bytes[4] | (bytes[5] << 8)) * 0.01; + PatientInfo.Distance = bytes[3]; + PatientInfo.Speed = (bytes[4] | (bytes[5] << 8)) * 0.01; break; case 0x19: - this.Acc_Power = bytes[3] | (bytes[4] << 8); - this.Curr_Power = (bytes[5]) | (bytes[6] & 0b00001111) << 8; + PatientInfo.Acc_Power = bytes[3] | (bytes[4] << 8); + PatientInfo.Curr_Power = (bytes[5]) | (bytes[6] & 0b00001111) << 8; break; default: throw new Exception(); } - + if (MySelectedItem == "Speed") + { + Chart.NewValue(PatientInfo.Speed); + } } diff --git a/DoctorApp/ViewModels/MainViewModel.cs b/DoctorApp/ViewModels/MainViewModel.cs index f8f7ab6..2c9f787 100644 --- a/DoctorApp/ViewModels/MainViewModel.cs +++ b/DoctorApp/ViewModels/MainViewModel.cs @@ -53,7 +53,7 @@ namespace DoctorApp.ViewModels string username = DataParser.getNameFromBytesBike(bytes); foreach(ClientInfoViewModel item in Tabs) { - if(item.Username == username) + if(item.PatientInfo.Username == username) { item.BikeData(bytes); } @@ -65,7 +65,7 @@ namespace DoctorApp.ViewModels string username = DataParser.getNameFromBytesBPM(bytes); foreach (ClientInfoViewModel item in Tabs) { - if (item.Username == username) + if (item.PatientInfo.Username == username) { item.BikeData(bytes); } diff --git a/DoctorApp/Views/ClientInfoView.xaml b/DoctorApp/Views/ClientInfoView.xaml index 9eeca60..5057f24 100644 --- a/DoctorApp/Views/ClientInfoView.xaml +++ b/DoctorApp/Views/ClientInfoView.xaml @@ -5,9 +5,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:DoctorApp.Views" mc:Ignorable="d" - d:DesignHeight="450" d:DesignWidth="800" - - > + xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" + d:DesignHeight="450" d:DesignWidth="800"> @@ -56,13 +55,35 @@ - +