mirror of
https://github.com/PacktPublishing/Learn-WinUI-3-Second-Edition.git
synced 2026-06-20 12:23:09 +00:00
Add starter project for Chapter 13
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<linker>
|
||||
<assembly fullname="UnoMediaCollection" />
|
||||
<assembly fullname="UnoMediaCollection.Wasm" />
|
||||
|
||||
<!--
|
||||
Uncomment this section when using JSON.NET
|
||||
<assembly fullname="System.Core">
|
||||
<type fullname="System.Linq.Expressions*" />
|
||||
</assembly>
|
||||
-->
|
||||
</linker>
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace UnoMediaCollection.Wasm
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
private static App? _app;
|
||||
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
Microsoft.UI.Xaml.Application.Start(_ => _app = new AppHead());
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:8080",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"UnoMediaCollection.Wasm": {
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<NoWarn>$(NoWarn);NU1504;NU1505;NU1701</NoWarn>
|
||||
<!-- Disabled due to issue with Central Package Management with implicit using -->
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<WasmPWAManifestFile>manifest.webmanifest</WasmPWAManifestFile>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<!--
|
||||
Supports Deep Linking Routes
|
||||
https://aka.platform.uno/wasm-deeplink
|
||||
-->
|
||||
<WasmShellWebAppBasePath>/</WasmShellWebAppBasePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<MonoRuntimeDebuggerEnabled>true</MonoRuntimeDebuggerEnabled>
|
||||
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
|
||||
<DebugType>portable</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<!--
|
||||
IL Linking is disabled in Debug configuration.
|
||||
When building in Release, see https://platform.uno/docs/articles/features/using-il-linker-WebAssembly.html
|
||||
-->
|
||||
<WasmShellILLinkerEnabled>false</WasmShellILLinkerEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<!-- XAML Resource trimming https://aka.platform.uno/xaml-trimming -->
|
||||
<!--<UnoXamlResourcesTrimming>true</UnoXamlResourcesTrimming>-->
|
||||
<!-- Improve performance with AOT builds https://aka.platform.uno/wasm-aot -->
|
||||
<!-- <WasmShellMonoRuntimeExecutionMode>InterpreterAndAOT</WasmShellMonoRuntimeExecutionMode> -->
|
||||
<!-- Temporarily uncomment to generate an AOT profile https://aka.platform.uno/wasm-aot-profile -->
|
||||
<!-- <WasmShellGenerateAOTProfile>true</WasmShellGenerateAOTProfile> -->
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="manifest.webmanifest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="WasmCSS\Fonts.css" />
|
||||
<EmbeddedResource Include="WasmScripts\AppManifest.js" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<LinkerDescriptor Include="LinkerConfig.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<!--
|
||||
This item group is required by the project template because of the
|
||||
new SDK-Style project, otherwise some files are not added automatically.
|
||||
|
||||
You can safely remove this ItemGroup completely.
|
||||
-->
|
||||
<None Include="Program.cs" />
|
||||
<None Include="LinkerConfig.xml" />
|
||||
<None Include="wwwroot\web.config" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" />
|
||||
<PackageReference Include="Uno.Wasm.Bootstrap" />
|
||||
<PackageReference Include="Uno.Wasm.Bootstrap.DevServer" />
|
||||
<PackageReference Include="Uno.WinUI.WebAssembly" />
|
||||
<PackageReference Include="Uno.WinUI.RemoteControl" Condition="'$(Configuration)'=='Debug'" />
|
||||
<PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" />
|
||||
<PackageReference Include="Uno.Extensions.Configuration" />
|
||||
<PackageReference Include="Uno.Extensions.Http" />
|
||||
<PackageReference Include="Uno.Extensions.Http.Refit" />
|
||||
<PackageReference Include="Uno.Extensions.Logging.WebAssembly.Console" />
|
||||
<PackageReference Include="Uno.Extensions.Logging.WinUI" />
|
||||
<PackageReference Include="Uno.Extensions.Serialization.Http" />
|
||||
<PackageReference Include="Uno.Extensions.Serialization.Refit" />
|
||||
<PackageReference Include="Uno.Extensions.Toolkit.WinUI" />
|
||||
<PackageReference Include="Uno.Toolkit.WinUI" />
|
||||
<PackageReference Include="Uno.Extensions.Hosting.WinUI" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\UnoMediaCollection\UnoMediaCollection.csproj" />
|
||||
<ProjectReference Include="..\UnoMediaCollection.DataContracts\UnoMediaCollection.DataContracts.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\UnoMediaCollection.Base\base.props" />
|
||||
</Project>
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
When adding fonts here, make sure to add them using a base64 data uri, otherwise
|
||||
fonts loading are delayed, and text may get displayed incorrectly.
|
||||
*/
|
||||
|
||||
/* https://github.com/unoplatform/uno/issues/3954 */
|
||||
@font-face {
|
||||
font-family: 'Segoe UI';
|
||||
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 {
|
||||
font-family: 'Roboto';
|
||||
src: url(./Uno.Fonts.Roboto/Fonts/Roboto-Light.ttf) format('truetype');
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
src: url(./Uno.Fonts.Roboto/Fonts/Roboto-Regular.ttf) format('truetype');
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
src: url(./Uno.Fonts.Roboto/Fonts/Roboto-Medium.ttf) format('truetype');
|
||||
font-weight: 500;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
var UnoAppManifest = {
|
||||
displayName: "UnoMediaCollection"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"background_color": "#ffffff",
|
||||
"description": "UnoMediaCollection",
|
||||
"display": "standalone",
|
||||
"name": "UnoMediaCollection",
|
||||
"short_name": "UnoMediaCollection",
|
||||
"start_url": "/index.html",
|
||||
"theme_color": "#ffffff",
|
||||
"scope": "/"
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"navigationFallback": {
|
||||
"rewrite": "/index.html",
|
||||
"exclude": [
|
||||
"*.{css,js}",
|
||||
"*.{png}",
|
||||
"*.{c,h,wasm,clr,pdb,dat,txt}"
|
||||
]
|
||||
},
|
||||
"routes": [
|
||||
{
|
||||
"route": "/package_*",
|
||||
"headers": {
|
||||
"cache-control": "public, immutable, max-age=31536000"
|
||||
}
|
||||
},
|
||||
{
|
||||
"route": "/*.ttf",
|
||||
"headers": {
|
||||
"cache-control": "public, immutable, max-age=31536000"
|
||||
}
|
||||
},
|
||||
{
|
||||
"route": "/*",
|
||||
"headers": {
|
||||
"cache-control": "must-revalidate, max-age=3600"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<system.web>
|
||||
<customErrors mode="Off"/>
|
||||
</system.web>
|
||||
|
||||
<system.webServer>
|
||||
|
||||
<!-- Disable compression as we're doing it through pre-compressed files -->
|
||||
<urlCompression doStaticCompression="false" doDynamicCompression="false" dynamicCompressionBeforeCache="false" />
|
||||
|
||||
<staticContent>
|
||||
<remove fileExtension=".dll" />
|
||||
<remove fileExtension=".wasm" />
|
||||
<remove fileExtension=".woff" />
|
||||
<remove fileExtension=".woff2" />
|
||||
<mimeMap fileExtension=".wasm" mimeType="application/wasm" />
|
||||
<mimeMap fileExtension=".clr" mimeType="application/octet-stream" />
|
||||
<mimeMap fileExtension=".pdb" mimeType="application/octet-stream" />
|
||||
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
|
||||
<mimeMap fileExtension=".woff2" mimeType="application/font-woff" />
|
||||
<mimeMap fileExtension=".dat" mimeType="application/octet-stream" />
|
||||
<!-- Required for PWAs -->
|
||||
<mimeMap fileExtension=".json" mimeType="application/octet-stream" />
|
||||
</staticContent>
|
||||
|
||||
<rewrite>
|
||||
<rules>
|
||||
<rule name="Lookup for pre-compressed brotli file" stopProcessing="true">
|
||||
<match url="(.*)$"/>
|
||||
<conditions>
|
||||
<!-- Match brotli requests -->
|
||||
<add input="{HTTP_ACCEPT_ENCODING}" pattern="br" />
|
||||
|
||||
<!-- Match all but pre-compressed files -->
|
||||
<add input="{REQUEST_URI}" pattern="^(?!/_compressed_br/)(.*)$" />
|
||||
|
||||
<!-- Check if the pre-compressed file exists on the disk -->
|
||||
<add input="{DOCUMENT_ROOT}/_compressed_br/{C:0}" matchType="IsFile" negate="false" />
|
||||
</conditions>
|
||||
<action type="Rewrite" url="/_compressed_br{C:0}" />
|
||||
</rule>
|
||||
|
||||
<rule name="Lookup for pre-compressed gzip file" stopProcessing="true">
|
||||
<match url="(.*)$"/>
|
||||
<conditions>
|
||||
<!-- Match gzip requests -->
|
||||
<add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" />
|
||||
|
||||
<!-- Match all but pre-compressed files -->
|
||||
<add input="{REQUEST_URI}" pattern="^(?!/_compressed_gz/)(.*)$" />
|
||||
|
||||
<!-- Check if the pre-compressed file exists on the disk -->
|
||||
<add input="{DOCUMENT_ROOT}/_compressed_gz/{C:0}" matchType="IsFile" negate="false" />
|
||||
</conditions>
|
||||
<action type="Rewrite" url="/_compressed_gz{C:0}" />
|
||||
</rule>
|
||||
</rules>
|
||||
|
||||
<outboundRules>
|
||||
<rule name="Adjust content encoding for gzip pre-compressed files" enabled="true" stopProcessing="true">
|
||||
<match serverVariable="RESPONSE_CONTENT_ENCODING" pattern="" />
|
||||
<conditions>
|
||||
<add input="{REQUEST_URI}" pattern="/_compressed_gz/.*$" />
|
||||
</conditions>
|
||||
<action type="Rewrite" value="gzip"/>
|
||||
</rule>
|
||||
<rule name="Adjust content encoding for brotli pre-compressed files" enabled="true" stopProcessing="true">
|
||||
<match serverVariable="RESPONSE_CONTENT_ENCODING" pattern="" />
|
||||
<conditions>
|
||||
<add input="{REQUEST_URI}" pattern="/_compressed_br/.*$" />
|
||||
</conditions>
|
||||
<action type="Rewrite" value="br"/>
|
||||
</rule>
|
||||
</outboundRules>
|
||||
</rewrite>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user