ui
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michele Scandura 2021-09-15 16:54:41 +01:00
parent dd97d5ec4e
commit b8d27a2a6f
6 changed files with 191 additions and 123 deletions

View file

@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<PublishReadyToRun>false</PublishReadyToRun> <PublishReadyToRun>false</PublishReadyToRun>
<TieredCompilation>false</TieredCompilation> <TieredCompilation>false</TieredCompilation>
<PublishTrimmed>false</PublishTrimmed> <PublishTrimmed>false</PublishTrimmed>
<!-- <TrimMode>link</TrimMode> --> <!-- <TrimMode>link</TrimMode> -->
<_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --verbose</_ExtraTrimmerArgs> <_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --verbose</_ExtraTrimmerArgs>
</PropertyGroup> </PropertyGroup>
<!-- <Target Name="EnsureAllAssembliesAreLinked" BeforeTargets="PrepareForILLink"> <!-- <Target Name="EnsureAllAssembliesAreLinked" BeforeTargets="PrepareForILLink">
<ItemGroup> <ItemGroup>
<ManagedAssemblyToLink> <ManagedAssemblyToLink>
<TrimMode>link</TrimMode> <TrimMode>link</TrimMode>
@ -16,58 +16,71 @@
<TrimmerRootAssembly Include="$(TargetName)" /> <TrimmerRootAssembly Include="$(TargetName)" />
</ItemGroup> </ItemGroup>
</Target> --> </Target> -->
<PropertyGroup> <PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>Icon.ico</ApplicationIcon> <ApplicationIcon>Icon.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="Icon.ico" /> <None Remove="Icon.ico" />
<None Remove="Icon.bmp" /> <None Remove="Icon.bmp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Icon.ico" /> <EmbeddedResource Include="Icon.ico" />
<EmbeddedResource Include="Icon.bmp" /> <EmbeddedResource Include="Icon.bmp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<MonoGameContentReference Include="Content\Content.mgcb" /> <MonoGameContentReference Include="Content\Content.mgcb" />
</ItemGroup> </ItemGroup>
<!-- <ItemGroup> <!-- <ItemGroup>
<TrimmerRootAssembly Include="Microsoft.Xna.Framework.Content.ContentTypeReader" Visible="false" /> <TrimmerRootAssembly Include="Microsoft.Xna.Framework.Content.ContentTypeReader" Visible="false" />
</ItemGroup> --> </ItemGroup> -->
<ItemGroup> <ItemGroup>
<PackageReference Include="AsyncAwaitBestPractices" Version="6.0.0" /> <PackageReference Include="AsyncAwaitBestPractices" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0-preview.7.21377.19" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0-preview.7.21377.19" />
<PackageReference Include="MonoGame.Extended" Version="3.8.0" /> <PackageReference Include="MonoGame.Extended" Version="3.8.0" />
<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>6.0.0-preview.7.21378.6</Version> <Version>6.0.0-preview.7.21378.6</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Myra" Version="1.3.2" /> <PackageReference Include="Myra" Version="1.3.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="polly" Version="7.2.2" /> <PackageReference Include="polly" Version="7.2.2" />
<PackageReference Include="polly.extensions.http" Version="3.0.0" /> <PackageReference Include="polly.extensions.http" Version="3.0.0" />
<PackageReference Include="Refit.HttpClientFactory" Version="6.0.94" /> <PackageReference Include="Refit.HttpClientFactory" Version="6.0.94" />
<PackageReference Include="Sentry" Version="3.9.2" /> <PackageReference Include="Sentry" Version="3.9.2" />
<PackageReference Include="TinyMessenger" Version="1.4.0-alpha3"> <PackageReference Include="TinyMessenger" Version="1.4.0-alpha3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Content\**\*.xnb"> <Content Include="Content\**\*.xnb">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sledgemapper.Shared\Sledgemapper.Shared.csproj" /> <ItemGroup>
</ItemGroup> <ProjectReference Include="..\Sledgemapper.Shared\Sledgemapper.Shared.csproj" />
</ItemGroup>
<!--<ItemGroup>
<Compile Update="**\*.Custom.cs">
<DependentUpon>$([System.String]::Copy(%(Filename)).Replace(".Custom",".cs"))</DependentUpon>
</Compile>
<Compile Update="**\*.Generated.cs">
<DependentUpon>$([System.String]::Copy(%(Filename)).Replace(".Generated",".cs"))</DependentUpon>
</Compile>
<Content Update="**\*.UI.xmmp">
<DependentUpon>$([System.String]::Copy(%(Filename)).Replace(".UI",".cs"))</DependentUpon>
</Content>
</ItemGroup>-->
</Project> </Project>

View file

@ -11,16 +11,16 @@ namespace Sledgemapper.UI
private readonly CommunicationManager CommunicationManager; private readonly CommunicationManager CommunicationManager;
private readonly Window Window; private readonly Window Window;
private readonly TinyMessengerHub Messenger; private readonly TinyMessengerHub Messenger;
private readonly Desktop Desktop;
private Settings _settings; private Settings _settings;
public CampaignList(CommunicationManager communicationManager, Window window, TinyMessengerHub messenger, Settings settings) public CampaignList(CommunicationManager communicationManager, Window window, TinyMessengerHub messenger, Settings settings, Desktop desktop)
{ {
BuildUI(); BuildUI();
CommunicationManager = communicationManager; CommunicationManager = communicationManager;
Window = window; Window = window;
Messenger = messenger; Messenger = messenger;
Desktop= desktop;
_settings = settings; _settings = settings;
BtnNewCampaign.Click += (s, e) => BtnNewCampaign.Click += (s, e) =>
{ {
@ -56,13 +56,13 @@ namespace Sledgemapper.UI
Title = "New campaign" Title = "New campaign"
}; };
var content = new CampaignWindow(); var content = new CampaignWindow(CommunicationManager,window,Messenger);
//content.BtnNewCampaign.Text = "N"; //content.BtnNewCampaign.Text = "N";
content.BtnNewCampaign.Click += OnButtonNewCampaignClicked; //content.BtnNewCampaign.Click += OnButtonNewCampaignClicked;
window.Content = content; window.Content = content;
window.ShowModal(Desktop); window.ShowModal(desktop);
content.TxtCampaign.SetKeyboardFocus(); //content.TxtCampaign.SetKeyboardFocus();
} }
@ -85,61 +85,61 @@ namespace Sledgemapper.UI
campaignSelected = true; campaignSelected = true;
} }
private async void OnButtonNewCampaignClicked(object sender, EventArgs e) //private async void OnButtonNewCampaignClicked(object sender, EventArgs e)
{ //{
var localContent = ((TextButton)sender).GetParentContentInWindow<CampaignWindow>();// localWindow.Content as PlayerWindow; // var localContent = ((TextButton)sender).GetParentContentInWindow<CampaignWindow>();// localWindow.Content as PlayerWindow;
var isValid = localContent.Content.TxtCampaign.ValidateTextbox(); // var isValid = localContent.Content.TxtCampaign.ValidateTextbox();
if (!isValid) // if (!isValid)
{ // {
return; // return;
} // }
//if (CommunicationManager.Connection.State != HubConnectionState.Connected) // //if (CommunicationManager.Connection.State != HubConnectionState.Connected)
//{ // //{
// lblConnectionStatus.Text = "Connecting"; // // lblConnectionStatus.Text = "Connecting";
// await CommunicationManager.Connection.StartAsync(); // // await CommunicationManager.Connection.StartAsync();
// UpdateConnectionState(CommunicationManager.Connection); // // UpdateConnectionState(CommunicationManager.Connection);
//} // //}
var successful = false; // var successful = false;
try // try
{ // {
await CommunicationManager.Api.NewCampaign(localContent.Content.TxtCampaign.Text); // await CommunicationManager.Api.NewCampaign(localContent.Content.TxtCampaign.Text);
//if (result) // //if (result)
//{ // //{
// CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text; // // CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text;
// CommunicationManager.SessionData.MapEntityAdded -= OnMapEntityAdded; // // CommunicationManager.SessionData.MapEntityAdded -= OnMapEntityAdded;
// CommunicationManager.SessionData.MapEntityDeleted -= OnMapEntityDeleted; // // CommunicationManager.SessionData.MapEntityDeleted -= OnMapEntityDeleted;
// CommunicationManager.SessionData.MapEntityAdded += OnMapEntityAdded; // // CommunicationManager.SessionData.MapEntityAdded += OnMapEntityAdded;
// CommunicationManager.SessionData.MapEntityDeleted += OnMapEntityDeleted; // // CommunicationManager.SessionData.MapEntityDeleted += OnMapEntityDeleted;
//} // //}
//successful = result; // //successful = result;
//var result2 = await CommunicationManager.Connection?.InvokeAsync<Session>("JoinSession", localContent.TxtSession.Text); // //var result2 = await CommunicationManager.Connection?.InvokeAsync<Session>("JoinSession", localContent.TxtSession.Text);
//CommunicationManager.SessionData.SessionId = result2.SessionId; // //CommunicationManager.SessionData.SessionId = result2.SessionId;
//CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text; // //CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text;
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
//ExceptionlessClient.Default.SubmitException(ex); // //ExceptionlessClient.Default.SubmitException(ex);
} // }
//if (successful) // //if (successful)
//{ // //{
// //CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text; // // //CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text;
// //CommunicationManager.SessionData.Map = CommunicationManager.SessionData.Map; // // //CommunicationManager.SessionData.Map = CommunicationManager.SessionData.Map;
// //CommunicationManager.SessionData.Overlays = CommunicationManager.SessionData.Overlays; // // //CommunicationManager.SessionData.Overlays = CommunicationManager.SessionData.Overlays;
// //CommunicationManager.SessionData.Walls = CommunicationManager.SessionData.Walls; // // //CommunicationManager.SessionData.Walls = CommunicationManager.SessionData.Walls;
// //lblSessionName.Text = CommunicationManager.SessionData.SessionName; // // //lblSessionName.Text = CommunicationManager.SessionData.SessionName;
// //MenuConnectSync.Enabled = true; // // //MenuConnectSync.Enabled = true;
// //MenuConnectUpload.Enabled = true; // // //MenuConnectUpload.Enabled = true;
// localWindow.Close(); // // localWindow.Close();
//} // //}
localContent.Window.Close(); // localContent.Window.Close();
} //}
public async Task LoadCampaigns() public async Task LoadCampaigns()
{ {

View file

@ -1,4 +1,5 @@
using Myra.Graphics2D.UI; using Myra.Graphics2D.UI;
using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using TinyMessenger; using TinyMessenger;
@ -16,10 +17,64 @@ namespace Sledgemapper.UI
CommunicationManager = communicationManager; CommunicationManager = communicationManager;
Window = window; Window = window;
Messenger = messenger; Messenger = messenger;
BtnNewCampaign.Click += OnButtonNewCampaignClicked;
} }
private async void OnButtonNewCampaignClicked(object sender, EventArgs e)
{
//var localContent = ((TextButton)sender).GetParentContentInWindow<CampaignWindow>();// localWindow.Content as PlayerWindow;
} var isValid = TxtCampaign.ValidateTextbox();
if (!isValid)
{
return;
}
//if (CommunicationManager.Connection.State != HubConnectionState.Connected)
//{
// lblConnectionStatus.Text = "Connecting";
// await CommunicationManager.Connection.StartAsync();
// UpdateConnectionState(CommunicationManager.Connection);
//}
var successful = false;
try
{
await CommunicationManager.Api.NewCampaign(TxtCampaign.Text);
//if (result)
//{
// CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text;
// CommunicationManager.SessionData.MapEntityAdded -= OnMapEntityAdded;
// CommunicationManager.SessionData.MapEntityDeleted -= OnMapEntityDeleted;
// CommunicationManager.SessionData.MapEntityAdded += OnMapEntityAdded;
// CommunicationManager.SessionData.MapEntityDeleted += OnMapEntityDeleted;
//}
//successful = result;
//var result2 = await CommunicationManager.Connection?.InvokeAsync<Session>("JoinSession", localContent.TxtSession.Text);
//CommunicationManager.SessionData.SessionId = result2.SessionId;
//CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text;
}
catch (Exception ex)
{
//ExceptionlessClient.Default.SubmitException(ex);
}
//if (successful)
//{
// //CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text;
// //CommunicationManager.SessionData.Map = CommunicationManager.SessionData.Map;
// //CommunicationManager.SessionData.Overlays = CommunicationManager.SessionData.Overlays;
// //CommunicationManager.SessionData.Walls = CommunicationManager.SessionData.Walls;
// //lblSessionName.Text = CommunicationManager.SessionData.SessionName;
// //MenuConnectSync.Enabled = true;
// //MenuConnectUpload.Enabled = true;
// localWindow.Close();
//}
Window.Close();
}
}
} }

View file

@ -20,7 +20,7 @@ namespace Sledgemapper.UI
public partial class MainWidget public partial class MainWidget
{ {
private readonly CommunicationManager CommunicationManager; private readonly CommunicationManager CommunicationManager;
private Settings _settings; private Settings _settings;
private readonly TinyMessengerHub _messenger; private readonly TinyMessengerHub _messenger;
@ -32,7 +32,7 @@ namespace Sledgemapper.UI
BuildUI(); BuildUI();
CommunicationManager = communicationManager; CommunicationManager = communicationManager;
_settings = settings; _settings = settings;
_cachedContent = cachedContent; _cachedContent = cachedContent;
Window = window; Window = window;
@ -383,7 +383,7 @@ namespace Sledgemapper.UI
Title = "Campaigns" Title = "Campaigns"
}; };
var content = new CampaignList(CommunicationManager, window, _messenger, _settings); var content = new CampaignList(CommunicationManager, window, _messenger, _settings, Desktop);
await content.LoadCampaigns(); await content.LoadCampaigns();
//var campaigns = await CommunicationManager.Api.GetCampaigns(); //var campaigns = await CommunicationManager.Api.GetCampaigns();
//foreach (var campaign in campaigns) //foreach (var campaign in campaigns)