From 4484734be7051e5f8cd22f30f1779e0457566ad3 Mon Sep 17 00:00:00 2001 From: Kevin Bost Date: Sat, 8 Jun 2024 00:12:42 -0700 Subject: [PATCH] WIP getting an Uno sample working Getting Uno WinUI entry point working Starting README with Uno app description Updating Uno sample with a README --- samples/UnoSample/.editorconfig | 167 ++++++++ samples/UnoSample/.gitignore | 403 ++++++++++++++++++ samples/UnoSample/.vscode/extensions.json | 5 + samples/UnoSample/.vscode/launch.json | 35 ++ samples/UnoSample/.vscode/settings.json | 7 + samples/UnoSample/.vscode/tasks.json | 31 ++ samples/UnoSample/.vsconfig | 23 + samples/UnoSample/Directory.Build.props | 23 + samples/UnoSample/Directory.Build.targets | 2 + samples/UnoSample/Directory.Packages.props | 13 + samples/UnoSample/README.md | 62 +++ samples/UnoSample/UnoSample.sln | 33 ++ samples/UnoSample/UnoSample/App.xaml | 28 ++ samples/UnoSample/UnoSample/App.xaml.cs | 110 +++++ .../UnoSample/UnoSample/Assets/Icons/icon.svg | 42 ++ .../Assets/Icons/icon_foreground.svg | 137 ++++++ .../UnoSample/Assets/Images/back.svg | 3 + .../UnoSample/Assets/SharedAssets.md | 32 ++ .../UnoSample/Assets/Splash/splash_screen.svg | 137 ++++++ samples/UnoSample/UnoSample/GlobalUsings.cs | 15 + .../UnoSample/UnoSample/Models/AppConfig.cs | 6 + samples/UnoSample/UnoSample/Models/Entity.cs | 3 + .../UnoSample/Models/WeatherForecast.cs | 15 + .../UnoSample/UnoSample/Package.appxmanifest | 43 ++ .../UnoSample/Platforms/Desktop/Program.cs | 29 ++ .../Platforms/MacCatalyst/Entitlements.plist | 6 + .../Platforms/MacCatalyst/Info.plist | 26 ++ .../Platforms/MacCatalyst/Main.maccatalyst.cs | 19 + .../LaunchImages.launchimage/Contents.json | 58 +++ .../UnoSample/Platforms/Windows/Program.cs | 26 ++ .../PublishProfiles/win-arm64.pubxml | 22 + .../Properties/PublishProfiles/win-x64.pubxml | 22 + .../Properties/PublishProfiles/win-x86.pubxml | 22 + .../UnoSample/Presentation/MainPage.xaml | 39 ++ .../UnoSample/Presentation/MainPage.xaml.cs | 13 + .../UnoSample/Presentation/MainViewModel.cs | 72 ++++ .../UnoSample/Presentation/Shell.xaml | 36 ++ .../UnoSample/Presentation/Shell.xaml.cs | 10 + .../UnoSample/Presentation/ShellViewModel.cs | 18 + samples/UnoSample/UnoSample/ReadMe.md | 7 + .../Serialization/WeatherForecastContext.cs | 23 + .../Services/Caching/IWeatherCache.cs | 6 + .../Services/Caching/WeatherCache.cs | 76 ++++ .../Services/Endpoints/DebugHandler.cs | 44 ++ .../Services/Endpoints/IApiClient.cs | 9 + .../UnoSample/Strings/en/Resources.resw | 123 ++++++ .../UnoSample/Strings/es/Resources.resw | 123 ++++++ .../UnoSample/Strings/fr/Resources.resw | 123 ++++++ .../UnoSample/Strings/pt-BR/Resources.resw | 123 ++++++ .../Styles/ColorPaletteOverride.json | 76 ++++ .../Styles/ColorPaletteOverride.xaml | 65 +++ samples/UnoSample/UnoSample/UnoSample.csproj | 75 ++++ samples/UnoSample/UnoSample/app.manifest | 25 ++ .../UnoSample/appsettings.development.json | 9 + samples/UnoSample/UnoSample/appsettings.json | 16 + samples/UnoSample/global.json | 6 + 56 files changed, 2722 insertions(+) create mode 100644 samples/UnoSample/.editorconfig create mode 100644 samples/UnoSample/.gitignore create mode 100644 samples/UnoSample/.vscode/extensions.json create mode 100644 samples/UnoSample/.vscode/launch.json create mode 100644 samples/UnoSample/.vscode/settings.json create mode 100644 samples/UnoSample/.vscode/tasks.json create mode 100644 samples/UnoSample/.vsconfig create mode 100644 samples/UnoSample/Directory.Build.props create mode 100644 samples/UnoSample/Directory.Build.targets create mode 100644 samples/UnoSample/Directory.Packages.props create mode 100644 samples/UnoSample/README.md create mode 100644 samples/UnoSample/UnoSample.sln create mode 100644 samples/UnoSample/UnoSample/App.xaml create mode 100644 samples/UnoSample/UnoSample/App.xaml.cs create mode 100644 samples/UnoSample/UnoSample/Assets/Icons/icon.svg create mode 100644 samples/UnoSample/UnoSample/Assets/Icons/icon_foreground.svg create mode 100644 samples/UnoSample/UnoSample/Assets/Images/back.svg create mode 100644 samples/UnoSample/UnoSample/Assets/SharedAssets.md create mode 100644 samples/UnoSample/UnoSample/Assets/Splash/splash_screen.svg create mode 100644 samples/UnoSample/UnoSample/GlobalUsings.cs create mode 100644 samples/UnoSample/UnoSample/Models/AppConfig.cs create mode 100644 samples/UnoSample/UnoSample/Models/Entity.cs create mode 100644 samples/UnoSample/UnoSample/Models/WeatherForecast.cs create mode 100644 samples/UnoSample/UnoSample/Package.appxmanifest create mode 100644 samples/UnoSample/UnoSample/Platforms/Desktop/Program.cs create mode 100644 samples/UnoSample/UnoSample/Platforms/MacCatalyst/Entitlements.plist create mode 100644 samples/UnoSample/UnoSample/Platforms/MacCatalyst/Info.plist create mode 100644 samples/UnoSample/UnoSample/Platforms/MacCatalyst/Main.maccatalyst.cs create mode 100644 samples/UnoSample/UnoSample/Platforms/MacCatalyst/Media.xcassets/LaunchImages.launchimage/Contents.json create mode 100644 samples/UnoSample/UnoSample/Platforms/Windows/Program.cs create mode 100644 samples/UnoSample/UnoSample/Platforms/Windows/Properties/PublishProfiles/win-arm64.pubxml create mode 100644 samples/UnoSample/UnoSample/Platforms/Windows/Properties/PublishProfiles/win-x64.pubxml create mode 100644 samples/UnoSample/UnoSample/Platforms/Windows/Properties/PublishProfiles/win-x86.pubxml create mode 100644 samples/UnoSample/UnoSample/Presentation/MainPage.xaml create mode 100644 samples/UnoSample/UnoSample/Presentation/MainPage.xaml.cs create mode 100644 samples/UnoSample/UnoSample/Presentation/MainViewModel.cs create mode 100644 samples/UnoSample/UnoSample/Presentation/Shell.xaml create mode 100644 samples/UnoSample/UnoSample/Presentation/Shell.xaml.cs create mode 100644 samples/UnoSample/UnoSample/Presentation/ShellViewModel.cs create mode 100644 samples/UnoSample/UnoSample/ReadMe.md create mode 100644 samples/UnoSample/UnoSample/Serialization/WeatherForecastContext.cs create mode 100644 samples/UnoSample/UnoSample/Services/Caching/IWeatherCache.cs create mode 100644 samples/UnoSample/UnoSample/Services/Caching/WeatherCache.cs create mode 100644 samples/UnoSample/UnoSample/Services/Endpoints/DebugHandler.cs create mode 100644 samples/UnoSample/UnoSample/Services/Endpoints/IApiClient.cs create mode 100644 samples/UnoSample/UnoSample/Strings/en/Resources.resw create mode 100644 samples/UnoSample/UnoSample/Strings/es/Resources.resw create mode 100644 samples/UnoSample/UnoSample/Strings/fr/Resources.resw create mode 100644 samples/UnoSample/UnoSample/Strings/pt-BR/Resources.resw create mode 100644 samples/UnoSample/UnoSample/Styles/ColorPaletteOverride.json create mode 100644 samples/UnoSample/UnoSample/Styles/ColorPaletteOverride.xaml create mode 100644 samples/UnoSample/UnoSample/UnoSample.csproj create mode 100644 samples/UnoSample/UnoSample/app.manifest create mode 100644 samples/UnoSample/UnoSample/appsettings.development.json create mode 100644 samples/UnoSample/UnoSample/appsettings.json create mode 100644 samples/UnoSample/global.json diff --git a/samples/UnoSample/.editorconfig b/samples/UnoSample/.editorconfig new file mode 100644 index 00000000..b947be64 --- /dev/null +++ b/samples/UnoSample/.editorconfig @@ -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 diff --git a/samples/UnoSample/.gitignore b/samples/UnoSample/.gitignore new file mode 100644 index 00000000..ef88c205 --- /dev/null +++ b/samples/UnoSample/.gitignore @@ -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 \ No newline at end of file diff --git a/samples/UnoSample/.vscode/extensions.json b/samples/UnoSample/.vscode/extensions.json new file mode 100644 index 00000000..a63ad400 --- /dev/null +++ b/samples/UnoSample/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "unoplatform.vscode" + ], +} diff --git a/samples/UnoSample/.vscode/launch.json b/samples/UnoSample/.vscode/launch.json new file mode 100644 index 00000000..87a59c21 --- /dev/null +++ b/samples/UnoSample/.vscode/launch.json @@ -0,0 +1,35 @@ +{ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ + { + "name": "Uno Platform Mobile", + "type": "Uno", + "request": "launch", + // any Uno* task will do, this is simply to satisfy vscode requirement when a launch.json is present + "preLaunchTask": "Uno: android | Debug | android-x64" + }, + { + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "name": "Uno Platform Desktop (Debug)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build-desktop", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/UnoSample/bin/Debug/net8.0-desktop/UnoSample.dll", + "args": [], + "launchSettingsProfile": "UnoSample (Desktop)", + "env": { + "DOTNET_MODIFIABLE_ASSEMBLIES": "debug" + }, + "cwd": "${workspaceFolder}/UnoSample", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, + ] +} diff --git a/samples/UnoSample/.vscode/settings.json b/samples/UnoSample/.vscode/settings.json new file mode 100644 index 00000000..23133fc7 --- /dev/null +++ b/samples/UnoSample/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "explorer.fileNesting.enabled": true, + "explorer.fileNesting.expand": false, + "explorer.fileNesting.patterns": { + "*.xaml": "$(capture).xaml.cs" + } +} diff --git a/samples/UnoSample/.vscode/tasks.json b/samples/UnoSample/.vscode/tasks.json new file mode 100644 index 00000000..ff3537ca --- /dev/null +++ b/samples/UnoSample/.vscode/tasks.json @@ -0,0 +1,31 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build-desktop", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/UnoSample/UnoSample.csproj", + "/property:GenerateFullPaths=true", + "/property:TargetFramework=net8.0-desktop", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish-desktop", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/UnoSample/UnoSample.csproj", + "/property:GenerateFullPaths=true", + "/property:TargetFramework=net8.0-desktop", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} diff --git a/samples/UnoSample/.vsconfig b/samples/UnoSample/.vsconfig new file mode 100644 index 00000000..6cd65ee4 --- /dev/null +++ b/samples/UnoSample/.vsconfig @@ -0,0 +1,23 @@ +{ + "version": "1.0", + "components": [ + "Microsoft.VisualStudio.Component.CoreEditor", + "Microsoft.VisualStudio.Workload.CoreEditor", + "Microsoft.NetCore.Component.SDK", + "Microsoft.NetCore.Component.DevelopmentTools", + "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites", + "Microsoft.VisualStudio.Component.TextTemplating", + "Microsoft.VisualStudio.Component.Windows10SDK.19041", + "Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging", + "Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites", + "Microsoft.VisualStudio.Component.Debugger.JustInTime", + "Microsoft.VisualStudio.Workload.ManagedDesktop", + "Microsoft.Component.NetFX.Native", + "Microsoft.VisualStudio.Component.Graphics", + "Microsoft.VisualStudio.Component.Merq", + "Microsoft.VisualStudio.Component.MonoDebugger", + "Microsoft.VisualStudio.ComponentGroup.Maui.All", + "Microsoft.VisualStudio.Workload.NetCrossPlat", + "Microsoft.VisualStudio.Workload.NetCoreTools" + ] +} diff --git a/samples/UnoSample/Directory.Build.props b/samples/UnoSample/Directory.Build.props new file mode 100644 index 00000000..c23d7362 --- /dev/null +++ b/samples/UnoSample/Directory.Build.props @@ -0,0 +1,23 @@ + + + enable + enable + true + + + $(NoWarn);NU1507;NETSDK1201;PRI257 + + + + + 4.1.23 + 6.0.24 + 5.0.13 + 5.2.14 + + diff --git a/samples/UnoSample/Directory.Build.targets b/samples/UnoSample/Directory.Build.targets new file mode 100644 index 00000000..f75adf7e --- /dev/null +++ b/samples/UnoSample/Directory.Build.targets @@ -0,0 +1,2 @@ + + diff --git a/samples/UnoSample/Directory.Packages.props b/samples/UnoSample/Directory.Packages.props new file mode 100644 index 00000000..939ebb0d --- /dev/null +++ b/samples/UnoSample/Directory.Packages.props @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/samples/UnoSample/README.md b/samples/UnoSample/README.md new file mode 100644 index 00000000..09e409e3 --- /dev/null +++ b/samples/UnoSample/README.md @@ -0,0 +1,62 @@ +# Uno with Velopack + +This solution contains an Uno Desktop application that targets both Windows and macOS. Because Velopack does not currently support mobile or web platforms, those are not included. + +## Prerequisites +This solution will publish the application out to the Velopack Flow service. To test the full publish you will need to create a [Velopack Flow account](https://app.velopack.io). + +The solution assumes that you have downloaded and installed the Velopack CLI (`vpk`) global tool. This tool can be installed by running `dotnet tool install -g vpk`. You will then need ot authenticate with the Velopack Flow servie by running `vpk login` and signing in with your Velopack Flow account. + +## The Application +Inside of `Presentation` the `MainPage.xaml` contains the main UI for viewing the current version, checking for updates, and applying the latest update. +The `MainViewModel.cs` contains the logic for checking for updates and applying them. The key piece of the setup is the initialization of the `UpdateManager` with the `VelopackFlowUpdateSource` which provides the interaction with the Velopack Flow service. + +The `Main` methods in the `Platforms\Desktop\Program.cs` has been updated to contain the [Velopack application startup hook](https://docs.velopack.io/integrating/overview). + +The `Main` methods in the `Platforms\MacCatalyst\Main.maccatalyst.cs` has been updated to contain the [Velopack application startup hook](https://docs.velopack.io/integrating/overview). + +Finally, for the WinUI platform, a little more work is needed as the `Main` method is auto-generated by default. +First, the generation of the `Main` method needs to be disabled by defining `DISABLE_XAML_GENERATED_MAIN` constant in the csproj. +```xml + + $(DefineConstants);DISABLE_XAML_GENERATED_MAIN + +``` +Next the `Main` method needs to be added so a new `Platforms\Windows\Program.cs` file is added with a standard content, and the [Velopack application startup hook](https://docs.velopack.io/integrating/overview): +```csharp +[STAThread] +public static void Main(string[] args) +{ + // It's important to Run() the VelopackApp as early as possible in app startup. + VelopackApp.Build() + .WithFirstRun((v) => { /* Your first run code here */ }) + .Run(); + + WinRT.ComWrappersSupport.InitializeComWrappers(); + + Application.Start((p) => + { + var context = new DispatcherQueueSynchronizationContext( + DispatcherQueue.GetForCurrentThread()); + SynchronizationContext.SetSynchronizationContext(context); + new App(); + }); +} +``` + +### Updating the Project file +There are two properties to set in the `csproj` file to enable the Velopack Flow integration. These are: +```xml +true +Velopack.UnoSample +``` + +`VelopackPackId` is the unique identifier for the application. This is used to identify the application in the Velopack Flow service. It must be unique among all applications. +`VelopackPushOnPublish` is a boolean value that determines if the application should be pushed to the Velopack Flow service when it is published. This should be set to `true` to enable the integration. + +### Building installers +To build the local installers run the following command replacing `` with the desired version number. +The `-f` option is used to specify the target framework. This can be any of the desktop frameworks specified in the `csproj` file. +```bash +dotnet publish -c Release -f net8.0-desktop -p:Version= +``` diff --git a/samples/UnoSample/UnoSample.sln b/samples/UnoSample/UnoSample.sln new file mode 100644 index 00000000..1e12cd07 --- /dev/null +++ b/samples/UnoSample/UnoSample.sln @@ -0,0 +1,33 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.34929.205 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnoSample", "UnoSample\UnoSample.csproj", "{F9ACED52-AE70-46F6-8C7C-2EF629084661}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{29980CC9-DC41-4944-966D-F088C84D1C7B}" + 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 + {F9ACED52-AE70-46F6-8C7C-2EF629084661}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F9ACED52-AE70-46F6-8C7C-2EF629084661}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F9ACED52-AE70-46F6-8C7C-2EF629084661}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F9ACED52-AE70-46F6-8C7C-2EF629084661}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2FA3FC94-E895-443E-AAA8-9A7F956F9E92} + EndGlobalSection +EndGlobal diff --git a/samples/UnoSample/UnoSample/App.xaml b/samples/UnoSample/UnoSample/App.xaml new file mode 100644 index 00000000..d4a63169 --- /dev/null +++ b/samples/UnoSample/UnoSample/App.xaml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + diff --git a/samples/UnoSample/UnoSample/App.xaml.cs b/samples/UnoSample/UnoSample/App.xaml.cs new file mode 100644 index 00000000..2a881e1e --- /dev/null +++ b/samples/UnoSample/UnoSample/App.xaml.cs @@ -0,0 +1,110 @@ +using Uno.Resizetizer; + +namespace UnoSample; +public partial class App : Application +{ + /// + /// 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(). + /// + 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() + .Section() + ) + // 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() +#endif + .AddSingleton() + .AddRefitClient(context)) + .ConfigureServices((context, services) => + { + // TODO: Register your services + //services.AddSingleton(); + }) + .UseNavigation(RegisterRoutes) + ); + MainWindow = builder.Window; + +#if DEBUG + MainWindow.EnableHotReload(); +#endif + MainWindow.SetWindowIcon(); + + Host = await builder.NavigateAsync(); + } + + private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes) + { + views.Register( + new ViewMap(ViewModel: typeof(ShellViewModel)), + new ViewMap() + ); + + routes.Register( + new RouteMap("", View: views.FindByViewModel(), + Nested: + [ + new ("Main", View: views.FindByViewModel()) + ] + ) + ); + } +} diff --git a/samples/UnoSample/UnoSample/Assets/Icons/icon.svg b/samples/UnoSample/UnoSample/Assets/Icons/icon.svg new file mode 100644 index 00000000..a15af53a --- /dev/null +++ b/samples/UnoSample/UnoSample/Assets/Icons/icon.svg @@ -0,0 +1,42 @@ + + + + + + diff --git a/samples/UnoSample/UnoSample/Assets/Icons/icon_foreground.svg b/samples/UnoSample/UnoSample/Assets/Icons/icon_foreground.svg new file mode 100644 index 00000000..8ffc41ae --- /dev/null +++ b/samples/UnoSample/UnoSample/Assets/Icons/icon_foreground.svg @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/UnoSample/UnoSample/Assets/Images/back.svg b/samples/UnoSample/UnoSample/Assets/Images/back.svg new file mode 100644 index 00000000..bcd7851b --- /dev/null +++ b/samples/UnoSample/UnoSample/Assets/Images/back.svg @@ -0,0 +1,3 @@ + + + diff --git a/samples/UnoSample/UnoSample/Assets/SharedAssets.md b/samples/UnoSample/UnoSample/Assets/SharedAssets.md new file mode 100644 index 00000000..1b84a74a --- /dev/null +++ b/samples/UnoSample/UnoSample/Assets/SharedAssets.md @@ -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 | diff --git a/samples/UnoSample/UnoSample/Assets/Splash/splash_screen.svg b/samples/UnoSample/UnoSample/Assets/Splash/splash_screen.svg new file mode 100644 index 00000000..8ffc41ae --- /dev/null +++ b/samples/UnoSample/UnoSample/Assets/Splash/splash_screen.svg @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/UnoSample/UnoSample/GlobalUsings.cs b/samples/UnoSample/UnoSample/GlobalUsings.cs new file mode 100644 index 00000000..c93bf566 --- /dev/null +++ b/samples/UnoSample/UnoSample/GlobalUsings.cs @@ -0,0 +1,15 @@ +global using System.Collections.Immutable; +global using CommunityToolkit.Mvvm.ComponentModel; +global using CommunityToolkit.Mvvm.Input; +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 UnoSample.DataContracts; +global using UnoSample.DataContracts.Serialization; +global using UnoSample.Models; +global using UnoSample.Presentation; +global using UnoSample.Services.Caching; +global using UnoSample.Services.Endpoints; +global using ApplicationExecutionState = Windows.ApplicationModel.Activation.ApplicationExecutionState; diff --git a/samples/UnoSample/UnoSample/Models/AppConfig.cs b/samples/UnoSample/UnoSample/Models/AppConfig.cs new file mode 100644 index 00000000..603e2405 --- /dev/null +++ b/samples/UnoSample/UnoSample/Models/AppConfig.cs @@ -0,0 +1,6 @@ +namespace UnoSample.Models; + +public record AppConfig +{ + public string? Environment { get; init; } +} diff --git a/samples/UnoSample/UnoSample/Models/Entity.cs b/samples/UnoSample/UnoSample/Models/Entity.cs new file mode 100644 index 00000000..ee8bb3bf --- /dev/null +++ b/samples/UnoSample/UnoSample/Models/Entity.cs @@ -0,0 +1,3 @@ +namespace UnoSample.Models; + +public record Entity(string Name); diff --git a/samples/UnoSample/UnoSample/Models/WeatherForecast.cs b/samples/UnoSample/UnoSample/Models/WeatherForecast.cs new file mode 100644 index 00000000..9869b1dd --- /dev/null +++ b/samples/UnoSample/UnoSample/Models/WeatherForecast.cs @@ -0,0 +1,15 @@ +namespace UnoSample.DataContracts; + +/// +/// A Weather Forecast for a specific date +/// +/// Gets the Date of the Forecast. +/// Gets the Forecast Temperature in Celsius. +/// Get a description of how the weather will feel. +public record WeatherForecast(DateOnly Date, double TemperatureC, string? Summary) +{ + /// + /// Gets the Forecast Temperature in Fahrenheit + /// + public double TemperatureF => 32 + (TemperatureC * 9 / 5); +} diff --git a/samples/UnoSample/UnoSample/Package.appxmanifest b/samples/UnoSample/UnoSample/Package.appxmanifest new file mode 100644 index 00000000..656dc6f5 --- /dev/null +++ b/samples/UnoSample/UnoSample/Package.appxmanifest @@ -0,0 +1,43 @@ + + + + + + + + UnoSample + UnoSample + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/UnoSample/UnoSample/Platforms/Desktop/Program.cs b/samples/UnoSample/UnoSample/Platforms/Desktop/Program.cs new file mode 100644 index 00000000..3e9601f0 --- /dev/null +++ b/samples/UnoSample/UnoSample/Platforms/Desktop/Program.cs @@ -0,0 +1,29 @@ +using Uno.UI.Runtime.Skia; +using Velopack; + +namespace UnoSample; +public class Program +{ + [STAThread] + public static void Main(string[] args) + { + // It's important to Run() the VelopackApp as early as possible in app startup. + VelopackApp.Build() + .WithFirstRun((v) => { /* Your first run code here */ }) + .Run(); + +#if (!useDependencyInjection && useLoggingFallback) + App.InitializeLogging(); + +#endif + var host = SkiaHostBuilder.Create() + .App(() => new App()) + .UseX11() + .UseLinuxFrameBuffer() + .UseMacOS() + .UseWindows() + .Build(); + + host.Run(); + } +} diff --git a/samples/UnoSample/UnoSample/Platforms/MacCatalyst/Entitlements.plist b/samples/UnoSample/UnoSample/Platforms/MacCatalyst/Entitlements.plist new file mode 100644 index 00000000..24c31036 --- /dev/null +++ b/samples/UnoSample/UnoSample/Platforms/MacCatalyst/Entitlements.plist @@ -0,0 +1,6 @@ + + + + + + diff --git a/samples/UnoSample/UnoSample/Platforms/MacCatalyst/Info.plist b/samples/UnoSample/UnoSample/Platforms/MacCatalyst/Info.plist new file mode 100644 index 00000000..1bb02ddc --- /dev/null +++ b/samples/UnoSample/UnoSample/Platforms/MacCatalyst/Info.plist @@ -0,0 +1,26 @@ + + + + + UIDeviceFamily + + 2 + + LSApplicationCategoryType + public.app-category.utilities + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Assets.xcassets/icon.appiconset + + + + diff --git a/samples/UnoSample/UnoSample/Platforms/MacCatalyst/Main.maccatalyst.cs b/samples/UnoSample/UnoSample/Platforms/MacCatalyst/Main.maccatalyst.cs new file mode 100644 index 00000000..0cd78a0e --- /dev/null +++ b/samples/UnoSample/UnoSample/Platforms/MacCatalyst/Main.maccatalyst.cs @@ -0,0 +1,19 @@ +using UIKit; +using Velopack; + +namespace UnoSample.MacCatalyst; +public class EntryPoint +{ + // This is the main entry point of the application. + public static void Main(string[] args) + { + // It's important to Run() the VelopackApp as early as possible in app startup. + VelopackApp.Build() + .WithFirstRun((v) => { /* Your first run code here */ }) + .Run(); + + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(App)); + } +} diff --git a/samples/UnoSample/UnoSample/Platforms/MacCatalyst/Media.xcassets/LaunchImages.launchimage/Contents.json b/samples/UnoSample/UnoSample/Platforms/MacCatalyst/Media.xcassets/LaunchImages.launchimage/Contents.json new file mode 100644 index 00000000..69555e44 --- /dev/null +++ b/samples/UnoSample/UnoSample/Platforms/MacCatalyst/Media.xcassets/LaunchImages.launchimage/Contents.json @@ -0,0 +1,58 @@ +{ + "images": [ + { + "orientation": "portrait", + "extent": "full-screen", + "minimum-system-version": "7.0", + "scale": "2x", + "size": "640x960", + "idiom": "iphone" + }, + { + "orientation": "portrait", + "extent": "full-screen", + "minimum-system-version": "7.0", + "subtype": "retina4", + "scale": "2x", + "size": "640x1136", + "idiom": "iphone" + }, + { + "orientation": "portrait", + "extent": "full-screen", + "minimum-system-version": "7.0", + "scale": "1x", + "size": "768x1024", + "idiom": "ipad" + }, + { + "orientation": "landscape", + "extent": "full-screen", + "minimum-system-version": "7.0", + "scale": "1x", + "size": "1024x768", + "idiom": "ipad" + }, + { + "orientation": "portrait", + "extent": "full-screen", + "minimum-system-version": "7.0", + "scale": "2x", + "size": "1536x2048", + "idiom": "ipad" + }, + { + "orientation": "landscape", + "extent": "full-screen", + "minimum-system-version": "7.0", + "scale": "2x", + "size": "2048x1536", + "idiom": "ipad" + } + ], + "properties": {}, + "info": { + "version": 1, + "author": "" + } +} \ No newline at end of file diff --git a/samples/UnoSample/UnoSample/Platforms/Windows/Program.cs b/samples/UnoSample/UnoSample/Platforms/Windows/Program.cs new file mode 100644 index 00000000..bffedb4d --- /dev/null +++ b/samples/UnoSample/UnoSample/Platforms/Windows/Program.cs @@ -0,0 +1,26 @@ +using Microsoft.UI.Dispatching; +using Velopack; + +namespace UnoSample; +public static class Program +{ + // https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/applifecycle?WT.mc_id=DT-MVP-5003472#single-instancing-in-main-or-wwinmain + [STAThread] + public static void Main(string[] args) + { + // It's important to Run() the VelopackApp as early as possible in app startup. + VelopackApp.Build() + .WithFirstRun((v) => { /* Your first run code here */ }) + .Run(); + + WinRT.ComWrappersSupport.InitializeComWrappers(); + + Application.Start((p) => + { + var context = new DispatcherQueueSynchronizationContext( + DispatcherQueue.GetForCurrentThread()); + SynchronizationContext.SetSynchronizationContext(context); + new App(); + }); + } +} diff --git a/samples/UnoSample/UnoSample/Platforms/Windows/Properties/PublishProfiles/win-arm64.pubxml b/samples/UnoSample/UnoSample/Platforms/Windows/Properties/PublishProfiles/win-arm64.pubxml new file mode 100644 index 00000000..d5147f10 --- /dev/null +++ b/samples/UnoSample/UnoSample/Platforms/Windows/Properties/PublishProfiles/win-arm64.pubxml @@ -0,0 +1,22 @@ + + + + + FileSystem + arm64 + win-arm64 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + False + True + + + + diff --git a/samples/UnoSample/UnoSample/Platforms/Windows/Properties/PublishProfiles/win-x64.pubxml b/samples/UnoSample/UnoSample/Platforms/Windows/Properties/PublishProfiles/win-x64.pubxml new file mode 100644 index 00000000..4fea954e --- /dev/null +++ b/samples/UnoSample/UnoSample/Platforms/Windows/Properties/PublishProfiles/win-x64.pubxml @@ -0,0 +1,22 @@ + + + + + FileSystem + x64 + win-x64 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + False + True + + + + diff --git a/samples/UnoSample/UnoSample/Platforms/Windows/Properties/PublishProfiles/win-x86.pubxml b/samples/UnoSample/UnoSample/Platforms/Windows/Properties/PublishProfiles/win-x86.pubxml new file mode 100644 index 00000000..928cb25e --- /dev/null +++ b/samples/UnoSample/UnoSample/Platforms/Windows/Properties/PublishProfiles/win-x86.pubxml @@ -0,0 +1,22 @@ + + + + + FileSystem + x86 + win-x86 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + False + True + + + + diff --git a/samples/UnoSample/UnoSample/Presentation/MainPage.xaml b/samples/UnoSample/UnoSample/Presentation/MainPage.xaml new file mode 100644 index 00000000..a0c2a48a --- /dev/null +++ b/samples/UnoSample/UnoSample/Presentation/MainPage.xaml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + +