Skip to content

Commit 8e76b18

Browse files
committed
Add wasm sample app
1 parent 1a4b7e5 commit 8e76b18

File tree

14 files changed

+14475
-13636
lines changed

14 files changed

+14475
-13636
lines changed

DeviceTests/DeviceTests.Android/Resources/Resource.designer.cs

Lines changed: 7733 additions & 8917 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Samples/Samples.Android/Resources/Resource.designer.cs

Lines changed: 6407 additions & 4714 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Samples/Samples.UWP/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)
5353

5454
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
5555
{
56-
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
56+
throw new Exception($"Failed to load Page {e.SourcePageType}: {e.Exception}");
5757
}
5858

5959
void OnSuspending(object sender, SuspendingEventArgs e)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
5+
<HasSharedItems>true</HasSharedItems>
6+
<SharedGUID>6279c845-92f8-4333-ab99-3d213163593c</SharedGUID>
7+
</PropertyGroup>
8+
<PropertyGroup Label="Configuration">
9+
<Import_RootNamespace>Samples.Shared</Import_RootNamespace>
10+
</PropertyGroup>
11+
<ItemGroup>
12+
<ApplicationDefinition Include="$(MSBuildThisFileDirectory)App.xaml">
13+
<SubType>Designer</SubType>
14+
<Generator>MSBuild:Compile</Generator>
15+
</ApplicationDefinition>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<Compile Include="$(MSBuildThisFileDirectory)App.xaml.cs">
19+
<DependentUpon>App.xaml</DependentUpon>
20+
</Compile>
21+
<Compile Include="$(MSBuildThisFileDirectory)MainPage.xaml.cs">
22+
<DependentUpon>MainPage.xaml</DependentUpon>
23+
</Compile>
24+
</ItemGroup>
25+
<ItemGroup>
26+
<Page Include="$(MSBuildThisFileDirectory)MainPage.xaml">
27+
<SubType>Designer</SubType>
28+
<Generator>MSBuild:Compile</Generator>
29+
</Page>
30+
</ItemGroup>
31+
<ItemGroup>
32+
<Content Include="$(MSBuildThisFileDirectory)Assets\LockScreenLogo.scale-200.png" />
33+
<Content Include="$(MSBuildThisFileDirectory)Assets\SplashScreen.scale-200.png" />
34+
<Content Include="$(MSBuildThisFileDirectory)Assets\Square150x150Logo.scale-200.png" />
35+
<Content Include="$(MSBuildThisFileDirectory)Assets\Square44x44Logo.scale-200.png" />
36+
<Content Include="$(MSBuildThisFileDirectory)Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
37+
<Content Include="$(MSBuildThisFileDirectory)Assets\StoreLogo.png" />
38+
<Content Include="$(MSBuildThisFileDirectory)Assets\Wide310x150Logo.scale-200.png" />
39+
</ItemGroup>
40+
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Label="Globals">
4+
<ProjectGuid>6279c845-92f8-4333-ab99-3d213163593c</ProjectGuid>
5+
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
6+
</PropertyGroup>
7+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
8+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
9+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
10+
<PropertyGroup />
11+
<Import Project="Samples.Shared.projitems" Label="Shared" />
12+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
13+
</Project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<linker>
2+
<assembly fullname="Samples.Wasm" />
3+
<assembly fullname="Samples" />
4+
<assembly fullname="Uno.UI" />
5+
6+
<assembly fullname="System.Core">
7+
<!-- This is required by JSon.NET and any expression.Compile caller -->
8+
<type fullname="System.Linq.Expressions*" />
9+
</assembly>
10+
</linker>

Samples/Samples.Wasm/Program.cs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System;
2+
using Microsoft.Extensions.Logging;
3+
using Windows.UI.Xaml;
4+
5+
namespace Samples.Wasm
6+
{
7+
public class Program
8+
{
9+
static int Main(string[] args)
10+
{
11+
ConfigureFilters(Uno.Extensions.LogExtensionPoint.AmbientLoggerFactory);
12+
13+
Windows.UI.Xaml.Application.Start(_ => new Samples.UWP.App());
14+
15+
return 0;
16+
}
17+
18+
static void ConfigureFilters(ILoggerFactory factory)
19+
{
20+
#if DEBUG
21+
factory
22+
.WithFilter(new FilterLoggerSettings
23+
{
24+
{ "Uno", LogLevel.Warning },
25+
{ "Windows", LogLevel.Warning },
26+
27+
// Generic Xaml events
28+
// { "Windows.UI.Xaml", LogLevel.Debug },
29+
// { "Windows.UI.Xaml.Shapes", LogLevel.Debug },
30+
// { "Windows.UI.Xaml.VisualStateGroup", LogLevel.Debug },
31+
// { "Windows.UI.Xaml.StateTriggerBase", LogLevel.Debug },
32+
// { "Windows.UI.Xaml.UIElement", LogLevel.Debug },
33+
// { "Windows.UI.Xaml.Setter", LogLevel.Debug },
34+
35+
// Layouter specific messages
36+
// { "Windows.UI.Xaml.Controls", LogLevel.Debug },
37+
// { "Windows.UI.Xaml.Controls.Layouter", LogLevel.Debug },
38+
// { "Windows.UI.Xaml.Controls.Panel", LogLevel.Debug },
39+
40+
// Binding related messages
41+
// { "Windows.UI.Xaml.Data", LogLevel.Debug },
42+
43+
// Binder memory references tracking
44+
// { "ReferenceHolder", LogLevel.Debug },
45+
}
46+
)
47+
.AddConsole(LogLevel.Trace);
48+
#else
49+
factory
50+
.AddConsole(LogLevel.Error);
51+
#endif
52+
}
53+
}
54+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="Microsoft.NET.Sdk.Web">
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netstandard2.0</TargetFramework>
6+
<WasmHead>true</WasmHead>
7+
<DefineConstants>$(DefineConstants);__WASM__</DefineConstants>
8+
<NoWarn>NU1701</NoWarn>
9+
</PropertyGroup>
10+
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
11+
<MonoRuntimeDebuggerEnabled>true</MonoRuntimeDebuggerEnabled>
12+
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
13+
<DebugType>portable</DebugType>
14+
<DebugSymbols>true</DebugSymbols>
15+
</PropertyGroup>
16+
<ItemGroup>
17+
<Content Include="..\Samples.UWP\Assets\*.png" Link="Assets\%(FileName)%(Extension)" />
18+
</ItemGroup>
19+
<ItemGroup>
20+
<EmbeddedResource Include="WasmCSS\Fonts.css" />
21+
<EmbeddedResource Include="WasmScripts\AppManifest.js" />
22+
</ItemGroup>
23+
<ItemGroup>
24+
<LinkerDescriptor Include="LinkerConfig.xml" />
25+
</ItemGroup>
26+
<ItemGroup>
27+
<!--
28+
This item group is required by the project template because of the
29+
new SDK-Style project, otherwise some files are not aded automatically.
30+
31+
You can safely remove this ItemGroup completely.
32+
-->
33+
<None Include="Program.cs" />
34+
<None Include="LinkerConfig.xml" />
35+
<None Include="wwwroot\web.config" />
36+
</ItemGroup>
37+
<ItemGroup>
38+
<!-- Note that for WebAssembly version 1.1.1 of the console logger required -->
39+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
40+
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
41+
<PackageReference Include="Uno.UI" Version="2.1.0-dev.1173" />
42+
<PackageReference Include="Uno.UI.RemoteControl" Version="2.0.532" Condition="'$(Configuration)'=='Debug'" />
43+
<PackageReference Include="Uno.Wasm.Bootstrap" Version="1.0.10" />
44+
<PackageReference Include="Uno.Xamarin.Forms.Platform" Version="4.3.4" />
45+
<DotNetCliToolReference Include="Uno.Wasm.Bootstrap.Cli" Version="1.0.10" />
46+
</ItemGroup>
47+
<ItemGroup>
48+
<ProjectReference Include="..\..\Xamarin.Essentials\Xamarin.Essentials.csproj" />
49+
<ProjectReference Include="..\Samples\Samples.csproj" />
50+
</ItemGroup>
51+
<Import Project="..\Samples.UWP\Samples.Shared.projitems" Label="Shared" Condition="Exists('..\Samples.UWP\Samples.Shared.projitems')" />
52+
</Project>

Samples/Samples.Wasm/WasmCSS/Fonts.css

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var UnoAppManifest = {
2+
3+
splashScreenImage: "Assets/SplashScreen.scale-200.png",
4+
splashScreenColor: "#00f",
5+
displayName: "Samples"
6+
7+
}

0 commit comments

Comments
 (0)