login flow

This commit is contained in:
Michele Scandura 2020-11-10 12:14:21 +00:00
parent 886d2a88b0
commit 194f3cbffa
22 changed files with 642 additions and 141 deletions

View file

@ -64,6 +64,7 @@ namespace WebApi.Controllers
Username = user.Username,
FirstName = user.FirstName,
LastName = user.LastName,
Initials = user.Initials,
Token = tokenString
});
}

View file

@ -6,6 +6,7 @@ namespace WebApi.Entities
public string FirstName { get; set; }
public string LastName { get; set; }
public string Username { get; set; }
public string Initials { get; set; }
public byte[] PasswordHash { get; set; }
public byte[] PasswordSalt { get; set; }
}

Binary file not shown.

View file

@ -30,6 +30,9 @@ namespace WebApi.Migrations.SqliteMigrations
b.Property<string>("LastName")
.HasColumnType("TEXT");
b.Property<string>("Initials")
.HasColumnType("TEXT");
b.Property<byte[]>("PasswordHash")
.HasColumnType("BLOB");

View file

@ -16,6 +16,7 @@ namespace WebApi.Migrations.SqliteMigrations
FirstName = table.Column<string>(nullable: true),
LastName = table.Column<string>(nullable: true),
Username = table.Column<string>(nullable: true),
Initials = table.Column<string>(nullable: true),
PasswordHash = table.Column<byte[]>(nullable: true),
PasswordSalt = table.Column<byte[]>(nullable: true)
},

View file

@ -28,6 +28,9 @@ namespace WebApi.Migrations.SqliteMigrations
b.Property<string>("LastName")
.HasColumnType("TEXT");
b.Property<string>("Initials")
.HasColumnType("TEXT");
b.Property<byte[]>("PasswordHash")
.HasColumnType("BLOB");

View file

@ -15,5 +15,8 @@ namespace WebApi.Models.Users
[Required]
public string Password { get; set; }
[Required]
public string Initials { get; set; }
}
}

View file

@ -6,5 +6,6 @@ namespace WebApi.Models.Users
public string FirstName { get; set; }
public string LastName { get; set; }
public string Username { get; set; }
public string Initials { get; set; }
}
}

View file

@ -12,42 +12,42 @@ namespace Sledgemapper.Api.Data
context.Database.EnsureCreated();
}
}
public class MyDbContext : DbContext
{
public DbSet<MapLog> MapLogs { get; set; }
public MyDbContext(DbContextOptions options):base(options)
{
ChangeTracker.QueryTrackingBehavior=QueryTrackingBehavior.NoTracking;
}
public class MyDbContext : DbContext
{
public DbSet<MapLog> MapLogs { get; set; }
public MyDbContext(DbContextOptions options) : base(options)
{
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
{
// optionsBuilder.
// options.MigrationsAssembly(Assembly.GetExecutingAssembly().FullName);
// optionsBuilder.UseSqlite("Filename=SledgemapperDatabase.db", options =>
// {
// options.MigrationsAssembly(Assembly.GetExecutingAssembly().FullName);
// });
optionsBuilder.UseSqlite("Filename=MyDatabase.db");
optionsBuilder.UseSqlite("Filename=MyDatabase.db").UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
base.OnConfiguring(optionsBuilder);
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// Map table names
modelBuilder.Entity<MapLog>().ToTable("MapLog", "dbo");
modelBuilder.Entity<MapLog>(entity =>
{
entity.HasKey(e => e.MapLogId);
{
// Map table names
modelBuilder.Entity<MapLog>().ToTable("MapLog", "dbo");
modelBuilder.Entity<MapLog>(entity =>
{
entity.HasKey(e => e.MapLogId);
//entity.HasIndex(e => {e.SessionName, e.Timestamp});
});
base.OnModelCreating(modelBuilder);
}
}
}
}
}

View file

@ -0,0 +1,13 @@
using System.ComponentModel.DataAnnotations;
namespace Sledgemapper.Shared.Entities
{
public class AuthenticateModel
{
[Required]
public string Username { get; set; }
[Required]
public string Password { get; set; }
}
}

View file

@ -0,0 +1,11 @@
namespace Sledgemapper.Shared.Entities
{
public class AuthenticateResponse
{
public string Id { get; set; }
public string Username { get; set; }
public string Firstname { get; set; }
public string LastName { get; set; }
public string Token { get; set; }
}
}

View file

@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
namespace Sledgemapper.Shared.Entities
{
public class RegisterModel
{
[Required]
public string FirstName { get; set; }
[Required]
public string LastName { get; set; }
[Required]
public string Username { get; set; }
[Required]
public string Password { get; set; }
[Required]
public string Initials { get; set; }
}
}

View file

@ -10,6 +10,7 @@
{
return $"{X}_{Y}";
}
public double Timestamp {get;set;}
}
public class Tile :BaseMapEntity

View file

@ -0,0 +1,20 @@
using Refit;
using Sledgemapper.Shared.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace Sledgemapper
{
public interface IIdentityApi
{
[Post("/users/register")]
Task<HttpResponseMessage> Register([Body] RegisterModel registerModel);
[Post("/users/authenticate")]
Task<AuthenticateResponse> Authenticate([Body] AuthenticateModel registerModel);
}
}

Binary file not shown.

View file

@ -13,6 +13,10 @@ using System.IO;
using System.Linq;
using System;
using Sledgemapper.Shared.Entities;
using Sledgemapper.UI;
using System.Net;
using System.Net.Http;
using Refit;
namespace Sledgemapper
{
@ -56,6 +60,7 @@ namespace Sledgemapper
var menuFileLoad = new MenuItem("_file_load", "Load");
var menuFileSave = new MenuItem("_file_save", "Save");
var menuConnect = new MenuItem("_connect", "Connect");
var menuConnectLogin = new MenuItem("_connect_login", "Login");
var menuConnectNew = new MenuItem("_connect_new", "New");
var menuConnectJoin = new MenuItem("_connect_join", "Join");
var menuConnectSync = new MenuItem("_connect_sync", "Sync");
@ -63,9 +68,11 @@ namespace Sledgemapper
menuConnectSync.Selected += OnMenuConnectSyncSelected;
menuFileLoad.Selected += OnMenuFileLoadSelected;
menuFileSave.Selected += OnMenuFileSaveSelected;
menuConnectLogin.Selected += OnMenuConnectLoginSelected;
menuConnectNew.Selected += OnMenuConnectNewSelected;
menuConnectJoin.Selected += OnMenuConnectJoinSelected;
menuConnect.Items.Add(menuConnectLogin);
menuConnect.Items.Add(menuConnectNew);
menuConnect.Items.Add(menuConnectJoin);
menuConnect.Items.Add(menuConnectSync);
@ -84,121 +91,270 @@ namespace Sledgemapper
{
Title = "Join mapping session"
};
var content = new VerticalStackPanel();
var grid = new Grid
{
Width = 200,
ShowGridLines = false,
ColumnSpacing = 8,
RowSpacing = 3,
};
// Set partitioning configuration
grid.ColumnsProportions.Add(new Proportion(ProportionType.Auto));
grid.ColumnsProportions.Add(new Proportion(ProportionType.Fill));
grid.RowsProportions.Add(new Proportion(ProportionType.Auto));
grid.RowsProportions.Add(new Proportion(ProportionType.Auto));
var sessionNameLabel = new Label { Text = "Session Name:" };
var initialsLabel = new Label { Text = "Initials:", GridRow = 1 };
var textbox = new TextBox { GridColumn = 1 };
var initialsTextbox = new TextBox { GridColumn = 1, GridRow = 1 };
TextButton button = new TextButton
{
Text = "Start",
HorizontalAlignment = HorizontalAlignment.Center
};
grid.Widgets.Add(textbox);
grid.Widgets.Add(initialsTextbox);
grid.Widgets.Add(sessionNameLabel);
grid.Widgets.Add(initialsLabel);
content.Widgets.Add(grid);
button.Click += async (s, e) =>
{
if (string.IsNullOrWhiteSpace(textbox.Text))
{
return;
}
if (_communicationManager.Connection.State != HubConnectionState.Connected)
{ await _communicationManager.Connection.StartAsync(); }
var successful = false;
try
{
var result = await _communicationManager.Connection?.InvokeAsync<Session>("JoinSession", textbox.Text, initialsTextbox.Text);
if (result != null)
{
_sessionData.Map = result.Map;
_sessionData.Walls = result.Walls;
_sessionData.Overlays = result.Overlays;
_sessionData.Players = result.Players;
_sessionData.MapEntityAdded += OnMapEntityAdded;
}
successful = result != null; ;
}
catch { }
if (successful)
{
_sessionData.SessionName = textbox.Text;
window.Close();
}
};
content.Widgets.Add(button);
var content = new SessionWindow();
content.BtnLogin.Text = "Join";
content.BtnLogin.Click += OnButtonJoinSessionClicked;
window.Content = content;
window.ShowModal(_desktop);
}
private async void OnButtonJoinSessionClicked(object sender, EventArgs e)
{
Container container = ((TextButton)sender).Parent;
while (!(container is Window))
{
container = container.Parent;
}
var localWindow = (Window)container;
var localContent = localWindow.Content as SessionWindow;
var isValid = ValidateTextbox(localContent.TxtSession);
if (!isValid)
{
return;
}
if (_communicationManager.Connection.State != HubConnectionState.Connected)
{
await _communicationManager.Connection.StartAsync();
}
var successful = false;
try
{
var result = await _communicationManager.Connection?.InvokeAsync<Session>("JoinSession", localContent.TxtSession.Text, _authResponse.Initials);
if (result != null)
{
_sessionData.Map = result.Map;
_sessionData.Walls = result.Walls;
_sessionData.Overlays = result.Overlays;
_sessionData.Players = result.Players;
_sessionData.MapEntityAdded += OnMapEntityAdded;
_sessionData.MapEntityDeleted += OnMapEntityDeleted;
}
successful = result != null; ;
}
catch { }
if (successful)
{
_sessionData.SessionName = localContent.TxtSession.Text;
localWindow.Close();
}
}
private AuthenticateResponse _authResponse;
private void OnMenuConnectLoginSelected(object sender, EventArgs e)
{
Window window = new Window
{
Title = "Login"
};
var content = new LoginRegisterWindow();
content.RdoLogin.IsPressed = true;
content.RdoLogin.Click += (s, e) =>
{
content.TxtFirstname.Visible = false;
content.TxtLastname.Visible = false;
content.TxtInitials.Visible = false;
content.LblFirstname.Visible = false;
content.LblLastname.Visible = false;
content.LblInitials.Visible = false;
content.BtnLogin.Visible = true;
content.BtnRegister.Visible = false;
window.Title = "Login";
};
content.RdoRegister.Click += (s, e) =>
{
content.TxtFirstname.Visible = true;
content.TxtLastname.Visible = true;
content.TxtInitials.Visible = true;
content.LblFirstname.Visible = true;
content.LblLastname.Visible = true;
content.LblInitials.Visible = true;
content.BtnLogin.Visible = false;
content.BtnRegister.Visible = true;
window.Title = "Register";
};
content.BtnRegister.Click += OnButtonRegisterClick;
content.BtnLogin.Click += OnButtonLoginClick;
window.Content = content;
window.ShowModal(_desktop);
}
private async void OnButtonLoginClick(object sender, EventArgs e)
{
Container container = ((TextButton)sender).Parent;
while (!(container is Window))
{
container = container.Parent;
}
var localWindow = (Window)container;
var localContent = localWindow.Content as LoginRegisterWindow;
var isValid = true;
isValid &= ValidateTextbox(localContent.TxtEmail);
isValid &= ValidateTextbox(localContent.TxtPassword);
if (!isValid)
{
return;
}
var successful = false;
try
{
var httpClientHandler = new HttpClientHandler();
//if (myConfigurationService.VerifySslCertificate == false)
//{
httpClientHandler.ServerCertificateCustomValidationCallback =
(message, certificate, chain, sslPolicyErrors) => true;
var identiyApi = RestService.For<IIdentityApi>(
new HttpClient(httpClientHandler)
{
BaseAddress = new Uri("http://localhost:4000")
});
_authResponse = await identiyApi.Authenticate(new AuthenticateModel
{
Username = localContent.TxtEmail.Text,
Password = localContent.TxtPassword.Text
});
successful = true;
}
catch (Exception ex)
{
}
if (successful)
{
localWindow.Close();
};
}
private bool ValidateTextbox(TextBox textBox)
{
var valid = !string.IsNullOrWhiteSpace(textBox.Text);
if (!valid)
{
textBox.Background = new SolidBrush(Color.Red);
}
return valid;
}
private async void OnButtonRegisterClick(object sender, EventArgs e)
{
Container container = ((TextButton)sender).Parent;
while (!(container is Window))
{
container = container.Parent;
}
var localWindow = (Window)container;
var localContent = localWindow.Content as LoginRegisterWindow;
var isValid = true;
isValid &= ValidateTextbox(localContent.TxtEmail);
isValid &= ValidateTextbox(localContent.TxtPassword);
isValid &= ValidateTextbox(localContent.TxtFirstname);
isValid &= ValidateTextbox(localContent.TxtLastname);
isValid &= ValidateTextbox(localContent.TxtInitials);
if (!isValid)
{
return;
}
var successful = false;
try
{
var httpClientHandler = new HttpClientHandler();
//if (myConfigurationService.VerifySslCertificate == false)
//{
httpClientHandler.ServerCertificateCustomValidationCallback =
(message, certificate, chain, sslPolicyErrors) => true;
var identiyApi = RestService.For<IIdentityApi>(
new HttpClient(httpClientHandler)
{
BaseAddress = new Uri("http://localhost:4000")
});
var result = await identiyApi.Register(new RegisterModel
{
Username = localContent.TxtEmail.Text,
Password = localContent.TxtPassword.Text,
FirstName = localContent.TxtFirstname.Text,
LastName = localContent.TxtLastname.Text,
Initials = localContent.TxtInitials.Text
});
if (result.IsSuccessStatusCode)
{
_authResponse = await identiyApi.Authenticate(new AuthenticateModel
{
Username = localContent.TxtEmail.Text,
Password = localContent.TxtPassword.Text
});
successful = true;
}
}
catch (Exception ex)
{
}
if (successful)
{
localWindow.Close();
};
}
private void OnMenuConnectNewSelected(object sender, EventArgs e)
{
Window window = new Window
{
Title = "New mapping session"
};
var content = new VerticalStackPanel();
var grid = new Grid
{
Width = 200,
ShowGridLines = false,
ColumnSpacing = 8,
RowSpacing = 3,
};
// Set partitioning configuration
grid.ColumnsProportions.Add(new Proportion(ProportionType.Auto));
grid.ColumnsProportions.Add(new Proportion(ProportionType.Fill));
grid.RowsProportions.Add(new Proportion(ProportionType.Auto));
grid.RowsProportions.Add(new Proportion(ProportionType.Auto));
var sessionNameLabel = new Label { Text = "Session Name:" };
var initialsLabel = new Label { Text = "Initials:", GridRow = 1 };
var textbox = new TextBox { GridColumn = 1 };
var initialsTextbox = new TextBox { GridColumn = 1, GridRow = 1 };
TextButton button = new TextButton
{
Text = "Start",
HorizontalAlignment = HorizontalAlignment.Center
};
grid.Widgets.Add(textbox);
grid.Widgets.Add(initialsTextbox);
grid.Widgets.Add(sessionNameLabel);
grid.Widgets.Add(initialsLabel);
var content = new SessionWindow();
content.BtnLogin.Text = "Join";
content.BtnLogin.Click += OnButtonNewSessionClicked;
window.Content = content;
content.Widgets.Add(grid);
window.ShowModal(_desktop);
button.Click += async (s, e) =>
}
private async void OnButtonNewSessionClicked(object sender, EventArgs e)
{
Container container = ((TextButton)sender).Parent;
while (!(container is Window))
{
if (string.IsNullOrWhiteSpace(textbox.Text))
{
return;
}
if (_communicationManager.Connection.State != HubConnectionState.Connected)
{ await _communicationManager.Connection.StartAsync(); }
var successful = false;
try
{
var session = await _communicationManager.Connection?.InvokeAsync<Session>("NewSession", textbox.Text, initialsTextbox.Text);
container = container.Parent;
}
var localWindow = (Window)container;
var localContent = localWindow.Content as SessionWindow;
var isValid = ValidateTextbox(localContent.TxtSession);
if (!isValid)
{
return;
}
if (_communicationManager.Connection.State != HubConnectionState.Connected)
{
await _communicationManager.Connection.StartAsync();
}
var successful = false;
try
{
var session = await _communicationManager.Connection?.InvokeAsync<Session>("NewSession", localContent.TxtSession.Text, _authResponse.Initials);
if (session != null)
{
_sessionData = session;
@ -208,29 +364,14 @@ namespace Sledgemapper
}
successful = session != null;
}
catch (Exception ex)
{
}
if (successful)
{
_sessionData.SessionName = textbox.Text;
_communicationManager.SessionData = _sessionData;
window.Close();
}
};
content.Widgets.Add(button);
window.Content = content;
window.Closed += (s, a) =>
}
catch { }
if (successful)
{
// Called when window is closed
};
window.ShowModal(_desktop);
_sessionData.SessionName = localContent.TxtSession.Text;
_communicationManager.SessionData = _sessionData;
localWindow.Close();
}
}
private void OnMenuFileSaveSelected(object sender, EventArgs e)

View file

@ -0,0 +1,153 @@
/* Generated by MyraPad at 10/11/2020 11:32:04 */
using Myra.Graphics2D;
using Myra.Graphics2D.TextureAtlases;
using Myra.Graphics2D.UI;
using Myra.Graphics2D.Brushes;
#if !STRIDE
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#else
using Stride.Core.Mathematics;
#endif
namespace Sledgemapper.UI
{
partial class LoginRegisterWindow: VerticalStackPanel
{
private void BuildUI()
{
RdoLogin = new RadioButton();
RdoLogin.Text = " Login";
RdoLogin.Id = "RdoLogin";
RdoRegister = new RadioButton();
RdoRegister.Text = " Register";
RdoRegister.Id = "RdoRegister";
var horizontalStackPanel1 = new HorizontalStackPanel();
horizontalStackPanel1.Spacing = 18;
horizontalStackPanel1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
horizontalStackPanel1.Widgets.Add(RdoLogin);
horizontalStackPanel1.Widgets.Add(RdoRegister);
var label1 = new Label();
label1.Text = "Email";
var label2 = new Label();
label2.Text = "Password";
label2.GridRow = 1;
TxtEmail = new TextBox();
TxtEmail.GridColumn = 1;
TxtEmail.Id = "TxtEmail";
TxtPassword = new TextBox();
TxtPassword.PasswordField = true;
TxtPassword.GridColumn = 1;
TxtPassword.GridRow = 1;
TxtPassword.Id = "TxtPassword";
LblFirstname = new Label();
LblFirstname.Text = "First name";
LblFirstname.GridRow = 2;
LblFirstname.Visible = false;
LblFirstname.Id = "LblFirstname";
LblLastname = new Label();
LblLastname.Text = "Last name";
LblLastname.GridRow = 3;
LblLastname.Visible = false;
LblLastname.Id = "LblLastname";
LblInitials = new Label();
LblInitials.Text = "Initials";
LblInitials.GridRow = 4;
LblInitials.Visible = false;
LblInitials.Id = "LblInitials";
TxtFirstname = new TextBox();
TxtFirstname.GridColumn = 1;
TxtFirstname.GridRow = 2;
TxtFirstname.Visible = false;
TxtFirstname.Id = "TxtFirstname";
TxtLastname = new TextBox();
TxtLastname.GridColumn = 1;
TxtLastname.GridRow = 3;
TxtLastname.Visible = false;
TxtLastname.Id = "TxtLastname";
TxtInitials = new TextBox();
TxtInitials.GridColumn = 1;
TxtInitials.GridRow = 4;
TxtInitials.Visible = false;
TxtInitials.Id = "TxtInitials";
var grid1 = new Grid();
grid1.ColumnSpacing = 25;
grid1.RowSpacing = 10;
grid1.ColumnsProportions.Add(new Proportion
{
Type = Myra.Graphics2D.UI.ProportionType.Pixels,
Value = 80,
});
grid1.ColumnsProportions.Add(new Proportion
{
Type = Myra.Graphics2D.UI.ProportionType.Fill,
});
grid1.Widgets.Add(label1);
grid1.Widgets.Add(label2);
grid1.Widgets.Add(TxtEmail);
grid1.Widgets.Add(TxtPassword);
grid1.Widgets.Add(LblFirstname);
grid1.Widgets.Add(LblLastname);
grid1.Widgets.Add(LblInitials);
grid1.Widgets.Add(TxtFirstname);
grid1.Widgets.Add(TxtLastname);
grid1.Widgets.Add(TxtInitials);
BtnLogin = new TextButton();
BtnLogin.Text = "Login";
BtnLogin.Width = 70;
BtnLogin.Height = 20;
BtnLogin.Padding = new Thickness(5);
BtnLogin.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
BtnLogin.Id = "BtnLogin";
BtnRegister = new TextButton();
BtnRegister.Text = "Register";
BtnRegister.Visible = false;
BtnRegister.Width = 70;
BtnRegister.Height = 20;
BtnRegister.Padding = new Thickness(5);
BtnRegister.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
BtnRegister.Id = "BtnRegister";
Spacing = 16;
HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
Width = 400;
Padding = new Thickness(10);
Widgets.Add(horizontalStackPanel1);
Widgets.Add(grid1);
Widgets.Add(BtnLogin);
Widgets.Add(BtnRegister);
}
public RadioButton RdoLogin;
public RadioButton RdoRegister;
public TextBox TxtEmail;
public TextBox TxtPassword;
public Label LblFirstname;
public Label LblLastname;
public Label LblInitials;
public TextBox TxtFirstname;
public TextBox TxtLastname;
public TextBox TxtInitials;
public TextButton BtnLogin;
public TextButton BtnRegister;
}
}

View file

@ -0,0 +1,11 @@
/* Generated by MyraPad at 09/11/2020 23:54:08 */
namespace Sledgemapper.UI
{
public partial class LoginRegisterWindow
{
public LoginRegisterWindow()
{
BuildUI();
}
}
}

View file

@ -0,0 +1,62 @@
/* Generated by MyraPad at 10/11/2020 10:59:36 */
using Myra.Graphics2D;
using Myra.Graphics2D.TextureAtlases;
using Myra.Graphics2D.UI;
using Myra.Graphics2D.Brushes;
#if !STRIDE
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#else
using Stride.Core.Mathematics;
#endif
namespace Sledgemapper.UI
{
partial class SessionWindow: VerticalStackPanel
{
private void BuildUI()
{
var label1 = new Label();
label1.Text = "Session";
TxtSession = new TextBox();
TxtSession.GridColumn = 1;
TxtSession.Id = "TxtSession";
var grid1 = new Grid();
grid1.ColumnSpacing = 25;
grid1.RowSpacing = 10;
grid1.ColumnsProportions.Add(new Proportion
{
Type = Myra.Graphics2D.UI.ProportionType.Pixels,
Value = 60,
});
grid1.ColumnsProportions.Add(new Proportion
{
Type = Myra.Graphics2D.UI.ProportionType.Fill,
});
grid1.Widgets.Add(label1);
grid1.Widgets.Add(TxtSession);
BtnLogin = new TextButton();
BtnLogin.Text = "Join";
BtnLogin.Padding = new Thickness(10, 5);
BtnLogin.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
BtnLogin.Id = "BtnLogin";
Spacing = 16;
HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
Width = 300;
Padding = new Thickness(10);
Widgets.Add(grid1);
Widgets.Add(BtnLogin);
}
public TextBox TxtSession;
public TextButton BtnLogin;
}
}

View file

@ -0,0 +1,11 @@
/* Generated by MyraPad at 10/11/2020 10:59:36 */
namespace Sledgemapper.UI
{
public partial class SessionWindow
{
public SessionWindow()
{
BuildUI();
}
}
}

View file

@ -0,0 +1,27 @@
<Project>
<Project.ExportOptions Namespace="Sledgemapper.UI" Class="LoginRegisterWindow" OutputPath="C:\dev\Map\Sledgemapper\UI" />
<VerticalStackPanel Spacing="16" HorizontalAlignment="Center" VerticalAlignment="Center" Width="400" Padding="10">
<HorizontalStackPanel Spacing="18" HorizontalAlignment="Center">
<RadioButton Text=" Login" Id="RdoLogin" />
<RadioButton Text=" Register" Id="RdoRegister" />
</HorizontalStackPanel>
<Grid ColumnSpacing="25" RowSpacing="10">
<Grid.ColumnsProportions>
<Proportion Type="Pixels" Value="80" />
<Proportion Type="Fill" />
</Grid.ColumnsProportions>
<Label Text="Email" />
<Label Text="Password" GridRow="1" />
<TextBox GridColumn="1" Id="TxtEmail" />
<TextBox PasswordField="True" GridColumn="1" GridRow="1" Id="TxtPassword" />
<Label Text="First name" GridRow="2" Visible="False" Id="LblFirstname" />
<Label Text="Last name" GridRow="3" Visible="False" Id="LblLastname" />
<Label Text="Initials" GridRow="4" Visible="False" Id="LblInitials" />
<TextBox GridColumn="1" GridRow="2" Visible="False" Id="TxtFirstname" />
<TextBox GridColumn="1" GridRow="3" Visible="False" Id="TxtLastname" />
<TextBox GridColumn="1" GridRow="4" Visible="False" Id="TxtInitials" />
</Grid>
<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"/>
</VerticalStackPanel>
</Project>

View file

@ -0,0 +1,17 @@
<Project>
<Project.ExportOptions Namespace="Sledgemapper.UI" Class="SessionWindow" OutputPath="C:\dev\Map\Sledgemapper\UI" />
<VerticalStackPanel Spacing="16" HorizontalAlignment="Center" VerticalAlignment="Center" Width="300" Padding="10">
<Grid ColumnSpacing="25" RowSpacing="10">
<Grid.ColumnsProportions>
<Proportion Type="Pixels" Value="60" />
<Proportion Type="Fill" />
</Grid.ColumnsProportions>
<Label Text="Session" />
<TextBox GridColumn="1" Id="TxtSession" />
</Grid>
<TextButton Text="Join" Padding="10, 5" HorizontalAlignment="Center" Id="BtnLogin" />
</VerticalStackPanel>
</Project>