Develop #10
@@ -9,11 +9,11 @@
|
|||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<DataTemplate DataType="{x:Type viewModels:MainViewModel}">
|
<DataTemplate DataType="{x:Type viewModels:MainViewModel}">
|
||||||
<views:MainView />
|
<views:MainView />
|
||||||
<!-- This is a UserControl -->
|
<!-- This is a Page -->
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate DataType="{x:Type viewModels:LoginViewModel}">
|
<DataTemplate DataType="{x:Type viewModels:LoginViewModel}">
|
||||||
<views:LoginView />
|
<views:LoginView />
|
||||||
<!-- This is a UserControl -->
|
<!-- This is a Page -->
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate DataType="{x:Type viewModels:ClientInfoViewModel}">
|
<DataTemplate DataType="{x:Type viewModels:ClientInfoViewModel}">
|
||||||
<views:ClientInfoView/>
|
<views:ClientInfoView/>
|
||||||
|
|||||||
@@ -111,7 +111,6 @@ namespace DoctorApp.Utils
|
|||||||
Console.WriteLine("Set resistance identifier");
|
Console.WriteLine("Set resistance identifier");
|
||||||
break;
|
break;
|
||||||
case DataParser.NEW_CONNECTION:
|
case DataParser.NEW_CONNECTION:
|
||||||
Debug.WriteLine("doctor client new connection");
|
|
||||||
this.MainViewModel.NewConnectedUser(DataParser.getUsernameFromResponseJson(payloadbytes));
|
this.MainViewModel.NewConnectedUser(DataParser.getUsernameFromResponseJson(payloadbytes));
|
||||||
break;
|
break;
|
||||||
case DataParser.DISCONNECT:
|
case DataParser.DISCONNECT:
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ namespace DoctorApp.ViewModels
|
|||||||
class ClientInfoViewModel : ObservableObject
|
class ClientInfoViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
public PatientInfo PatientInfo { get; set; }
|
public PatientInfo PatientInfo { get; set; }
|
||||||
public ObservableCollection<string> ChatLog { get; set; }
|
|
||||||
|
|
||||||
public ICommand StartSession { get; set; }
|
public ICommand StartSession { get; set; }
|
||||||
|
|
||||||
@@ -38,28 +37,24 @@ namespace DoctorApp.ViewModels
|
|||||||
MainWindowViewModel = mainWindowViewModel;
|
MainWindowViewModel = mainWindowViewModel;
|
||||||
this.PatientInfo = new PatientInfo() { Username = username, Status = "Waiting to start" };
|
this.PatientInfo = new PatientInfo() { Username = username, Status = "Waiting to start" };
|
||||||
PatientInfo.ChatLog = new ObservableCollection<string>();
|
PatientInfo.ChatLog = new ObservableCollection<string>();
|
||||||
ChatLog = new ObservableCollection<string>();
|
|
||||||
client = mainWindowViewModel.client;
|
client = mainWindowViewModel.client;
|
||||||
|
|
||||||
StartSession = new RelayCommand(() =>
|
StartSession = new RelayCommand(() =>
|
||||||
{
|
{
|
||||||
client.sendMessage(DataParser.getStartSessionJson(PatientInfo.Username));
|
client.sendMessage(DataParser.getStartSessionJson(PatientInfo.Username));
|
||||||
PatientInfo.Status = "Session started";
|
PatientInfo.Status = "Session started";
|
||||||
System.Diagnostics.Debug.WriteLine("patient info status" + PatientInfo.Status);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
StopSession = new RelayCommand(() =>
|
StopSession = new RelayCommand(() =>
|
||||||
{
|
{
|
||||||
client.sendMessage(DataParser.getStopSessionJson(PatientInfo.Username));
|
client.sendMessage(DataParser.getStopSessionJson(PatientInfo.Username));
|
||||||
PatientInfo.Status = "Session stopped, waiting to start again.";
|
PatientInfo.Status = "Session stopped, waiting to start again.";
|
||||||
System.Diagnostics.Debug.WriteLine("patient info status" + PatientInfo.Status);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Chat = new RelayCommand<object>((parameter) =>
|
Chat = new RelayCommand<object>((parameter) =>
|
||||||
{
|
{
|
||||||
client.sendMessage(DataParser.getChatJson(PatientInfo.Username, ((TextBox)parameter).Text));
|
client.sendMessage(DataParser.getChatJson(PatientInfo.Username, ((TextBox)parameter).Text));
|
||||||
PatientInfo.ChatLog.Add(DateTime.Now + ": " + ((TextBox)parameter).Text);
|
PatientInfo.ChatLog.Add(DateTime.Now + ": " + ((TextBox)parameter).Text);
|
||||||
ChatLog.Add(DateTime.Now + ":derp: " + ((TextBox)parameter).Text);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO RelayCommand ChatToAll
|
//TODO RelayCommand ChatToAll
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using Util;
|
using Util;
|
||||||
@@ -26,6 +27,7 @@ namespace DoctorApp.ViewModels
|
|||||||
|
|
||||||
public void NewConnectedUser(string username)
|
public void NewConnectedUser(string username)
|
||||||
{
|
{
|
||||||
|
Debug.WriteLine("new tab with name " + username);
|
||||||
App.Current.Dispatcher.Invoke((Action)delegate
|
App.Current.Dispatcher.Invoke((Action)delegate
|
||||||
{
|
{
|
||||||
Tabs.Add(new ClientInfoViewModel(MainWindowViewModel, username));
|
Tabs.Add(new ClientInfoViewModel(MainWindowViewModel, username));
|
||||||
|
|||||||
Reference in New Issue
Block a user