added status

This commit is contained in:
shinichi
2020-10-07 16:31:44 +02:00
parent d7dfe32cc3
commit 91bb0d65b7
5 changed files with 75 additions and 29 deletions

View File

@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using ClientApp.Utils;
namespace ClientApp.Models
{
class ClientInfo : ObservableObject
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
}

14
ClientApp/Models/Info.cs Normal file
View File

@@ -0,0 +1,14 @@
using ClientApp.Utils;
using System;
using System.Collections.Generic;
using System.Text;
namespace ClientApp.Models
{
class Info : ObservableObject
{
public bool ConnectedToServer { get; set; }
public bool ConnectedToVREngine { get; set; }
public bool DoctorConnected { get; set; }
}
}

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using ClientApp.Utils; using ClientApp.Utils;
@@ -12,15 +13,15 @@ namespace ClientApp.ViewModels
class LoginViewModel : ObservableObject class LoginViewModel : ObservableObject
{ {
public string Username { get; set; } public string Username { get; set; }
//private MainWindowViewModel mainWindowViewModel; private MainWindowViewModel mainWindowViewModel;
public LoginViewModel(MainWindowViewModel mainWindowViewModel) public LoginViewModel(MainWindowViewModel mainWindowViewModel)
{ {
//this.mainWindowViewModel = mainWindowViewModel; this.mainWindowViewModel = mainWindowViewModel;
LoginCommand = new RelayCommand<object>((parameter) => LoginCommand = new RelayCommand<object>((parameter) =>
{ {
Debug.WriteLine($"username {Username} password {((PasswordBox)parameter).Password}"); Debug.WriteLine($"username {Username} password {((PasswordBox)parameter).Password}");
//TODO send username and password to server //TODO send username and password to server
mainWindowViewModel.SelectedViewModel = new MainViewModel(); this.mainWindowViewModel.SelectedViewModel = new MainViewModel();
}); });
} }

View File

@@ -1,17 +1,29 @@
using ClientApp.Utils; using ClientApp.Models;
using System; using ClientApp.Utils;
using System.Collections.Generic; using GalaSoft.MvvmLight.Command;
using System.Text; using System.Windows.Input;
namespace ClientApp.ViewModels namespace ClientApp.ViewModels
{ {
class MainViewModel : ObservableObject class MainViewModel : ObservableObject
{ {
public string StatusLabelText { get; set; } public Info infoModel { get; set; }
public ICommand RetryServerCommand { get; set; }
public ICommand RetryVREngineCommand { get; set; }
public MainViewModel() public MainViewModel()
{ {
StatusLabelText = "Status: not running"; this.infoModel = new Info();
this.RetryServerCommand = new RelayCommand(() =>
{
//try connect server
this.infoModel.ConnectedToServer = true;
});
this.RetryVREngineCommand = new RelayCommand(() =>
{
//try connect vr-engine
this.infoModel.ConnectedToVREngine = true;
});
} }
} }
} }

View File

@@ -7,14 +7,46 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<DockPanel> <DockPanel>
<StackPanel Orientation="Horizontal"> <Grid>
<Label> <Grid.ColumnDefinitions>
<Label.Content> <ColumnDefinition Width="*"/>
<AccessText TextWrapping="Wrap" Text="{Binding StatusLabelText}"/> <ColumnDefinition Width="*"/>
</Label.Content> <ColumnDefinition Width="*"/>
</Label> </Grid.ColumnDefinitions>
</StackPanel> <Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Grid.Column="0" Grid.Row="0" Orientation="Horizontal" Margin="10">
<Label Content="Connected to server:"/>
<Label Content="{Binding Path=infoModel.ConnectedToServer}"/>
</StackPanel>
<StackPanel Grid.Column="1" Grid.Row="0" Orientation="Horizontal" Margin="10">
<Label Content="Connected to VR-Engine:"/>
<Label Content="{Binding Path=infoModel.ConnectedToVREngine}"/>
</StackPanel>
<StackPanel Grid.Column="2" Grid.Row="0" Orientation="Horizontal" Margin="10">
<Label Content="Doctor connected:"/>
<Label Content="{Binding Path=infoModel.DoctorConnected}"/>
</StackPanel>
<Button Grid.Column="0" Grid.Row="1" Command="{Binding RetryServerCommand}" Width="50" Height="20">
<Button.Content>
<TextBlock TextWrapping="Wrap" Text="retry"/>
</Button.Content>
</Button>
<Button Grid.Column="1" Grid.Row="1" Command="{Binding RetryVREngineCommand}" Width="50" Height="20">
<Button.Content>
<TextBlock TextWrapping="Wrap" Text="retry"/>
</Button.Content>
</Button>
</Grid>
</DockPanel> </DockPanel>
</UserControl> </UserControl>