updates and bugfixes
This commit is contained in:
parent
19f1084d5f
commit
22233f8c6e
8 changed files with 85 additions and 32 deletions
|
@ -49,37 +49,35 @@ namespace Sledgemapper.Api.Controllers
|
||||||
public async Task Post(string sessionName, [FromBody] Overlay overlay)
|
public async Task Post(string sessionName, [FromBody] Overlay overlay)
|
||||||
{
|
{
|
||||||
var userId = int.Parse(HttpContext.User.Identity.Name);
|
var userId = int.Parse(HttpContext.User.Identity.Name);
|
||||||
await _mediator.Publish(new NewOverlayCommand(sessionName, overlay, userId));
|
await _mediator.Send(new NewOverlayCommand(sessionName, overlay, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("wall")]
|
[HttpPost("wall")]
|
||||||
public async Task Post(string sessionName, [FromBody] Wall wall)
|
public async Task Post(string sessionName, [FromBody] Wall wall)
|
||||||
{
|
{
|
||||||
var userId = int.Parse(HttpContext.User.Identity.Name);
|
var userId = int.Parse(HttpContext.User.Identity.Name);
|
||||||
await _mediator.Publish(new NewWallCommand(sessionName, wall, userId));
|
await _mediator.Send(new NewWallCommand(sessionName, wall, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("tile")]
|
[HttpDelete("tile")]
|
||||||
public async Task Delete(string sessionName, [FromBody] Tile tile)
|
public async Task Delete(string sessionName, [FromBody] Tile tile)
|
||||||
{
|
{
|
||||||
var userId = int.Parse(HttpContext.User.Identity.Name);
|
var userId = int.Parse(HttpContext.User.Identity.Name);
|
||||||
await _mediator.Publish(new DeleteTileCommand(sessionName, tile, userId));
|
await _mediator.Send(new DeleteTileCommand(sessionName, tile, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("overlay")]
|
[HttpDelete("overlay")]
|
||||||
public async Task Delete(string sessionName, [FromBody] Overlay overlay)
|
public async Task Delete(string sessionName, [FromBody] Overlay overlay)
|
||||||
{
|
{
|
||||||
var userId = int.Parse(HttpContext.User.Identity.Name);
|
var userId = int.Parse(HttpContext.User.Identity.Name);
|
||||||
await _mediator.Publish(new DeleteOverlayCommand(sessionName, overlay, userId));
|
await _mediator.Send(new DeleteOverlayCommand(sessionName, overlay, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("wall")]
|
[HttpDelete("wall")]
|
||||||
public async Task Delete(string sessionName, [FromBody] Wall wall)
|
public async Task Delete(string sessionName, [FromBody] Wall wall)
|
||||||
{
|
{
|
||||||
var userId = int.Parse(HttpContext.User.Identity.Name);
|
var userId = int.Parse(HttpContext.User.Identity.Name);
|
||||||
await _mediator.Publish(new DeleteWallCommand(sessionName, wall, userId));
|
await _mediator.Send(new DeleteWallCommand(sessionName, wall, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
|
@ -5,18 +5,18 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper" Version="9.0.0" />
|
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
|
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.0" />
|
||||||
<PackageReference Include="mediatr" Version="9.0.0" />
|
<PackageReference Include="mediatr" Version="9.0.0" />
|
||||||
<PackageReference Include="mediatr.extensions.microsoft.dependencyinjection" Version="9.0.0" />
|
<PackageReference Include="mediatr.extensions.microsoft.dependencyinjection" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.9">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.0">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.9" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.0" />
|
||||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.6.0" />
|
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.8.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.9" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
Binary file not shown.
|
@ -293,7 +293,14 @@ namespace Sledgemapper
|
||||||
|
|
||||||
_spriteBatch.End();
|
_spriteBatch.End();
|
||||||
|
|
||||||
_desktop?.Render();
|
try
|
||||||
|
{
|
||||||
|
_desktop?.Render();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("Desktop render error");
|
||||||
|
}
|
||||||
base.Draw(gameTime);
|
base.Draw(gameTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +563,8 @@ namespace Sledgemapper
|
||||||
|
|
||||||
private async void OnButtonLoginClick(object sender, EventArgs e)
|
private async void OnButtonLoginClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Container container = ((TextButton)sender).Parent;
|
var button = ((TextButton)sender);
|
||||||
|
Container container = button.Parent;
|
||||||
while (!(container is Window))
|
while (!(container is Window))
|
||||||
{
|
{
|
||||||
container = container.Parent;
|
container = container.Parent;
|
||||||
|
@ -564,14 +572,20 @@ namespace Sledgemapper
|
||||||
|
|
||||||
var localWindow = (Window)container;
|
var localWindow = (Window)container;
|
||||||
var localContent = localWindow.Content as LoginRegisterWindow;
|
var localContent = localWindow.Content as LoginRegisterWindow;
|
||||||
|
|
||||||
|
if (!button.Enabled)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var isValid = true;
|
var isValid = true;
|
||||||
isValid &= ValidateTextbox(localContent.TxtEmail);
|
isValid &= ValidateTextbox(localContent.TxtEmail);
|
||||||
isValid &= ValidateTextbox(localContent.TxtPassword);
|
isValid &= ValidateTextbox(localContent.TxtPassword);
|
||||||
|
|
||||||
if (!isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
localContent.LblLoginError.Text="Username or password is not valid";
|
localContent.LblLoginError.Text = "Username or password is not valid";
|
||||||
localContent.LblLoginError.Visible=true;
|
localContent.LblLoginError.Visible = true;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -579,8 +593,9 @@ namespace Sledgemapper
|
||||||
var successful = false;
|
var successful = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
localContent.LblLoginError.Text="";
|
button.Text = "Wait...";
|
||||||
localContent.LblLoginError.Visible=false;
|
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,
|
||||||
|
@ -588,11 +603,20 @@ namespace Sledgemapper
|
||||||
});
|
});
|
||||||
successful = _authResponse != null;
|
successful = _authResponse != null;
|
||||||
}
|
}
|
||||||
|
catch (Refit.ApiException refitException)
|
||||||
|
{
|
||||||
|
localContent.LblLoginError.Text = refitException.Content;
|
||||||
|
localContent.LblLoginError.Visible = true;
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(ex.Message);
|
localContent.LblLoginError.Text = "Can't connect to the server";
|
||||||
localContent.LblLoginError.Text=ex.Message;
|
localContent.LblLoginError.Visible = true;
|
||||||
localContent.LblLoginError.Visible=true;
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
button.Enabled = true;
|
||||||
|
button.Text = "Login";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (successful)
|
if (successful)
|
||||||
|
@ -608,7 +632,8 @@ namespace Sledgemapper
|
||||||
|
|
||||||
private async void OnButtonRegisterClick(object sender, EventArgs e)
|
private async void OnButtonRegisterClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Container container = ((TextButton)sender).Parent;
|
var button = ((TextButton)sender);
|
||||||
|
Container container = button.Parent;
|
||||||
while (!(container is Window))
|
while (!(container is Window))
|
||||||
{
|
{
|
||||||
container = container.Parent;
|
container = container.Parent;
|
||||||
|
@ -616,6 +641,12 @@ namespace Sledgemapper
|
||||||
|
|
||||||
var localWindow = (Window)container;
|
var localWindow = (Window)container;
|
||||||
var localContent = localWindow.Content as LoginRegisterWindow;
|
var localContent = localWindow.Content as LoginRegisterWindow;
|
||||||
|
|
||||||
|
if (!button.Enabled)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var isValid = true;
|
var isValid = true;
|
||||||
isValid &= ValidateTextbox(localContent.TxtEmail);
|
isValid &= ValidateTextbox(localContent.TxtEmail);
|
||||||
isValid &= ValidateTextbox(localContent.TxtPassword);
|
isValid &= ValidateTextbox(localContent.TxtPassword);
|
||||||
|
@ -625,12 +656,18 @@ namespace Sledgemapper
|
||||||
|
|
||||||
if (!isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
|
localContent.LblLoginError.Text = "Please complete all the fields";
|
||||||
|
localContent.LblLoginError.Visible = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var successful = false;
|
var successful = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
button.Text = "Wait...";
|
||||||
|
localContent.LblLoginError.Text = "";
|
||||||
|
localContent.LblLoginError.Visible = false;
|
||||||
|
|
||||||
var result = await _communicationManager.Register(new RegisterModel
|
var result = await _communicationManager.Register(new RegisterModel
|
||||||
{
|
{
|
||||||
Username = localContent.TxtEmail.Text,
|
Username = localContent.TxtEmail.Text,
|
||||||
|
@ -649,9 +686,20 @@ namespace Sledgemapper
|
||||||
successful = true;
|
successful = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Refit.ApiException refitException)
|
||||||
|
{
|
||||||
|
localContent.LblLoginError.Text = refitException.Content;
|
||||||
|
localContent.LblLoginError.Visible = true;
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(ex.Message);
|
localContent.LblLoginError.Text = "Can't connect to the server";
|
||||||
|
localContent.LblLoginError.Visible = true;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
button.Enabled = true;
|
||||||
|
button.Text = "Register";
|
||||||
}
|
}
|
||||||
if (successful)
|
if (successful)
|
||||||
{
|
{
|
||||||
|
@ -659,6 +707,9 @@ namespace Sledgemapper
|
||||||
_mainWidget.MenuConnectJoin.Enabled = true;
|
_mainWidget.MenuConnectJoin.Enabled = true;
|
||||||
_mainWidget.MenuConnectSync.Enabled = true;
|
_mainWidget.MenuConnectSync.Enabled = true;
|
||||||
_mainWidget.MenuConnectUpload.Enabled = true;
|
_mainWidget.MenuConnectUpload.Enabled = true;
|
||||||
|
|
||||||
|
_mainWidget.lblUsername.Text = $"{_authResponse.Username} - {_authResponse.Initials}";
|
||||||
|
|
||||||
localWindow.Close();
|
localWindow.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -856,7 +907,11 @@ namespace Sledgemapper
|
||||||
var valid = !string.IsNullOrWhiteSpace(textBox.Text);
|
var valid = !string.IsNullOrWhiteSpace(textBox.Text);
|
||||||
if (!valid)
|
if (!valid)
|
||||||
{
|
{
|
||||||
textBox.Background = new SolidBrush(Color.PaleVioletRed);
|
textBox.Background = new SolidBrush(Color.Red);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textBox.Background = new SolidBrush(new Color(51, 51, 51)); ;
|
||||||
}
|
}
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,9 @@
|
||||||
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1641" />
|
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1641" />
|
||||||
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.0.1641" />
|
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.0.1641" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client">
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client">
|
||||||
<Version>3.1.9</Version>
|
<Version>5.0.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Myra" Version="1.0.2.211" />
|
<PackageReference Include="Myra" Version="1.0.3.213" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="polly" Version="7.2.1" />
|
<PackageReference Include="polly" Version="7.2.1" />
|
||||||
<PackageReference Include="polly.extensions.http" Version="3.0.0" />
|
<PackageReference Include="polly.extensions.http" Version="3.0.0" />
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Generated by MyraPad at 18/11/2020 16:11:22 */
|
/* Generated by MyraPad at 19/11/2020 11:58:09 */
|
||||||
using Myra.Graphics2D;
|
using Myra.Graphics2D;
|
||||||
using Myra.Graphics2D.TextureAtlases;
|
using Myra.Graphics2D.TextureAtlases;
|
||||||
using Myra.Graphics2D.UI;
|
using Myra.Graphics2D.UI;
|
||||||
|
@ -32,7 +32,7 @@ namespace Sledgemapper.UI
|
||||||
horizontalStackPanel1.Widgets.Add(RdoRegister);
|
horizontalStackPanel1.Widgets.Add(RdoRegister);
|
||||||
|
|
||||||
var label1 = new Label();
|
var label1 = new Label();
|
||||||
label1.Text = "Email";
|
label1.Text = "Username";
|
||||||
|
|
||||||
var label2 = new Label();
|
var label2 = new Label();
|
||||||
label2.Text = "Password";
|
label2.Text = "Password";
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<Proportion Type="Pixels" Value="80" />
|
<Proportion Type="Pixels" Value="80" />
|
||||||
<Proportion Type="Fill" />
|
<Proportion Type="Fill" />
|
||||||
</Grid.ColumnsProportions>
|
</Grid.ColumnsProportions>
|
||||||
<Label Text="Email" />
|
<Label Text="Username" />
|
||||||
<Label Text="Password" GridRow="1" />
|
<Label Text="Password" GridRow="1" />
|
||||||
<TextBox GridColumn="1" Id="TxtEmail" />
|
<TextBox GridColumn="1" Id="TxtEmail" />
|
||||||
<TextBox PasswordField="True" GridColumn="1" GridRow="1" Id="TxtPassword" />
|
<TextBox PasswordField="True" GridColumn="1" GridRow="1" Id="TxtPassword" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue