Merge remote-tracking branch 'origin/develop' into dataOnTabs

This commit is contained in:
fabjuuuh
2020-10-19 14:05:55 +02:00
15 changed files with 206 additions and 61 deletions

View File

@@ -17,7 +17,6 @@ namespace DoctorApp.ViewModels
class ClientInfoViewModel : ObservableObject
{
public PatientInfo PatientInfo { get; set; }
public ObservableCollection<string> ChatLog { get; set; }
private string _mySelectedItem;
public string MySelectedItem
@@ -53,28 +52,24 @@ namespace DoctorApp.ViewModels
this.PatientInfo = new PatientInfo() { Username = username, Status = "Waiting to start" };
this.Chart = new Chart(this.PatientInfo);
PatientInfo.ChatLog = new ObservableCollection<string>();
ChatLog = new ObservableCollection<string>();
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<object>((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

View File

@@ -3,7 +3,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Security.Cryptography;
using System.Diagnostics;
using System.Text;
using System.Windows.Controls;
using Util;
@@ -27,6 +27,7 @@ namespace DoctorApp.ViewModels
public void NewConnectedUser(string username)
{
Debug.WriteLine("new tab with name " + username);
App.Current.Dispatcher.Invoke((Action)delegate
{
Tabs.Add(new ClientInfoViewModel(MainWindowViewModel, username));