From b748bcf5c8fa68df9c515b57a89a67d3a1f2cdb2 Mon Sep 17 00:00:00 2001 From: shinichi Date: Mon, 19 Oct 2020 11:19:57 +0200 Subject: [PATCH] binded commands --- DoctorApp/ViewModels/ClientInfoViewModel.cs | 6 ++++++ DoctorApp/Views/ClientInfoView.xaml | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/DoctorApp/ViewModels/ClientInfoViewModel.cs b/DoctorApp/ViewModels/ClientInfoViewModel.cs index 6b239c0..83517b1 100644 --- a/DoctorApp/ViewModels/ClientInfoViewModel.cs +++ b/DoctorApp/ViewModels/ClientInfoViewModel.cs @@ -16,6 +16,8 @@ namespace DoctorApp.ViewModels class ClientInfoViewModel : ObservableObject { public PatientInfo PatientInfo { get; set; } + public ObservableCollection ChatLog { get; set; } + public ICommand StartSession { get; set; } public ICommand StopSession { get; set; } @@ -36,24 +38,28 @@ namespace DoctorApp.ViewModels MainWindowViewModel = mainWindowViewModel; this.PatientInfo = new PatientInfo() { Username = username, Status = "Waiting to start" }; PatientInfo.ChatLog = new ObservableCollection(); + ChatLog = new ObservableCollection(); client = mainWindowViewModel.client; StartSession = new RelayCommand(() => { client.sendMessage(DataParser.getStartSessionJson(PatientInfo.Username)); PatientInfo.Status = "Session started"; + System.Diagnostics.Debug.WriteLine("patient info status" + PatientInfo.Status); }); StopSession = new RelayCommand(() => { client.sendMessage(DataParser.getStopSessionJson(PatientInfo.Username)); PatientInfo.Status = "Session stopped, waiting to start again."; + System.Diagnostics.Debug.WriteLine("patient info status" + PatientInfo.Status); }); Chat = new RelayCommand((parameter) => { client.sendMessage(DataParser.getChatJson(PatientInfo.Username, ((TextBox)parameter).Text)); PatientInfo.ChatLog.Add(DateTime.Now + ": " + ((TextBox)parameter).Text); + ChatLog.Add(DateTime.Now + ":derp: " + ((TextBox)parameter).Text); }); //TODO RelayCommand ChatToAll diff --git a/DoctorApp/Views/ClientInfoView.xaml b/DoctorApp/Views/ClientInfoView.xaml index b5b11cc..9eeca60 100644 --- a/DoctorApp/Views/ClientInfoView.xaml +++ b/DoctorApp/Views/ClientInfoView.xaml @@ -57,11 +57,11 @@ -