diff --git a/ClientApp/Utils/Client.cs b/ClientApp/Utils/Client.cs index 8dd0ad1..ab0cc91 100644 --- a/ClientApp/Utils/Client.cs +++ b/ClientApp/Utils/Client.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using System.Net.Sockets; using System.Text; @@ -121,14 +122,15 @@ namespace ClientApp.Utils string responseStatus = DataParser.getResponseStatus(payloadbytes); if (responseStatus == "OK") { - Console.WriteLine("Username and password correct!"); + Debug.WriteLine("Username and password correct!"); this.LoginViewModel.setLoginStatus(true); this.connected = true; initEngine(); } else { - Console.WriteLine($"login failed \"{responseStatus}\""); + this.LoginViewModel.setLoginStatus(false); + Debug.WriteLine($"login failed \"{responseStatus}\""); } break; case DataParser.START_SESSION: diff --git a/ClientApp/ViewModels/LoginViewModel.cs b/ClientApp/ViewModels/LoginViewModel.cs index c714b3c..a5e9d26 100644 --- a/ClientApp/ViewModels/LoginViewModel.cs +++ b/ClientApp/ViewModels/LoginViewModel.cs @@ -13,6 +13,8 @@ namespace ClientApp.ViewModels class LoginViewModel : ObservableObject { public string Username { get; set; } + public ICommand LoginCommand { get; set; } + public bool LoginStatus { get; set; } private MainWindowViewModel mainWindowViewModel; public LoginViewModel(MainWindowViewModel mainWindowViewModel) { @@ -24,11 +26,12 @@ namespace ClientApp.ViewModels }); } - public ICommand LoginCommand { get; set; } + internal void setLoginStatus(bool status) { - this.mainWindowViewModel.InfoModel.ConnectedToServer = true; + this.mainWindowViewModel.InfoModel.ConnectedToServer = status; + this.LoginStatus = status; if (status) { this.mainWindowViewModel.SelectedViewModel = new MainViewModel(mainWindowViewModel); diff --git a/ClientApp/Views/LoginView.xaml b/ClientApp/Views/LoginView.xaml index 81ea950..ce7bc94 100644 --- a/ClientApp/Views/LoginView.xaml +++ b/ClientApp/Views/LoginView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:ClientApp.Views" + xmlns:viewModels="clr-namespace:ClientApp.ViewModels" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> @@ -13,6 +14,10 @@