diff --git a/Sledgemapper/Sledgemapper.cs b/Sledgemapper/Sledgemapper.cs index 6e5bdfd..0ac6e41 100644 --- a/Sledgemapper/Sledgemapper.cs +++ b/Sledgemapper/Sledgemapper.cs @@ -570,13 +570,17 @@ namespace Sledgemapper if (!isValid) { + localContent.LblLoginError.Text="Username or password is not valid"; + localContent.LblLoginError.Visible=true; + return; } var successful = false; try { - + localContent.LblLoginError.Text=""; + localContent.LblLoginError.Visible=false; _authResponse = await _communicationManager.Login(new AuthenticateModel { Username = localContent.TxtEmail.Text, @@ -587,6 +591,8 @@ namespace Sledgemapper catch (Exception ex) { Console.WriteLine(ex.Message); + localContent.LblLoginError.Text=ex.Message; + localContent.LblLoginError.Visible=true; } if (successful) diff --git a/Sledgemapper/UI/LoginRegisterWindow.Generated.cs b/Sledgemapper/UI/LoginRegisterWindow.Generated.cs index 43a48d1..4fbfe7f 100644 --- a/Sledgemapper/UI/LoginRegisterWindow.Generated.cs +++ b/Sledgemapper/UI/LoginRegisterWindow.Generated.cs @@ -1,4 +1,4 @@ -/* Generated by MyraPad at 10/11/2020 11:32:04 */ +/* Generated by MyraPad at 18/11/2020 16:11:22 */ using Myra.Graphics2D; using Myra.Graphics2D.TextureAtlases; using Myra.Graphics2D.UI; @@ -124,8 +124,21 @@ namespace Sledgemapper.UI BtnRegister.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; BtnRegister.Id = "BtnRegister"; + LblLoginError = new Label(); + LblLoginError.Text = "Email"; + LblLoginError.TextColor = new Color + { + B = 48, + G = 57, + R = 254, + A = 255, + }; + LblLoginError.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; + LblLoginError.Visible = false; + LblLoginError.Id = "LblLoginError"; + - Spacing = 16; + Spacing = 13; HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; Width = 400; @@ -134,6 +147,7 @@ namespace Sledgemapper.UI Widgets.Add(grid1); Widgets.Add(BtnLogin); Widgets.Add(BtnRegister); + Widgets.Add(LblLoginError); } @@ -149,5 +163,6 @@ namespace Sledgemapper.UI public TextBox TxtInitials; public TextButton BtnLogin; public TextButton BtnRegister; + public Label LblLoginError; } } \ No newline at end of file diff --git a/Sledgemapper/UI/loginwindow.xml b/Sledgemapper/UI/loginwindow.xml index a8559ec..4d5c13b 100644 --- a/Sledgemapper/UI/loginwindow.xml +++ b/Sledgemapper/UI/loginwindow.xml @@ -1,6 +1,6 @@ - + @@ -22,6 +22,7 @@ - + + \ No newline at end of file