From 173dbf2745ff6f2cdbab0af7d77ffb056f718bbf Mon Sep 17 00:00:00 2001 From: fabjuuuh Date: Fri, 16 Oct 2020 15:02:26 +0200 Subject: [PATCH] update --- ClientApp/Utils/Client.cs | 9 +++---- ClientApp/ViewModels/MainWindowViewModel.cs | 2 +- DoctorApp/Utils/Client.cs | 2 +- DoctorApp/ViewModels/ClientInfoViewModel.cs | 5 ---- DoctorApp/Views/ClientInfoView.xaml | 1 - DoctorApp/Views/MainWindow.xaml | 3 +++ Server/Client.cs | 15 +++++++++--- Server/Communication.cs | 26 ++++++++++++++++++++- 8 files changed, 47 insertions(+), 16 deletions(-) diff --git a/ClientApp/Utils/Client.cs b/ClientApp/Utils/Client.cs index 963c1d3..2ce0036 100644 --- a/ClientApp/Utils/Client.cs +++ b/ClientApp/Utils/Client.cs @@ -135,17 +135,17 @@ namespace ClientApp.Utils Debug.WriteLine($"login failed \"{responseStatus}\""); } break; - /*case DataParser.START_SESSION: + case DataParser.START_SESSION: Console.WriteLine("Session started!"); this.sessionRunning = true; if (engineConnection.Connected && !engineConnection.FollowingRoute) engineConnection.StartRouteFollow(); - sendMessage(DataParser.getStartSessionJson()); + Debug.WriteLine("start"); break; case DataParser.STOP_SESSION: Console.WriteLine("Stop session identifier"); this.sessionRunning = false; - sendMessage(DataParser.getStopSessionJson()); - break;*/ + Debug.WriteLine("stop"); + break; case DataParser.SET_RESISTANCE: Console.WriteLine("Set resistance identifier"); if (this.handler == null) @@ -297,6 +297,7 @@ namespace ClientApp.Utils public void Dispose() { Debug.WriteLine("client dispose called"); + sendMessage(DataParser.getDisconnectJson(LoginViewModel.Username)); this.stream.Dispose(); this.client.Dispose(); this.handler.stop(); diff --git a/ClientApp/ViewModels/MainWindowViewModel.cs b/ClientApp/ViewModels/MainWindowViewModel.cs index cdb15a7..5bcc936 100644 --- a/ClientApp/ViewModels/MainWindowViewModel.cs +++ b/ClientApp/ViewModels/MainWindowViewModel.cs @@ -108,7 +108,7 @@ namespace ClientApp.ViewModels this.InfoModel = new Info(); this.client = client; - loginViewModel = new LoginViewModel(this); + LoginViewModel loginViewModel = new LoginViewModel(this); SelectedViewModel = loginViewModel; this.client.SetLoginViewModel(loginViewModel); diff --git a/DoctorApp/Utils/Client.cs b/DoctorApp/Utils/Client.cs index 8210140..5ddc8c3 100644 --- a/DoctorApp/Utils/Client.cs +++ b/DoctorApp/Utils/Client.cs @@ -240,7 +240,7 @@ namespace DoctorApp.Utils string hashPassword = Util.Hasher.HashString(password); - byte[] message = DataParser.getJsonMessage(DataParser.GetLoginJson(hashUser, hashPassword)); + byte[] message = DataParser.getJsonMessage(DataParser.GetLoginJson(username, hashPassword)); this.stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null); diff --git a/DoctorApp/ViewModels/ClientInfoViewModel.cs b/DoctorApp/ViewModels/ClientInfoViewModel.cs index 6f4e2ae..c40f6ea 100644 --- a/DoctorApp/ViewModels/ClientInfoViewModel.cs +++ b/DoctorApp/ViewModels/ClientInfoViewModel.cs @@ -69,11 +69,6 @@ namespace DoctorApp.ViewModels //TODO RelayCommand ChatToAll - ClientInfo = new RelayCommand(() => - { - //TODO POPUP - }); - SetResistance = new RelayCommand((parameter) => { client.sendMessage(DataParser.getSetResistanceJson(Username, float.Parse(((TextBox)parameter).Text))); diff --git a/DoctorApp/Views/ClientInfoView.xaml b/DoctorApp/Views/ClientInfoView.xaml index 8dcc068..33a0c12 100644 --- a/DoctorApp/Views/ClientInfoView.xaml +++ b/DoctorApp/Views/ClientInfoView.xaml @@ -63,6 +63,5 @@