usability

This commit is contained in:
Michele Scandura 2020-11-18 22:48:44 +00:00
parent a5d57893c4
commit 19f1084d5f
3 changed files with 27 additions and 5 deletions

View file

@ -570,13 +570,17 @@ namespace Sledgemapper
if (!isValid) if (!isValid)
{ {
localContent.LblLoginError.Text="Username or password is not valid";
localContent.LblLoginError.Visible=true;
return; return;
} }
var successful = false; var successful = false;
try try
{ {
localContent.LblLoginError.Text="";
localContent.LblLoginError.Visible=false;
_authResponse = await _communicationManager.Login(new AuthenticateModel _authResponse = await _communicationManager.Login(new AuthenticateModel
{ {
Username = localContent.TxtEmail.Text, Username = localContent.TxtEmail.Text,
@ -587,6 +591,8 @@ namespace Sledgemapper
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex.Message); Console.WriteLine(ex.Message);
localContent.LblLoginError.Text=ex.Message;
localContent.LblLoginError.Visible=true;
} }
if (successful) if (successful)

View file

@ -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;
using Myra.Graphics2D.TextureAtlases; using Myra.Graphics2D.TextureAtlases;
using Myra.Graphics2D.UI; using Myra.Graphics2D.UI;
@ -124,8 +124,21 @@ namespace Sledgemapper.UI
BtnRegister.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; BtnRegister.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
BtnRegister.Id = "BtnRegister"; 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; HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
Width = 400; Width = 400;
@ -134,6 +147,7 @@ namespace Sledgemapper.UI
Widgets.Add(grid1); Widgets.Add(grid1);
Widgets.Add(BtnLogin); Widgets.Add(BtnLogin);
Widgets.Add(BtnRegister); Widgets.Add(BtnRegister);
Widgets.Add(LblLoginError);
} }
@ -149,5 +163,6 @@ namespace Sledgemapper.UI
public TextBox TxtInitials; public TextBox TxtInitials;
public TextButton BtnLogin; public TextButton BtnLogin;
public TextButton BtnRegister; public TextButton BtnRegister;
public Label LblLoginError;
} }
} }

View file

@ -1,6 +1,6 @@
<Project> <Project>
<Project.ExportOptions Namespace="Sledgemapper.UI" Class="LoginRegisterWindow" OutputPath="C:\dev\Map\Sledgemapper\UI" /> <Project.ExportOptions Namespace="Sledgemapper.UI" Class="LoginRegisterWindow" OutputPath="C:\dev\Map\Sledgemapper\UI" />
<VerticalStackPanel Spacing="16" HorizontalAlignment="Center" VerticalAlignment="Center" Width="400" Padding="10"> <VerticalStackPanel Spacing="13" HorizontalAlignment="Center" VerticalAlignment="Center" Width="400" Padding="10">
<HorizontalStackPanel Spacing="18" HorizontalAlignment="Center"> <HorizontalStackPanel Spacing="18" HorizontalAlignment="Center">
<RadioButton Text=" Login" Id="RdoLogin" /> <RadioButton Text=" Login" Id="RdoLogin" />
<RadioButton Text=" Register" Id="RdoRegister" /> <RadioButton Text=" Register" Id="RdoRegister" />
@ -22,6 +22,7 @@
<TextBox GridColumn="1" GridRow="4" Visible="False" Id="TxtInitials" /> <TextBox GridColumn="1" GridRow="4" Visible="False" Id="TxtInitials" />
</Grid> </Grid>
<TextButton Text="Login" Width="70" Height="20" Padding="5" HorizontalAlignment="Center" Id="BtnLogin" /> <TextButton Text="Login" Width="70" Height="20" Padding="5" HorizontalAlignment="Center" Id="BtnLogin" />
<TextButton Text="Register" Width="70" Height="20" Padding="5" HorizontalAlignment="Center" Id="BtnRegister" Visible="False"/> <TextButton Text="Register" Visible="False" Width="70" Height="20" Padding="5" HorizontalAlignment="Center" Id="BtnRegister" />
<Label Text="Email" TextColor="#FE3930FF" HorizontalAlignment="Center" Visible="False" Id="LblLoginError" />
</VerticalStackPanel> </VerticalStackPanel>
</Project> </Project>