Merge remote-tracking branch 'origin/develop' into dataOnTabs
This commit is contained in:
@@ -9,11 +9,11 @@
|
||||
<ResourceDictionary>
|
||||
<DataTemplate DataType="{x:Type viewModels:MainViewModel}">
|
||||
<views:MainView />
|
||||
<!-- This is a UserControl -->
|
||||
<!-- This is a Page -->
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewModels:LoginViewModel}">
|
||||
<views:LoginView />
|
||||
<!-- This is a UserControl -->
|
||||
<!-- This is a Page -->
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewModels:ClientInfoViewModel}">
|
||||
<views:ClientInfoView/>
|
||||
|
||||
@@ -9,12 +9,16 @@
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="img\doctor.ico" />
|
||||
<None Remove="img\patient.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="img\doctor.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="img\patient.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -111,11 +111,10 @@ namespace DoctorApp.Utils
|
||||
Console.WriteLine("Set resistance identifier");
|
||||
break;
|
||||
case DataParser.NEW_CONNECTION:
|
||||
Debug.WriteLine("doctor client new connection");
|
||||
this.MainViewModel.NewConnectedUser(DataParser.getUsernameFromResponseJson(payloadbytes));
|
||||
this.MainViewModel.NewConnectedUser(DataParser.getUsernameFromJson(payloadbytes));
|
||||
break;
|
||||
case DataParser.DISCONNECT:
|
||||
this.MainViewModel.DisconnectedUser(DataParser.getUsernameFromResponseJson(payloadbytes));
|
||||
this.MainViewModel.DisconnectedUser(DataParser.getUsernameFromJson(payloadbytes));
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine($"Received json with identifier {identifier}:\n{Encoding.ASCII.GetString(payloadbytes)}");
|
||||
@@ -135,6 +134,8 @@ namespace DoctorApp.Utils
|
||||
expectedMessageLength = BitConverter.ToInt32(totalBuffer, 0);
|
||||
}
|
||||
|
||||
if (ar == null || (!ar.IsCompleted) || (!this.stream.CanRead) || !this.client.Connected)
|
||||
return;
|
||||
this.stream.BeginRead(this.buffer, 0, this.buffer.Length, new AsyncCallback(OnRead), null);
|
||||
|
||||
}
|
||||
@@ -197,6 +198,7 @@ namespace DoctorApp.Utils
|
||||
public void Dispose()
|
||||
{
|
||||
Debug.WriteLine("client dispose called");
|
||||
sendMessage(DataParser.getDisconnectJson(LoginViewModel.Username));
|
||||
this.stream.Dispose();
|
||||
this.client.Dispose();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
<TabControl TabStripPlacement="Left" ItemsSource="{Binding Tabs}" SelectedItem="{Binding Selected}">
|
||||
<TabControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding PatientInfo.Username}"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Source="/img/patient.png" Width="25" Margin="0 0 5 0"/>
|
||||
<TextBlock Text="{Binding PatientInfo.Username}" FontSize="20" MaxWidth="100" Width="100" TextTrimming="CharacterEllipsis"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</TabControl.ItemTemplate>
|
||||
<TabControl.ContentTemplate>
|
||||
|
||||
BIN
DoctorApp/img/patient.png
Normal file
BIN
DoctorApp/img/patient.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Reference in New Issue
Block a user