Develop #10

Merged
SemvdH merged 229 commits from develop into master 2020-10-29 22:50:49 +00:00
2 changed files with 10 additions and 4 deletions
Showing only changes of commit b748bcf5c8 - Show all commits

View File

@@ -16,6 +16,8 @@ namespace DoctorApp.ViewModels
class ClientInfoViewModel : ObservableObject
{
public PatientInfo PatientInfo { get; set; }
public ObservableCollection<string> 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<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

@@ -57,11 +57,11 @@
</StackPanel>
<ListBox Name="ChatBox" ItemsSource="{Binding PatientInfo.ChatLog}" Grid.Column="1" Margin="59,41,0,0" Grid.RowSpan="3"/>
<TextBox Name="textBox_Chat" Grid.Column="1" HorizontalAlignment="Left" Margin="59,10,0,0" Grid.Row="3" Text="TextBox" TextWrapping="Wrap" VerticalAlignment="Top" Width="235"/>
<Button x:Name="Send" Content="Send" Grid.Column="1" HorizontalAlignment="Left" Margin="59,33,0,0" Grid.Row="3" VerticalAlignment="Top" Command="{Binding PatientInfo.Chat}" CommandParameter="{Binding ElementName=textBox_Chat}"/>
<Button Content="Start Session" Grid.Column="1" HorizontalAlignment="Left" Margin="69,86,0,0" Grid.Row="3" VerticalAlignment="Top" Width="97" Command="{Binding PatientInfo.StartSession}" CommandParameter=""/>
<Button Content="Stop Session" Grid.Column="1" HorizontalAlignment="Left" Margin="187,86,0,0" Grid.Row="3" VerticalAlignment="Top" Width="97" Command="{Binding PatientInfo.StopSession}" CommandParameter=""/>
<Button x:Name="Send" Content="Send" Grid.Column="1" HorizontalAlignment="Left" Margin="59,33,0,0" Grid.Row="3" VerticalAlignment="Top" Command="{Binding Chat}" CommandParameter="{Binding ElementName=textBox_Chat}"/>
<Button Content="Start Session" Grid.Column="1" HorizontalAlignment="Left" Margin="69,86,0,0" Grid.Row="3" VerticalAlignment="Top" Width="97" Command="{Binding StartSession}" CommandParameter=""/>
<Button Content="Stop Session" Grid.Column="1" HorizontalAlignment="Left" Margin="187,86,0,0" Grid.Row="3" VerticalAlignment="Top" Width="97" Command="{Binding StopSession}" CommandParameter=""/>
<TextBox x:Name="textBox_SetResistance" Grid.Column="1" HorizontalAlignment="Left" Margin="69,128,0,0" Grid.Row="3" TextWrapping="Wrap" VerticalAlignment="Top" Width="97"/>
<Button Content="Set Resistance" Grid.Column="1" HorizontalAlignment="Left" Margin="187,128,0,0" Grid.Row="3" VerticalAlignment="Top" Width="97" Height="18" Command="{Binding PatientInfo.SetResistance}" CommandParameter="{Binding ElementName=textBox_SetResistance}"/>
<Button Content="Set Resistance" Grid.Column="1" HorizontalAlignment="Left" Margin="187,128,0,0" Grid.Row="3" VerticalAlignment="Top" Width="97" Height="18" Command="{Binding SetResistance}" CommandParameter="{Binding ElementName=textBox_SetResistance}"/>
<Canvas Grid.Row="3" Background="White" Margin="0,33,0,0"/>
<ComboBox Name="DropBox" HorizontalAlignment="Left" Margin="0,6,0,0" Grid.Row="3" VerticalAlignment="Top" Width="190"/>
</Grid>