Add PlatformUno Frontend.

This commit is contained in:
Dennis Brentjes 2024-09-29 20:58:08 +02:00
parent 9e84a62c41
commit a8a797211a
160 changed files with 2852 additions and 2905 deletions

View File

@ -0,0 +1,167 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org
# This file is the top-most EditorConfig file
root = true
##########################################
# Common Settings
##########################################
[*]
indent_style = space
end_of_line = crlf
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
##########################################
# File Extension Settings
##########################################
[*.{yml,yaml}]
indent_size = 2
[.vsconfig]
indent_size = 2
end_of_line = lf
[*.sln]
indent_style = tab
indent_size = 2
[*.{csproj,proj,projitems,shproj}]
indent_size = 2
[*.{json,slnf}]
indent_size = 2
end_of_line = lf
[*.{props,targets}]
indent_size = 2
[*.xaml]
indent_size = 2
charset = utf-8-bom
[*.xml]
indent_size = 2
end_of_line = lf
[*.plist]
indent_size = 2
indent_style = tab
end_of_line = lf
[*.manifest]
indent_size = 2
[*.appxmanifest]
indent_size = 2
[*.{json,css,webmanifest}]
indent_size = 2
end_of_line = lf
[web.config]
indent_size = 2
end_of_line = lf
[*.sh]
indent_size = 2
end_of_line = lf
[*.cs]
# EOL should be normalized by Git. See https://github.com/dotnet/format/issues/1099
end_of_line = unset
# See https://github.com/dotnet/roslyn/issues/20356#issuecomment-310143926
trim_trailing_whitespace = false
tab_width = 4
indent_size = 4
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
#### Naming styles ####
# Naming rules
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# Symbol specifications
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
# Naming styles
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
csharp_indent_labels = one_less_than_current
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = file_scoped:warning
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent

403
FrontendPlaformUno/.gitignore vendored Normal file
View File

@ -0,0 +1,403 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
# Single Target Config
solution-config.props
# Publish Profiles
!**/Properties/PublishProfiles/*.pubxml

View File

@ -0,0 +1,62 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="FrontendPlaformUno (Desktop)" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/FrontendPlaformUno/FrontendPlaformUno.csproj" />
<option name="LAUNCH_PROFILE_TFM" value="net8.0-desktop" />
<option name="LAUNCH_PROFILE_NAME" value="FrontendPlaformUno (Desktop)" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
<option name="SEND_DEBUG_REQUEST" value="1" />
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
<configuration default="false" name="FrontendPlaformUno (WebAssembly IIS Express)" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/FrontendPlaformUno/FrontendPlaformUno.csproj" />
<option name="LAUNCH_PROFILE_TFM" value="net8.0-browserwasm" />
<option name="LAUNCH_PROFILE_NAME" value="FrontendPlaformUno (WebAssembly IIS Express)" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
<option name="SEND_DEBUG_REQUEST" value="1" />
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
<configuration default="false" name="FrontendPlaformUno (WebAssembly)" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/FrontendPlaformUno/FrontendPlaformUno.csproj" />
<option name="LAUNCH_PROFILE_TFM" value="net8.0-browserwasm" />
<option name="LAUNCH_PROFILE_NAME" value="FrontendPlaformUno (WebAssembly)" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
<option name="SEND_DEBUG_REQUEST" value="1" />
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
<configuration default="false" name="FrontendPlaformUno (WinAppSDK Unpackaged)" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/FrontendPlaformUno/FrontendPlaformUno.csproj" />
<option name="LAUNCH_PROFILE_TFM" value="net8.0-windows10.0.19041.0" />
<option name="LAUNCH_PROFILE_NAME" value="FrontendPlaformUno (WinAppSDK Unpackaged)" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
<option name="SEND_DEBUG_REQUEST" value="1" />
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>

View File

@ -0,0 +1,3 @@
# About the `.run` folder
This folder is present to add support for the [Rider IDE](https://aka.platform.uno/rider-getstarted). You can remove this folder safely if you're not using Rider.

View File

@ -5,34 +5,30 @@
"Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.NetCore.Component.SDK",
"Microsoft.NetCore.Component.DevelopmentTools",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions",
"Microsoft.NetCore.Component.Web",
"Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
"Microsoft.VisualStudio.Component.TextTemplating",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions",
"Microsoft.NetCore.Component.Web",
"Microsoft.VisualStudio.Component.IISExpress",
"Component.Microsoft.Web.LibraryManager",
"Microsoft.VisualStudio.ComponentGroup.Web",
"Microsoft.VisualStudio.Component.Web",
"Microsoft.VisualStudio.ComponentGroup.Web.Client",
"Microsoft.VisualStudio.Workload.NetWeb",
"Microsoft.VisualStudio.ComponentGroup.Azure.Prerequisites",
"Microsoft.VisualStudio.Workload.Azure",
"Microsoft.VisualStudio.Component.Windows10SDK.19041",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.TemplateEngine",
"Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging",
"Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
"Microsoft.VisualStudio.Component.Debugger.JustInTime",
"Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging",
"Microsoft.VisualStudio.Workload.ManagedDesktop",
"Microsoft.Component.NetFX.Native",
"Microsoft.VisualStudio.Component.Graphics",
"Component.OpenJDK",
"Microsoft.VisualStudio.Component.MonoDebugger",
"Microsoft.VisualStudio.Component.Merq",
"Component.Xamarin.RemotedSimulator",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.TemplateEngine",
"Component.Xamarin",
"Component.Android.SDK32",
"Microsoft.VisualStudio.Component.MonoDebugger",
"Microsoft.VisualStudio.ComponentGroup.Maui.All",
"Component.Android.SDK34",
"Component.OpenJDK",
"Microsoft.VisualStudio.Workload.NetCrossPlat",
"Microsoft.VisualStudio.Workload.NetCoreTools",
"Microsoft.VisualStudio.ComponentGroup.Maui.All"
"Microsoft.VisualStudio.Workload.NetCoreTools"
],
"extensions": [
"https://marketplace.visualstudio.com/items?itemName=unoplatform.uno-platform-addin-2022"
]
}

View File

@ -0,0 +1,15 @@
<Project>
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<!--
Adding NoWarn to remove build warnings
NU1507: Warning when there are multiple package sources when using CPM with no source mapping
NETSDK1201: Warning that specifying RID won't create self containing app
PRI257: Ignore default language (en) not being one of the included resources (eg en-us, en-uk)
-->
<NoWarn>$(NoWarn);NU1507;NETSDK1201;PRI257</NoWarn>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,2 @@
<Project>
</Project>

View File

@ -0,0 +1,18 @@
<Project ToolsVersion="15.0">
<!--
To update the version of Uno, you should instead update the Sdk version in the global.json file.
See https://aka.platform.uno/using-uno-sdk for more information.
See https://aka.platform.uno/using-uno-sdk#implicit-packages for more information regarding the Implicit Packages.
-->
<ItemGroup>
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="NUnit" Version="4.1.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Uno.UITest.Helpers" Version="1.1.0-dev.70" />
<PackageVersion Include="Xamarin.UITest" Version="4.3.4" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
namespace FrontendPlaformUno.Tests;
public class AppInfoTests
{
[SetUp]
public void Setup()
{
}
[Test]
public void AppInfoCreation()
{
var appInfo = new AppConfig { Environment = "Test" };
appInfo.Should().NotBeNull();
appInfo.Environment.Should().Be("Test");
}
}

View File

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="coverlet.collector" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FrontendPlaformUno\FrontendPlaformUno.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,3 @@
global using FluentAssertions;
global using FrontendPlaformUno.Models;
global using NUnit.Framework;

View File

@ -0,0 +1,12 @@
namespace FrontendPlaformUno.UITests;
public class Constants
{
public readonly static string WebAssemblyDefaultUri = "http://localhost:5000/";
public readonly static string iOSAppName = "es.brentj.FrontendPlaformUno";
public readonly static string AndroidAppName = "es.brentj.FrontendPlaformUno";
public readonly static string iOSDeviceNameOrId = "iPad Pro (12.9-inch) (3rd generation)";
public readonly static Platform CurrentPlatform = Platform.Browser;
public readonly static Browser WebAssemblyBrowser = Browser.Chrome;
}

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Uno.UITest.Helpers" />
<PackageReference Include="Xamarin.UITest" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,25 @@
namespace FrontendPlaformUno.UITests;
public class Given_MainPage : TestBase
{
[Test]
public async Task When_SmokeTest()
{
// NOTICE
// To run UITests, Run the WASM target without debugger. Note
// the port that is being used and update the Constants.cs file
// in the UITests project with the correct port number.
// Add delay to allow for the splash screen to disappear
await Task.Delay(5000);
// Query for the SecondPageButton and then tap it
Query xamlButton = q => q.All().Marked("SecondPageButton");
App.WaitForElement(xamlButton);
App.Tap(xamlButton);
// Take a screenshot and add it to the test results
TakeScreenshot("After tapped");
}
}

View File

@ -1,7 +1,5 @@

global using NUnit.Framework;
global using Uno.UITest;
global using Uno.UITest.Helpers.Queries;
global using Uno.UITests.Helpers;
global using Query = System.Func<Uno.UITest.IAppQuery, Uno.UITest.IAppQuery>;

View File

@ -0,0 +1,82 @@
namespace FrontendPlaformUno.UITests;
public class TestBase
{
private IApp? _app;
static TestBase()
{
AppInitializer.TestEnvironment.AndroidAppName = Constants.AndroidAppName;
AppInitializer.TestEnvironment.WebAssemblyDefaultUri = Constants.WebAssemblyDefaultUri;
AppInitializer.TestEnvironment.iOSAppName = Constants.iOSAppName;
AppInitializer.TestEnvironment.AndroidAppName = Constants.AndroidAppName;
AppInitializer.TestEnvironment.iOSDeviceNameOrId = Constants.iOSDeviceNameOrId;
AppInitializer.TestEnvironment.CurrentPlatform = Constants.CurrentPlatform;
AppInitializer.TestEnvironment.WebAssemblyBrowser = Constants.WebAssemblyBrowser;
#if DEBUG
AppInitializer.TestEnvironment.WebAssemblyHeadless = false;
#endif
// Start the app only once, so the tests runs don't restart it
// and gain some time for the tests.
AppInitializer.ColdStartApp();
}
protected IApp App
{
get => _app!;
private set
{
_app = value;
Uno.UITest.Helpers.Queries.Helpers.App = value;
}
}
[SetUp]
public void SetUpTest()
{
App = AppInitializer.AttachToApp();
}
[TearDown]
public void TearDownTest()
{
TakeScreenshot("teardown");
}
public FileInfo TakeScreenshot(string stepName)
{
var title = $"{TestContext.CurrentContext.Test.Name}_{stepName}"
.Replace(" ", "_")
.Replace(".", "_");
var fileInfo = App.Screenshot(title);
var fileNameWithoutExt = Path.GetFileNameWithoutExtension(fileInfo.Name);
if (fileNameWithoutExt != title && fileInfo.DirectoryName != null)
{
var destFileName = Path
.Combine(fileInfo.DirectoryName, title + Path.GetExtension(fileInfo.Name));
if (File.Exists(destFileName))
{
File.Delete(destFileName);
}
File.Move(fileInfo.FullName, destFileName);
TestContext.AddTestAttachment(destFileName, stepName);
fileInfo = new FileInfo(destFileName);
}
else
{
TestContext.AddTestAttachment(fileInfo.FullName, stepName);
}
return fileInfo;
}
}

View File

@ -0,0 +1,58 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35312.102
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FrontendPlaformUno", "FrontendPlaformUno\FrontendPlaformUno.csproj", "{5EA00281-83BD-4B28-8D2A-7FBF5FA5C951}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{E17EEAED-92DF-4399-A1AD-E90914D44955}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontendPlaformUno.UITests", "FrontendPlaformUno.UITests\FrontendPlaformUno.UITests.csproj", "{07B45AB6-6827-444D-918A-C5C3E42A173D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontendPlaformUno.Tests", "FrontendPlaformUno.Tests\FrontendPlaformUno.Tests.csproj", "{77538902-6BAD-4164-AF66-5DE8317661F4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8A8F1605-47C4-4E3E-8D6D-768654BD3DE7}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
Directory.Packages.props = Directory.Packages.props
global.json = global.json
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5EA00281-83BD-4B28-8D2A-7FBF5FA5C951}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5EA00281-83BD-4B28-8D2A-7FBF5FA5C951}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5EA00281-83BD-4B28-8D2A-7FBF5FA5C951}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{5EA00281-83BD-4B28-8D2A-7FBF5FA5C951}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5EA00281-83BD-4B28-8D2A-7FBF5FA5C951}.Release|Any CPU.Build.0 = Release|Any CPU
{5EA00281-83BD-4B28-8D2A-7FBF5FA5C951}.Release|Any CPU.Deploy.0 = Release|Any CPU
{07B45AB6-6827-444D-918A-C5C3E42A173D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{07B45AB6-6827-444D-918A-C5C3E42A173D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{07B45AB6-6827-444D-918A-C5C3E42A173D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{07B45AB6-6827-444D-918A-C5C3E42A173D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{07B45AB6-6827-444D-918A-C5C3E42A173D}.Release|Any CPU.Build.0 = Release|Any CPU
{07B45AB6-6827-444D-918A-C5C3E42A173D}.Release|Any CPU.Deploy.0 = Release|Any CPU
{77538902-6BAD-4164-AF66-5DE8317661F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{77538902-6BAD-4164-AF66-5DE8317661F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{77538902-6BAD-4164-AF66-5DE8317661F4}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{77538902-6BAD-4164-AF66-5DE8317661F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{77538902-6BAD-4164-AF66-5DE8317661F4}.Release|Any CPU.Build.0 = Release|Any CPU
{77538902-6BAD-4164-AF66-5DE8317661F4}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{07B45AB6-6827-444D-918A-C5C3E42A173D} = {E17EEAED-92DF-4399-A1AD-E90914D44955}
{77538902-6BAD-4164-AF66-5DE8317661F4} = {E17EEAED-92DF-4399-A1AD-E90914D44955}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C100779A-C536-48D0-8B2B-2D39626AE74C}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,29 @@
<Application x:Class="FrontendPlaformUno.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:utum="using:Uno.Toolkit.UI.Material">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- Load WinUI resources -->
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<utum:MaterialToolkitTheme
ColorOverrideSource="ms-appx:///Styles/ColorPaletteOverride.xaml">
<!-- NOTE: You can override the default Roboto font by providing your font assets here. -->
<!-- <utum:MaterialToolkitTheme.FontOverrideDictionary>
<ResourceDictionary>
<FontFamily x:Key="MaterialLightFontFamily">ms-appx:///Uno.Fonts.Roboto/Fonts/Roboto-Light.ttf#Roboto</FontFamily>
<FontFamily x:Key="MaterialMediumFontFamily">ms-appx:///Uno.Fonts.Roboto/Fonts/Roboto-Medium.ttf#Roboto</FontFamily>
<FontFamily x:Key="MaterialRegularFontFamily">ms-appx:///Uno.Fonts.Roboto/Fonts/Roboto-Regular.ttf#Roboto</FontFamily>
</ResourceDictionary>
</utum:MaterialToolkitTheme.FontOverrideDictionary> -->
</utum:MaterialToolkitTheme>
</ResourceDictionary.MergedDictionaries>
<!-- Add resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@ -0,0 +1,199 @@
using FrontendPlaformUno.Services.Endpoints.Gamenight;
using FrontendPlaformUno.Services.Endpoints.Gamenight.Login;
using Uno.Resizetizer;
namespace FrontendPlaformUno;
public class GamenightEndpointOptions : EndpointOptions
{
public string? ApiKey { get; init; }
}
public partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
}
protected Window? MainWindow { get; private set; }
protected IHost? Host { get; private set; }
protected async override void OnLaunched(LaunchActivatedEventArgs args)
{
var builder = this.CreateBuilder(args)
// Add navigation support for toolkit controls such as TabBar and NavigationView
.UseToolkitNavigation()
.Configure(host => host
#if DEBUG
// Switch to Development environment when running in DEBUG
.UseEnvironment(Environments.Development)
#endif
.UseLogging(configure: (context, logBuilder) =>
{
// Configure log levels for different categories of logging
logBuilder
.SetMinimumLevel(
context.HostingEnvironment.IsDevelopment() ?
LogLevel.Information :
LogLevel.Warning)
// Default filters for core Uno Platform namespaces
.CoreLogLevel(LogLevel.Warning);
// Uno Platform namespace filter groups
// Uncomment individual methods to see more detailed logging
//// Generic Xaml events
//logBuilder.XamlLogLevel(LogLevel.Debug);
//// Layout specific messages
//logBuilder.XamlLayoutLogLevel(LogLevel.Debug);
//// Storage messages
//logBuilder.StorageLogLevel(LogLevel.Debug);
//// Binding related messages
//logBuilder.XamlBindingLogLevel(LogLevel.Debug);
//// Binder memory references tracking
//logBuilder.BinderMemoryReferenceLogLevel(LogLevel.Debug);
//// DevServer and HotReload related
//logBuilder.HotReloadCoreLogLevel(LogLevel.Information);
//// Debug JS interop
//logBuilder.WebAssemblyLogLevel(LogLevel.Debug);
}, enableUnoLogging: true)
.UseConfiguration(configure: configBuilder =>
configBuilder
.EmbeddedSource<App>()
.Section<AppConfig>()
)
// Enable localization (see appsettings.json for supported languages)
.UseLocalization()
// Register Json serializers (ISerializer and ISerializer)
.UseSerialization((context, services) => services
.AddContentSerializer(context)
.AddJsonTypeInfo(WeatherForecastContext.Default.IImmutableListWeatherForecast))
.UseHttp((context, services) => services
// Register HttpClient
#if DEBUG
// DelegatingHandler will be automatically injected into Refit Client
.AddTransient<DelegatingHandler, DebugHttpHandler>()
#endif
.AddSingleton<IWeatherCache, WeatherCache>()
.AddRefitClient<IApiClient>(context)
.AddRefitClientWithEndpoint<IGamenightApi, GamenightEndpointOptions>(
context,
configure: (builder, options) => builder
.ConfigureHttpClient(HttpClient =>
{
HttpClient.BaseAddress = new Uri("http://localhost:8080/");
}
)
))
.UseAuthentication(auth =>
auth.AddCustom(custom =>
custom
.Login(async (sp, dispatcher, credentials, cancellationToken) =>
{
// TODO: Write code to process credentials that are passed into the LoginAsync method
var gamenightApi = sp.GetRequiredService<IGamenightApi>();
string? username = "";
string? password = "";
var hasUsername = credentials?.TryGetValue(nameof(LoginModel.Username), out username) ?? false;
var hasPassword = credentials?.TryGetValue(nameof(LoginModel.Password), out password) ?? false;
if (!hasUsername || !hasPassword)
{
return credentials;
}
var apiResponse = await gamenightApi.Login(new LoginRequest { Username = username!, Password = password! }, cancellationToken);
if (apiResponse.IsSuccessStatusCode && apiResponse.Content is LoginResponse loginResponse)
{
// Return IDictionary containing any tokens used by service calls or in the app
credentials ??= new Dictionary<string, string>();
credentials[TokenCacheExtensions.AccessTokenKey] = "SampleToken";
credentials[TokenCacheExtensions.RefreshTokenKey] = "RefreshToken";
credentials["Expiry"] = DateTime.Now.AddMinutes(5).ToString("g");
return credentials;
}
// Return null/default to fail the LoginAsync method
return default;
})
.Refresh((sp, tokenDictionary, cancellationToken) =>
{
// TODO: Write code to refresh tokens using the currently stored tokens
if ((tokenDictionary?.TryGetValue(TokenCacheExtensions.RefreshTokenKey, out var refreshToken) ?? false) &&
!refreshToken.IsNullOrEmpty() &&
(tokenDictionary?.TryGetValue("Expiry", out var expiry) ?? false) &&
DateTime.TryParse(expiry, out var tokenExpiry) &&
tokenExpiry > DateTime.Now)
{
// Return IDictionary containing any tokens used by service calls or in the app
tokenDictionary ??= new Dictionary<string, string>();
tokenDictionary[TokenCacheExtensions.AccessTokenKey] = "NewSampleToken";
tokenDictionary["Expiry"] = DateTime.Now.AddMinutes(5).ToString("g");
return ValueTask.FromResult<IDictionary<string, string>?>(tokenDictionary);
}
// Return null/default to fail the Refresh method
return ValueTask.FromResult<IDictionary<string, string>?>(default);
}), name: "CustomAuth")
)
.ConfigureServices((context, services) =>
{
// TODO: Register your services
//services.AddSingleton<IMyService, MyService>();
})
.UseNavigation(ReactiveViewModelMappings.ViewModelMappings, RegisterRoutes)
);
MainWindow = builder.Window;
#if DEBUG
MainWindow.EnableHotReload();
#endif
MainWindow.SetWindowIcon();
Host = await builder.NavigateAsync<Shell>
(initialNavigate: async (services, navigator) =>
{
var auth = services.GetRequiredService<IAuthenticationService>();
var authenticated = await auth.RefreshAsync();
if (authenticated)
{
await navigator.NavigateViewModelAsync<MainModel>(this, qualifier: Qualifiers.Nested);
}
else
{
await navigator.NavigateViewModelAsync<LoginModel>(this, qualifier: Qualifiers.Nested);
}
});
}
private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes)
{
views.Register(
new ViewMap(ViewModel: typeof(ShellModel)),
new ViewMap<LoginPage, LoginModel>(),
new ViewMap<MainPage, MainModel>(),
new DataViewMap<SecondPage, SecondModel, Entity>()
);
routes.Register(
new RouteMap("", View: views.FindByViewModel<ShellModel>(),
Nested:
[
new ("Login", View: views.FindByViewModel<LoginModel>()),
new ("Main", View: views.FindByViewModel<MainModel>(), IsDefault:true),
new ("Second", View: views.FindByViewModel<SecondModel>()),
]
)
);
}
}

View File

@ -5,7 +5,7 @@
viewBox="0 0 456 456"
version="1.1"
id="svg453"
sodipodi:docname="iconapp.old.svg"
sodipodi:docname="icon.svg"
inkscape:version="1.2 (dc2aedaf03, 2022-05-15)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -5,7 +5,7 @@
viewBox="0 0 50.369617 49.826836"
version="1.1"
id="svg151"
sodipodi:docname="appconfig.svg"
sodipodi:docname="icon_foreground.svg"
inkscape:version="1.2 (dc2aedaf03, 2022-05-15)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 188 B

View File

@ -0,0 +1,32 @@
# Shared Assets
See documentation about assets here: https://github.com/unoplatform/uno/blob/master/doc/articles/features/working-with-assets.md
## Here is a cheat sheet
1. Add the image file to the `Assets` directory of a shared project.
2. Set the build action to `Content`.
3. (Recommended) Provide an asset for various scales/dpi
### Examples
```text
\Assets\Images\logo.scale-100.png
\Assets\Images\logo.scale-200.png
\Assets\Images\logo.scale-400.png
\Assets\Images\scale-100\logo.png
\Assets\Images\scale-200\logo.png
\Assets\Images\scale-400\logo.png
```
### Table of scales
| Scale | WinUI | iOS/MacCatalyst | Android |
|-------|:-----------:|:---------------:|:-------:|
| `100` | scale-100 | @1x | mdpi |
| `125` | scale-125 | N/A | N/A |
| `150` | scale-150 | N/A | hdpi |
| `200` | scale-200 | @2x | xhdpi |
| `300` | scale-300 | @3x | xxhdpi |
| `400` | scale-400 | N/A | xxxhdpi |

View File

@ -5,7 +5,7 @@
viewBox="0 0 50.369617 49.826836"
version="1.1"
id="svg151"
sodipodi:docname="appconfig.svg"
sodipodi:docname="icon_foreground.svg"
inkscape:version="1.2 (dc2aedaf03, 2022-05-15)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -0,0 +1,57 @@
<Project Sdk="Uno.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst;net8.0-windows10.0.19041;net8.0-browserwasm;net8.0-desktop;net8.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<UnoSingleProject>true</UnoSingleProject>
<!-- Display name -->
<ApplicationTitle>FrontendPlaformUno</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>es.brentj.FrontendPlaformUno</ApplicationId>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<!-- Package Publisher -->
<ApplicationPublisher>dbren</ApplicationPublisher>
<!-- Package Description -->
<Description>FrontendPlaformUno powered by Uno Platform.</Description>
<!--
If you encounter this error message:
error NETSDK1148: A referenced assembly was compiled using a newer version of Microsoft.Windows.SDK.NET.dll.
Please update to a newer .NET SDK in order to reference this assembly.
This means that the two packages below must be aligned with the "build" version number of
the "Microsoft.Windows.SDK.BuildTools" package above, and the "revision" version number
must be the highest found in https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref.
-->
<!-- <WindowsSdkPackageVersion>10.0.22621.28</WindowsSdkPackageVersion> -->
<!--
UnoFeatures let's you quickly add and manage implicit package references based on the features you want to use.
https://aka.platform.uno/singleproject-features
-->
<UnoFeatures>
Material;
Dsp;
Hosting;
Toolkit;
Logging;
MVUX;
Configuration;
Http;
Serialization;
Localization;
Authentication;
Navigation;
ThemeService;
</UnoFeatures>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug' or '$(IsUiAutomationMappingEnabled)'=='True'">
<IsUiAutomationMappingEnabled>True</IsUiAutomationMappingEnabled>
<DefineConstants>$(DefineConstants);USE_UITESTS</DefineConstants>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,13 @@
global using System.Collections.Immutable;
global using FrontendPlaformUno.DataContracts;
global using FrontendPlaformUno.DataContracts.Serialization;
global using FrontendPlaformUno.Models;
global using FrontendPlaformUno.Presentation;
global using FrontendPlaformUno.Services.Caching;
global using FrontendPlaformUno.Services.Endpoints;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Hosting;
global using Microsoft.Extensions.Localization;
global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Options;
global using ApplicationExecutionState = Windows.ApplicationModel.Activation.ApplicationExecutionState;

View File

@ -0,0 +1,5 @@
namespace FrontendPlaformUno;
internal interface IGameNightOptions
{
}

View File

@ -0,0 +1,6 @@
namespace FrontendPlaformUno.Models;
public record AppConfig
{
public string? Environment { get; init; }
}

View File

@ -0,0 +1,3 @@
namespace FrontendPlaformUno.Models;
public record Entity(string Name);

View File

@ -0,0 +1,15 @@
namespace FrontendPlaformUno.DataContracts;
/// <summary>
/// A Weather Forecast for a specific date
/// </summary>
/// <param name="Date">Gets the Date of the Forecast.</param>
/// <param name="TemperatureC">Gets the Forecast Temperature in Celsius.</param>
/// <param name="Summary">Get a description of how the weather will feel.</param>
public record WeatherForecast(DateOnly Date, double TemperatureC, string? Summary)
{
/// <summary>
/// Gets the Forecast Temperature in Fahrenheit
/// </summary>
public double TemperatureF => 32 + (TemperatureC * 9 / 5);
}

View File

@ -1,20 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">
<Identity
Name="AD86FCB5-C937-4374-872D-E0A1DF919E74"
Publisher="O=FrontendPlatformUno"
Version="1.0.0.0" />
<Properties>
<DisplayName>FrontendPlatformUno</DisplayName>
<PublisherDisplayName>FrontendPlatformUno</PublisherDisplayName>
</Properties>
<Identity />
<Properties />
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
@ -29,11 +21,7 @@
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="FrontendPlatformUno"
Description="FrontendPlatformUno">
<uap:SplashScreen BackgroundColor="#086AD1"/>
</uap:VisualElements>
<uap:VisualElements />
</Application>
</Applications>

View File

@ -4,7 +4,7 @@ in the shared project instead. Assets in this folder are Android-only assets.
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "AndroidAsset".
These files will be deployed with you package and will be accessible using Android's
These files will be deployed with your package and will be accessible using Android's
AssetManager, like this:
public class ReadAsset : Activity

View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Com.Nostra13.Universalimageloader.Core;
using Microsoft.UI.Xaml.Media;
namespace FrontendPlaformUno.Droid;
[global::Android.App.ApplicationAttribute(
Label = "@string/ApplicationName",
Icon = "@mipmap/icon",
LargeHeap = true,
HardwareAccelerated = true,
Theme = "@style/AppTheme"
)]
public class Application : Microsoft.UI.Xaml.NativeApplication
{
public Application(IntPtr javaReference, JniHandleOwnership transfer)
: base(() => new App(), javaReference, transfer)
{
ConfigureUniversalImageLoader();
}
private static void ConfigureUniversalImageLoader()
{
// Create global configuration and initialize ImageLoader with this config
ImageLoaderConfiguration config = new ImageLoaderConfiguration
.Builder(Context)
.Build();
ImageLoader.Instance.Init(config);
ImageSource.DefaultImageLoader = ImageLoader.Instance.LoadImageAsync;
}
}

View File

@ -0,0 +1,15 @@
using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Views;
using Android.Widget;
namespace FrontendPlaformUno.Droid;
[Activity(
MainLauncher = true,
ConfigurationChanges = global::Uno.UI.ActivityHelper.AllConfigChanges,
WindowSoftInputMode = SoftInput.AdjustNothing | SoftInput.StateHidden
)]
public class MainActivity : Microsoft.UI.Xaml.ApplicationActivity
{
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="Hello">Hello World, Click Me!</string>
<string name="ApplicationName">FrontendPlatformUno</string>
<string name="ApplicationName">FrontendPlaformUno</string>
</resources>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light">
<style name="AppTheme" parent="Theme.MaterialComponents.Light">
<!-- This removes the ActionBar -->
<item name="windowActionBar">false</item>
@ -8,12 +8,11 @@
<item name="windowNoTitle">true</item>
<item name="android:windowNoTitle">true</item>
<!-- uno_splash_color and uno_splash_image are generated by Uno.Resizetizer -->
<!-- This property is used for the splash screen -->
<item name="android:windowSplashScreenBackground">#FFFFFF</item>
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_screen</item>
<!--<item name="android:windowSplashScreenBehavior">1</item>-->
<item name="android:windowSplashScreenBackground">@color/uno_splash_color</item>
<item name="android:windowBackground">@drawable/uno_splash_image</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/uno_splash_image</item>
</style>
<style name="Theme.AppCompat.Translucent">
<item name="android:windowIsTranslucent">true</item>

View File

@ -0,0 +1,19 @@
using Uno.UI.Runtime.Skia;
namespace FrontendPlaformUno;
public class Program
{
[STAThread]
public static void Main(string[] args)
{
var host = SkiaHostBuilder.Create()
.App(() => new App())
.UseX11()
.UseLinuxFrameBuffer()
.UseMacOS()
.UseWindows()
.Build();
host.Run();
}
}

View File

@ -8,8 +8,6 @@
</array>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
@ -17,13 +15,12 @@
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Media.xcassets/iconapp.appiconset</string>
<string>Assets.xcassets/icon.appiconset</string>
<!--
Adjust this to your application's encryption usage.
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
-->
</dict>
</plist>

View File

@ -0,0 +1,13 @@
using UIKit;
namespace FrontendPlaformUno.MacCatalyst;
public class EntryPoint
{
// This is the main entry point of the application.
public static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(App));
}
}

View File

@ -0,0 +1,10 @@
<linker>
<assembly fullname="FrontendPlaformUno" />
<!--
Uncomment this section when using JSON.NET
<assembly fullname="System.Core">
<type fullname="System.Linq.Expressions*" />
</assembly>
-->
</linker>

View File

@ -0,0 +1,13 @@
namespace FrontendPlaformUno;
public class Program
{
private static App? _app;
public static int Main(string[] args)
{
Microsoft.UI.Xaml.Application.Start(_ => _app = new App());
return 0;
}
}

View File

@ -6,7 +6,7 @@
/* https://github.com/unoplatform/uno/issues/3954 */
@font-face {
font-family: 'Segoe UI';
src: local('system-ui'), local('Segoe UI'), local('-apple-system'), local('BlinkMacSystemFont'), local('Inter'), local('Cantarell'), local('Ubuntu'), local('Roboto'), local('Open Sans'), local('Noto Sans'), local('Helvetica Neue'), local('sans-serif');
src: local('Segoe UI'), local('-apple-system'), local('BlinkMacSystemFont'), local('Inter'), local('Cantarell'), local('Ubuntu'), local('Roboto'), local('Open Sans'), local('Noto Sans'), local('Helvetica Neue'), local('sans-serif');
}
@font-face {

View File

@ -0,0 +1,3 @@
var UnoAppManifest = {
displayName: "FrontendPlaformUno"
}

View File

@ -1,9 +1,9 @@
{
"background_color": "#ffffff",
"description": "FrontendPlatformUno",
"description": "FrontendPlaformUno",
"display": "standalone",
"name": "FrontendPlatformUno",
"short_name": "FrontendPlatformUno",
"name": "FrontendPlaformUno",
"short_name": "FrontendPlaformUno",
"start_url": "/index.html",
"theme_color": "#ffffff",
"scope": "/"

View File

@ -9,8 +9,6 @@
<integer>1</integer>
<integer>2</integer>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
@ -31,14 +29,8 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UILaunchImageMinimumOSVersion</key>
<string>9.0</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{320, 568}</string>
<key>XSAppIconAssets</key>
<string>Media.xcassets/iconapp.appiconset</string>
<string>Assets.xcassets/icon.appiconset</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>

View File

@ -0,0 +1,13 @@
using UIKit;
namespace FrontendPlaformUno.iOS;
public class EntryPoint
{
// This is the main entry point of the application.
public static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(App));
}
}

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- see https://aka.platform/uno/apple-privacy-manifest for more information -->
<!-- .NET Runtime/BCL -->
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>E174.1</string>
</array>
</dict>
<!-- NSUserDefaults -->
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict>
</plist>

View File

@ -0,0 +1,23 @@
namespace FrontendPlaformUno.Presentation;
public partial record LoginModel(IDispatcher Dispatcher, INavigator Navigator, IAuthenticationService Authentication)
{
public string Title { get; } = "Login";
public IState<string> Username => State<string>.Value(this, () => string.Empty);
public IState<string> Password => State<string>.Value(this, () => string.Empty);
public async ValueTask Login(CancellationToken token)
{
var username = await Username ?? string.Empty;
var password = await Password ?? string.Empty;
var success = await Authentication.LoginAsync(Dispatcher, new Dictionary<string, string> { { nameof(Username), username }, { nameof(Password), password } });
if (success)
{
await Navigator.NavigateViewModelAsync<MainModel>(this, qualifier: Qualifiers.ClearBackStack);
}
}
}

View File

@ -0,0 +1,37 @@
<Page x:Class="FrontendPlaformUno.Presentation.LoginPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FrontendPlaformUno.Presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:uen="using:Uno.Extensions.Navigation.UI"
xmlns:utu="using:Uno.Toolkit.UI"
xmlns:um="using:Uno.Material"
mc:Ignorable="d"
NavigationCacheMode="Required"
Background="{ThemeResource BackgroundBrush}">
<Grid utu:SafeArea.Insets="VisibleBounds">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<utu:NavigationBar Content="{Binding Title}" />
<StackPanel Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="200"
Spacing="16">
<TextBox Text="{Binding Username, Mode=TwoWay}"
PlaceholderText="Username"
HorizontalAlignment="Stretch" />
<PasswordBox Password="{Binding Password, Mode=TwoWay}"
PlaceholderText="Password"
HorizontalAlignment="Stretch" />
<Button Content="Login"
Command="{Binding Login}"
HorizontalAlignment="Stretch" />
</StackPanel>
</Grid>
</Page>

View File

@ -0,0 +1,9 @@
namespace FrontendPlaformUno.Presentation;
public sealed partial class LoginPage : Page
{
public LoginPage()
{
this.InitializeComponent();
}
}

View File

@ -0,0 +1,36 @@
namespace FrontendPlaformUno.Presentation;
public partial record MainModel
{
private INavigator _navigator;
public MainModel(
IStringLocalizer localizer,
IOptions<AppConfig> appInfo,
IAuthenticationService authentication,
INavigator navigator)
{
_navigator = navigator;
_authentication = authentication;
Title = "Main";
Title += $" - {localizer["ApplicationName"]}";
Title += $" - {appInfo?.Value?.Environment}";
}
public string? Title { get; }
public IState<string> Name => State<string>.Value(this, () => string.Empty);
public async Task GoToSecond()
{
var name = await Name;
await _navigator.NavigateViewModelAsync<SecondModel>(this, data: new Entity(name!));
}
public async ValueTask Logout(CancellationToken token)
{
await _authentication.LogoutAsync(token);
}
private IAuthenticationService _authentication;
}

View File

@ -0,0 +1,32 @@
<Page x:Class="FrontendPlaformUno.Presentation.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FrontendPlaformUno.Presentation"
xmlns:uen="using:Uno.Extensions.Navigation.UI"
xmlns:utu="using:Uno.Toolkit.UI"
xmlns:um="using:Uno.Material"
NavigationCacheMode="Required"
Background="{ThemeResource BackgroundBrush}">
<ScrollViewer>
<Grid utu:SafeArea.Insets="VisibleBounds">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<utu:NavigationBar Content="{Binding Title}" />
<StackPanel Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="16">
<TextBox Text="{Binding Name, Mode=TwoWay}"
PlaceholderText="Enter your name:" />
<Button Content="Go to Second Page"
AutomationProperties.AutomationId="SecondPageButton"
Command="{Binding GoToSecond}" />
<Button Content="Logout"
Command="{Binding Logout}" />
</StackPanel>
</Grid>
</ScrollViewer>
</Page>

View File

@ -0,0 +1,9 @@
namespace FrontendPlaformUno.Presentation;
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
}

View File

@ -0,0 +1,5 @@
namespace FrontendPlaformUno.Presentation;
public partial record SecondModel(Entity Entity)
{
}

View File

@ -0,0 +1,36 @@
<Page x:Class="FrontendPlaformUno.Presentation.SecondPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FrontendPlaformUno.Presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:uen="using:Uno.Extensions.Navigation.UI"
xmlns:utu="using:Uno.Toolkit.UI"
xmlns:um="using:Uno.Material"
Background="{ThemeResource BackgroundBrush}">
<Grid utu:SafeArea.Insets="VisibleBounds">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<utu:NavigationBar Content="Second Page">
<utu:NavigationBar.MainCommand>
<AppBarButton>
<AppBarButton.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/Images/back.png" />
</AppBarButton.Icon>
</AppBarButton>
</utu:NavigationBar.MainCommand>
</utu:NavigationBar>
<StackPanel Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<TextBlock Text="{Binding Entity.Name}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="8" />
</StackPanel>
</Grid>
</Page>

View File

@ -0,0 +1,10 @@
namespace FrontendPlaformUno.Presentation;
public sealed partial class SecondPage : Page
{
public SecondPage()
{
this.InitializeComponent();
}
}

View File

@ -0,0 +1,36 @@
<UserControl x:Class="FrontendPlaformUno.Presentation.Shell"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FrontendPlaformUno.Presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:utu="using:Uno.Toolkit.UI"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<Border Background="{ThemeResource BackgroundBrush}">
<utu:ExtendedSplashScreen x:Name="Splash"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<utu:ExtendedSplashScreen.LoadingContentTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*" />
<RowDefinition />
</Grid.RowDefinitions>
<ProgressRing IsActive="True"
Grid.Row="1"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Height="100"
Width="100" />
</Grid>
</DataTemplate>
</utu:ExtendedSplashScreen.LoadingContentTemplate>
</utu:ExtendedSplashScreen>
</Border>
</UserControl>

View File

@ -0,0 +1,10 @@
namespace FrontendPlaformUno.Presentation;
public sealed partial class Shell : UserControl, IContentControlProvider
{
public Shell()
{
this.InitializeComponent();
}
public ContentControl ContentControl => Splash;
}

View File

@ -0,0 +1,22 @@
namespace FrontendPlaformUno.Presentation;
public class ShellModel
{
private readonly INavigator _navigator;
public ShellModel(
IAuthenticationService authentication,
INavigator navigator)
{
_navigator = navigator;
_authentication = authentication;
_authentication.LoggedOut += LoggedOut;
}
private async void LoggedOut(object? sender, EventArgs e)
{
await _navigator.NavigateViewModelAsync<LoginModel>(this, qualifier: Qualifiers.ClearBackStack);
}
private readonly IAuthenticationService _authentication;
}

View File

@ -6,15 +6,17 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>arm64</Platform>
<RuntimeIdentifier>win10-arm64</RuntimeIdentifier>
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<!-- Note: Trimming disabled by default as there may still be an issues with PublishTrimmed support: https://github.com/microsoft/CsWinRT/issues/373 -->
<!--
See https://github.com/microsoft/CsWinRT/issues/373
<PublishTrimmed>True</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
<TrimMode>partial</TrimMode>
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
-->
</PropertyGroup>
</Project>

View File

@ -6,15 +6,17 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x64</Platform>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<!-- Note: Trimming disabled by default as there may still be an issues with PublishTrimmed support: https://github.com/microsoft/CsWinRT/issues/373 -->
<!--
See https://github.com/microsoft/CsWinRT/issues/373
<PublishTrimmed>True</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
<TrimMode>partial</TrimMode>
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
-->
</PropertyGroup>
</Project>

View File

@ -6,15 +6,17 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x86</Platform>
<RuntimeIdentifier>win10-x86</RuntimeIdentifier>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<!-- Note: Trimming disabled by default as there may still be an issues with PublishTrimmed support: https://github.com/microsoft/CsWinRT/issues/373 -->
<!--
See https://github.com/microsoft/CsWinRT/issues/373
<PublishTrimmed>True</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
<TrimMode>partial</TrimMode>
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
-->
</PropertyGroup>
</Project>

View File

@ -0,0 +1,50 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:8080",
"sslPort": 0
}
},
"profiles": {
// This profile is first in order for dotnet run to pick it up by default
"FrontendPlaformUno (WebAssembly)": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5000",
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"FrontendPlaformUno (WebAssembly IIS Express)": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
// Note: In order to select this profile, you'll need to comment the `Packaged` profile below until this is fixed: https://aka.platform.uno/wasdk-maui-debug-profile-issue
"FrontendPlaformUno (WinAppSDK Unpackaged)": {
"commandName": "Project",
"compatibleTargetFramework": "windows"
},
"FrontendPlaformUno (WinAppSDK Packaged)": {
"commandName": "MsixPackage",
"compatibleTargetFramework": "windows"
},
"FrontendPlaformUno (Desktop)": {
"commandName": "Project",
"compatibleTargetFramework": "desktop"
},
"FrontendPlaformUno (Desktop WSL2)": {
"commandName": "WSL2",
"commandLineArgs": "{ProjectDir}/bin/Debug/net8.0-desktop/FrontendPlaformUno.dll",
"distributionName": "",
"compatibleTargetFramework": "desktop"
}
}
}

View File

@ -0,0 +1,7 @@
# Getting Started
Welcome to the Uno Platform!
To discover how to get started with your new app: https://aka.platform.uno/get-started
For more information on how to use the Uno.Sdk or upgrade Uno Platform packages in your solution: https://aka.platform.uno/using-uno-sdk

View File

@ -0,0 +1,23 @@
using System.Collections.Immutable;
using System.Text.Json.Serialization;
namespace FrontendPlaformUno.DataContracts.Serialization;
/// <summary>
/// Generated class for System.Text.Json Serialization
/// </summary>
/// <remarks>
/// When using the JsonSerializerContext you must add the JsonSerializableAttribute
/// for each type that you may need to serialize / deserialize including both the
/// concrete type and any interface that the concrete type implements.
/// For more information on the JsonSerializerContext see:
/// https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/source-generation?WT.mc_id=DT-MVP-5002924
/// </remarks>
[JsonSerializable(typeof(WeatherForecast))]
[JsonSerializable(typeof(WeatherForecast[]))]
[JsonSerializable(typeof(IEnumerable<WeatherForecast>))]
[JsonSerializable(typeof(IImmutableList<WeatherForecast>))]
[JsonSerializable(typeof(ImmutableList<WeatherForecast>))]
[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase)]
public partial class WeatherForecastContext : JsonSerializerContext
{
}

View File

@ -0,0 +1,6 @@
namespace FrontendPlaformUno.Services.Caching;
public interface IWeatherCache
{
ValueTask<IImmutableList<WeatherForecast>> GetForecast(CancellationToken token);
}

View File

@ -0,0 +1,76 @@
using System.Net;
namespace FrontendPlaformUno.Services.Caching;
public sealed class WeatherCache : IWeatherCache
{
private readonly IApiClient _api;
private readonly ISerializer _serializer;
private readonly ILogger _logger;
public WeatherCache(IApiClient api, ISerializer serializer, ILogger<WeatherCache> logger)
{
_api = api;
_serializer = serializer;
_logger = logger;
}
private bool IsConnected => NetworkInformation.GetInternetConnectionProfile().GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess;
public async ValueTask<IImmutableList<WeatherForecast>> GetForecast(CancellationToken token)
{
var weatherText = await GetCachedWeather(token);
if (!string.IsNullOrWhiteSpace(weatherText))
{
return _serializer.FromString<ImmutableArray<WeatherForecast>>(weatherText);
}
if (!IsConnected)
{
_logger.LogWarning("App is offline and cannot connect to the API.");
throw new WebException("No internet connection", WebExceptionStatus.ConnectFailure);
}
var response = await _api.GetWeather(token);
if (response.IsSuccessStatusCode && response.Content is not null)
{
var weather = response.Content;
await Save(weather, token);
return weather;
}
else if (response.Error is not null)
{
_logger.LogError(response.Error, "An error occurred while retrieving the latest Forecast.");
throw response.Error;
}
else
{
return ImmutableArray<WeatherForecast>.Empty;
}
}
private static async ValueTask<StorageFile> GetFile(CreationCollisionOption option) =>
await ApplicationData.Current.TemporaryFolder.CreateFileAsync("weather.json", option);
private async ValueTask<string?> GetCachedWeather(CancellationToken token)
{
var file = await GetFile(CreationCollisionOption.OpenIfExists);
var properties = await file.GetBasicPropertiesAsync();
// Reuse latest cache file if offline
// or if the file is less than 5 minutes old
if (IsConnected || DateTimeOffset.Now.AddMinutes(-5) > properties.DateModified || token.IsCancellationRequested)
{
return null;
}
return await File.ReadAllTextAsync(file.Path, token);
}
private async ValueTask Save(IImmutableList<WeatherForecast> weather, CancellationToken token)
{
var weatherText = _serializer.ToString(weather);
var file = await GetFile(CreationCollisionOption.ReplaceExisting);
await File.WriteAllTextAsync(file.Path, weatherText, token);
}
}

View File

@ -0,0 +1,44 @@
namespace FrontendPlaformUno.Services.Endpoints;
internal class DebugHttpHandler : DelegatingHandler
{
private readonly ILogger _logger;
public DebugHttpHandler(ILogger<DebugHttpHandler> logger, HttpMessageHandler? innerHandler = null)
: base(innerHandler ?? new HttpClientHandler())
{
_logger = logger;
}
protected async override Task<HttpResponseMessage> SendAsync(
HttpRequestMessage request,
CancellationToken cancellationToken)
{
var response = await base.SendAsync(request, cancellationToken);
#if DEBUG
if (!response.IsSuccessStatusCode)
{
_logger.LogDebugMessage("Unsuccessful API Call");
if (request.RequestUri is not null)
{
_logger.LogDebugMessage($"{request.RequestUri} ({request.Method})");
}
foreach ((var key, var values) in request.Headers.ToDictionary(x => x.Key, x => string.Join(", ", x.Value)))
{
_logger.LogDebugMessage($"{key}: {values}");
}
var content = request.Content is not null ? await request.Content.ReadAsStringAsync() : null;
if (!string.IsNullOrEmpty(content))
{
_logger.LogDebugMessage(content);
}
// Uncomment to automatically break when an API call fails while debugging
// System.Diagnostics.Debugger.Break();
}
#endif
return response;
}
}

View File

@ -0,0 +1 @@
public partial interface IGamenight;

View File

@ -0,0 +1,9 @@
using FrontendPlaformUno.Services.Endpoints.Gamenight.Login;
using Refit;
namespace FrontendPlaformUno.Services.Endpoints.Gamenight;
public partial interface IGamenightApi
{
[Post("/token")]
Task<IApiResponse<LoginResponse>> Login([Header("Content-Type: application/json; charset=UTF-8")] [Body] LoginRequest loginRequest, CancellationToken cancellationToken);
}

View File

@ -0,0 +1,11 @@
using System.Text.Json.Serialization;
namespace FrontendPlaformUno.Services.Endpoints.Gamenight.Login;
public record LoginRequest
{
[JsonPropertyName("username")]
public required string Username { get; init; }
[JsonPropertyName("password")]
public required string Password { get; init; }
}

View File

@ -0,0 +1,18 @@
using System.Text.Json.Serialization;
namespace FrontendPlaformUno.Services.Endpoints.Gamenight.Login;
public record LoginResponse
{
[JsonPropertyName("login_result")]
public required bool LoginResult { get; init; }
[JsonPropertyName("message")]
public string? Message { get; init; }
[JsonPropertyName("user_id")]
public string? UserId { get; init; }
[JsonPropertyName("jwt_token")]
public string? JwtToken { get; init; }
}

View File

@ -0,0 +1,9 @@
using Refit;
namespace FrontendPlaformUno.Services.Endpoints;
[Headers("Content-Type: application/json")]
public interface IApiClient
{
[Get("/api/weatherforecast")]
Task<ApiResponse<IImmutableList<WeatherForecast>>> GetWeather(CancellationToken cancellationToken = default);
}

View File

@ -118,6 +118,6 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ApplicationName" xml:space="preserve">
<value>Gamenight</value>
<value>FrontendPlaformUno-en</value>
</data>
</root>

View File

@ -118,6 +118,6 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ApplicationName" xml:space="preserve">
<value>Gamenight</value>
<value>FrontendPlaformUno-es</value>
</data>
</root>

View File

@ -118,6 +118,6 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ApplicationName" xml:space="preserve">
<value>Gamenight</value>
<value>FrontendPlaformUno-fr</value>
</data>
</root>

View File

@ -118,6 +118,6 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ApplicationName" xml:space="preserve">
<value>Gamenight</value>
<value>FrontendPlaformUno-pt-BR</value>
</data>
</root>

View File

@ -0,0 +1,76 @@
{
"description": "Default Uno Material colors",
"seed": "#5946d2",
"coreColors": {
"primary": "#5946d2",
"secondary": "#6b4ea2"
},
"extendedColors": [],
"schemes": {
"light": {
"primary": "#5946d2",
"surfaceTint": "#5946d2",
"onPrimary": "#ffffff",
"primaryContainer": "#e5deff",
"onPrimaryContainer": "#170065",
"secondary": "#6b4ea2",
"onSecondary": "#ffffff",
"secondaryContainer": "#ebddff",
"onSecondaryContainer": "#220555",
"tertiary": "#0061a4",
"onTertiary": "#ffffff",
"tertiaryContainer": "#cfe4ff",
"onTertiaryContainer": "#001d36",
"error": "#b3261e",
"onError": "#ffffff",
"errorContainer": "#f9dedc",
"onErrorContainer": "#410e0b",
"background": "#fcfbff",
"onBackground": "#1c1b1f",
"surface": "#ffffff",
"onSurface": "#1c1b1f",
"surfaceVariant": "#f2eff5",
"onSurfaceVariant": "#8b8494",
"outline": "#79747e",
"outlineVariant": "#c9c5d0",
"shadow": "#000000",
"scrim": "#000000",
"inverseSurface": "#e6e1e5",
"inverseOnSurface": "#1c1b1f",
"inversePrimary": "#2a009f"
},
"dark": {
"primary": "#c7bfff",
"surfaceTint": "#c7bfff",
"onPrimary": "#2a009f",
"primaryContainer": "#4129ba",
"onPrimaryContainer": "#e4dfff",
"secondary": "#cdc2dc",
"onSecondary": "#332d41",
"secondaryContainer": "#433c52",
"onSecondaryContainer": "#eddfff",
"tertiary": "#9fcaff",
"onTertiary": "#003258",
"tertiaryContainer": "#00497d",
"onTertiaryContainer": "#d1e4ff",
"error": "#ffb4ab",
"onError": "#690005",
"errorContainer": "#93000a",
"onErrorContainer": "#ffdad6",
"background": "#1c1b1f",
"onBackground": "#e5e1e6",
"surface": "#302d37",
"onSurface": "#e6e1e5",
"surfaceVariant": "#47464f",
"onSurfaceVariant": "#c9c5d0",
"outline": "#928f99",
"outlineVariant": "#57545d",
"shadow": "#000000",
"scrim": "#000000",
"inverseSurface": "#e6e1e5",
"inverseOnSurface": "#1c1b1f",
"inversePrimary": "#2a009f"
}
},
"palettes": {}
}

View File

@ -9,7 +9,7 @@
<Color x:Key="SecondaryColor">#6B4EA2</Color>
<Color x:Key="OnSecondaryColor">#FFFFFF</Color>
<Color x:Key="SecondaryContainerColor">#EBDDFF</Color>
<Color x:Key="OnSecondaryContainerColor">#1F182B</Color>
<Color x:Key="OnSecondaryContainerColor">#220555</Color>
<Color x:Key="TertiaryColor">#0061A4</Color>
<Color x:Key="OnTertiaryColor">#FFFFFF</Color>
<Color x:Key="TertiaryContainerColor">#CFE4FF</Color>
@ -22,7 +22,7 @@
<Color x:Key="OnBackgroundColor">#1C1B1F</Color>
<Color x:Key="SurfaceColor">#FFFFFF</Color>
<Color x:Key="OnSurfaceColor">#1C1B1F</Color>
<Color x:Key="SurfaceVariantColor">#F3EFF5</Color>
<Color x:Key="SurfaceVariantColor">#F2EFF5</Color>
<Color x:Key="OnSurfaceVariantColor">#8B8494</Color>
<Color x:Key="OutlineColor">#79747E</Color>
<Color x:Key="OnSurfaceInverseColor">#F4EFF4</Color>
@ -39,10 +39,10 @@
<Color x:Key="SecondaryColor">#CDC2DC</Color>
<Color x:Key="OnSecondaryColor">#332D41</Color>
<Color x:Key="SecondaryContainerColor">#433C52</Color>
<Color x:Key="OnSecondaryContainerColor">#EBDDFF</Color>
<Color x:Key="OnSecondaryContainerColor">#EDDFFF</Color>
<Color x:Key="TertiaryColor">#9FCAFF</Color>
<Color x:Key="OnTertiaryColor">#003258</Color>
<Color x:Key="TertiaryContainerColor">#00497E</Color>
<Color x:Key="TertiaryContainerColor">#00497D</Color>
<Color x:Key="OnTertiaryContainerColor">#D1E4FF</Color>
<Color x:Key="ErrorColor">#FFB4AB</Color>
<Color x:Key="ErrorContainerColor">#93000A</Color>
@ -50,7 +50,7 @@
<Color x:Key="OnErrorContainerColor">#FFDAD6</Color>
<Color x:Key="BackgroundColor">#1C1B1F</Color>
<Color x:Key="OnBackgroundColor">#E5E1E6</Color>
<Color x:Key="SurfaceColor">#302D38</Color>
<Color x:Key="SurfaceColor">#302D37</Color>
<Color x:Key="OnSurfaceColor">#E6E1E5</Color>
<Color x:Key="SurfaceVariantColor">#47464F</Color>
<Color x:Key="OnSurfaceVariantColor">#C9C5D0</Color>
@ -58,7 +58,7 @@
<Color x:Key="OnSurfaceInverseColor">#1C1B1F</Color>
<Color x:Key="SurfaceInverseColor">#E6E1E5</Color>
<Color x:Key="PrimaryInverseColor">#2A009F</Color>
<Color x:Key="SurfaceTintColor">#544794</Color>
<Color x:Key="SurfaceTintColor">#C7BFFF</Color>
<Color x:Key="OutlineVariantColor">#57545D</Color>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

View File

@ -1,6 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="FrontendPlatformUno.Windows.app"/>
<assemblyIdentity version="1.0.0.0" name="FrontendPlaformUno.Windows.app"/>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--The ID below informs the system that this application is compatible with OS features first introduced in Windows 8.
For more info see https://docs.microsoft.com/windows/win32/sysinfo/targeting-your-application-at-windows-8-1
It is also necessary to support features in unpackaged applications, for example the custom titlebar implementation.-->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>

View File

@ -1,9 +1,9 @@
{
"AppConfig": {
"Title": "FrontendPlatformUno - Dev"
"Environment": "Development"
},
"ApiClient": {
"Url": "https://localhost:5001",
"Url": "https://localhost:5002",
"UseNativeHandler": true
}
}

View File

@ -1,6 +1,6 @@
{
"AppConfig": {
"Title": "FrontendPlatformUno"
"Environment": "Production"
},
"ApiClient": {
"UseNativeHandler": true

View File

@ -0,0 +1,9 @@
{
// To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
"msbuild-sdks": {
"Uno.Sdk": "5.3.108"
},
"sdk":{
"allowPrerelease": false
}
}

View File

@ -1,3 +0,0 @@
**/bin
**/obj
.vs

View File

@ -1,59 +0,0 @@
<Project ToolsVersion="15.0">
<PropertyGroup>
<LangVersion>11</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DebugType>portable</DebugType>
<DebugSymbols>True</DebugSymbols>
<SynthesizeLinkMetadata>true</SynthesizeLinkMetadata>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<NoWarn>$(NoWarn);Uno0001;CS1998;CA1416;NU1507</NoWarn>
<DefaultLanguage>en</DefaultLanguage>
<IsAndroid>false</IsAndroid>
<IsIOS>false</IsIOS>
<IsMac>false</IsMac>
<IsMacCatalyst>false</IsMacCatalyst>
<IsWinAppSdk>false</IsWinAppSdk>
</PropertyGroup>
<Choose>
<When Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<PropertyGroup>
<IsAndroid>true</IsAndroid>
<SupportedOSPlatformVersion>21.0</SupportedOSPlatformVersion>
</PropertyGroup>
</When>
<When Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
<PropertyGroup>
<IsIOS>true</IsIOS>
<SupportedOSPlatformVersion>14.2</SupportedOSPlatformVersion>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)'==''">iossimulator-x64</RuntimeIdentifier>
</PropertyGroup>
</When>
<When Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'macos'">
<PropertyGroup>
<IsMac>true</IsMac>
<SupportedOSPlatformVersion>10.14</SupportedOSPlatformVersion>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)'==''">osx-x64</RuntimeIdentifier>
</PropertyGroup>
</When>
<When Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
<PropertyGroup>
<IsMacCatalyst>true</IsMacCatalyst>
<SupportedOSPlatformVersion>14.0</SupportedOSPlatformVersion>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)'==''">maccatalyst-x64</RuntimeIdentifier>
</PropertyGroup>
</When>
<When Condition="$(TargetFramework.Contains('windows10'))">
<PropertyGroup>
<IsWinAppSdk>true</IsWinAppSdk>
<SupportedOSPlatformVersion>10.0.18362.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion>
</PropertyGroup>
</When>
</Choose>
</Project>

View File

@ -1,2 +0,0 @@
<Project ToolsVersion="15.0">
</Project>

View File

@ -1,17 +0,0 @@
<local:App x:Class="FrontendPlatformUno.AppHead"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wasm="http://platform.uno/wasm"
xmlns:local="using:FrontendPlatformUno"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="wasm">
<local:App.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///FrontendPlatformUno/AppResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</local:App.Resources>
</local:App>

View File

@ -1,14 +0,0 @@
namespace FrontendPlatformUno
{
public sealed partial class AppHead : App
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public AppHead()
{
this.InitializeComponent();
}
}
}

View File

@ -1,25 +0,0 @@
<Project>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)AppHead.xaml" />
<ApplicationDefinition Include="$(MSBuildThisFileDirectory)AppHead.xaml"
SubType="Designer"
XamlRuntime="WinUI"
Generator="MSBuild:Compile"
Link="AppHead.xaml" />
<Compile Include="$(MSBuildThisFileDirectory)AppHead.xaml.cs"
XamlRuntime="WinUI"
DependentUpon="AppHead.xaml"
Link="AppHead.xaml.cs" />
<UnoIcon Include="$(MSBuildThisFileDirectory)Icons\iconapp.svg"
ForegroundFile="$(MSBuildThisFileDirectory)Icons\appconfig.svg"
ForegroundScale="0.65"
Color="#00000000" />
<UnoSplashScreen
Include="$(MSBuildThisFileDirectory)Splash\splash_screen.svg"
BaseSize="128,128"
Color="#086AD1" />
</ItemGroup>
</Project>

View File

@ -1,8 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- Suppress Compiler warnings for elements without XML Docs -->
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
</Project>

View File

@ -1,22 +0,0 @@
using System.Collections.Immutable;
using System.Text.Json.Serialization;
namespace FrontendPlatformUno.DataContracts.Serialization
{
/*
* When using the JsonSerializerContext you must add the JsonSerializableAttribute
* for each type that you may need to serialize / deserialize including both the
* concrete type and any interface that the concrete type implements.
* For more information on the JsonSerializerContext see:
* https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/source-generation?WT.mc_id=DT-MVP-5002924
*/
[JsonSerializable(typeof(WeatherForecast))]
[JsonSerializable(typeof(WeatherForecast[]))]
[JsonSerializable(typeof(IEnumerable<WeatherForecast>))]
[JsonSerializable(typeof(IImmutableList<WeatherForecast>))]
[JsonSerializable(typeof(ImmutableList<WeatherForecast>))]
[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase)]
public partial class WeatherForecastContext : JsonSerializerContext
{
}
}

Some files were not shown because too many files have changed in this diff Show More