chore: update uno sample app with latest (#584)

* chore: update uno sample app with latest

* Cleaning up UnoSample to use SampleHelper

Updated the top level Directory.Build.targets to support samples with solutions and nested directories.
Added build scripts.

* Adding Uno sample to GHA

* Remove framework bootstrap

* Fixing mainExe name on non-windows

---------

Co-authored-by: Kevin Bost <kitokeboo@gmail.com>
This commit is contained in:
Steve Bilogan
2025-03-26 07:29:19 -07:00
committed by GitHub
parent 57cf68d127
commit 4d1388fb5f
58 changed files with 389 additions and 1335 deletions

View File

@@ -393,7 +393,7 @@ jobs:
strategy:
fail-fast: false
matrix:
sample: [CPlusPlusWidgets, CPlusPlusWin32, CSharpAvalonia, CSharpWpf, NodeJSElectron, RustIced]
sample: [CPlusPlusWidgets, CPlusPlusWin32, CSharpAvalonia, CSharpUno, CSharpWpf, NodeJSElectron, RustIced]
os: [windows-latest, ubuntu-latest, macos-latest]
exclude:
- os: ubuntu-latest

View File

@@ -9,11 +9,27 @@ root = true
##########################################
[*]
indent_style = space
indent_style = tab
end_of_line = crlf
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
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
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
dotnet_style_prefer_compound_assignment = true:suggestion
##########################################
# File Extension Settings
@@ -31,40 +47,40 @@ indent_style = tab
indent_size = 2
[*.{csproj,proj,projitems,shproj}]
indent_size = 2
indent_size = 4
[*.{json,slnf}]
indent_size = 2
end_of_line = lf
[*.{props,targets}]
indent_size = 2
indent_size = 4
[*.xaml]
indent_size = 2
indent_size = 4
charset = utf-8-bom
[*.xml]
indent_size = 2
indent_size = 4
end_of_line = lf
[*.plist]
indent_size = 2
indent_size = 4
indent_style = tab
end_of_line = lf
[*.manifest]
indent_size = 2
indent_size = 4
[*.appxmanifest]
indent_size = 2
indent_size = 4
[*.{json,css,webmanifest}]
indent_size = 2
end_of_line = lf
[web.config]
indent_size = 2
indent_size = 4
end_of_line = lf
[*.sh]
@@ -165,3 +181,4 @@ 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
csharp_prefer_system_threading_lock = true:suggestion

View File

@@ -82,6 +82,8 @@ StyleCopReport.xml
*.pgc
*.pgd
*.rsp
# but not Directory.Build.rsp, as it configures directory-level build defaults
!Directory.Build.rsp
*.sbr
*.tlb
*.tli

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

@@ -0,0 +1,32 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="UnoSample (Desktop)" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/UnoSample/UnoSample.csproj" />
<option name="LAUNCH_PROFILE_TFM" value="net9.0-desktop" />
<option name="LAUNCH_PROFILE_NAME" value="UnoSample (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="UnoSample (WinAppSDK Unpackaged)" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/UnoSample/UnoSample.csproj" />
<option name="LAUNCH_PROFILE_TFM" value="net9.0-windows10.0.26100.0" />
<option name="LAUNCH_PROFILE_NAME" value="UnoSample (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

@@ -4,23 +4,16 @@
// 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)",
"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",
"program": "${workspaceFolder}/UnoSample/bin/Debug/net9.0-desktop/UnoSample.dll",
"args": [],
"launchSettingsProfile": "UnoSample (Desktop)",
"env": {

View File

@@ -3,5 +3,8 @@
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"*.xaml": "$(capture).xaml.cs"
},
"files.associations": {
"global.json": "jsonc"
}
}

View File

@@ -9,7 +9,7 @@
"build",
"${workspaceFolder}/UnoSample/UnoSample.csproj",
"/property:GenerateFullPaths=true",
"/property:TargetFramework=net8.0-desktop",
"/property:TargetFramework=net9.0-desktop",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
@@ -22,7 +22,7 @@
"publish",
"${workspaceFolder}/UnoSample/UnoSample.csproj",
"/property:GenerateFullPaths=true",
"/property:TargetFramework=net8.0-desktop",
"/property:TargetFramework=net9.0-desktop",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"

View File

@@ -7,16 +7,10 @@
"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"
]

View File

@@ -12,12 +12,4 @@
-->
<NoWarn>$(NoWarn);NU1507;NETSDK1201;PRI257</NoWarn>
</PropertyGroup>
<!-- See https://aka.platform.uno/using-uno-sdk#implicit-packages for more information regarding the Implicit Packages version properties. -->
<PropertyGroup>
<UnoExtensionsVersion>4.1.23</UnoExtensionsVersion>
<UnoToolkitVersion>6.0.24</UnoToolkitVersion>
<UnoThemesVersion>5.0.13</UnoThemesVersion>
<UnoCSharpMarkupVersion>5.2.14</UnoCSharpMarkupVersion>
</PropertyGroup>
</Project>

View File

@@ -1,2 +1,3 @@
<Project>
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />
</Project>

View File

@@ -3,13 +3,9 @@
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>
</ItemGroup>
<ItemGroup>
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
<PackageVersion Include="System.Text.Json" Version="9.0.3" />
<PackageVersion Include="Velopack" Version="0.0.1053" />
<PackageVersion Include="Velopack.Build" Version="0.0.1053" />
</ItemGroup>
</Project>

View File

@@ -1,39 +0,0 @@
# 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 need to authenticate with the Velopack Flow service by running `vpk login` and signing in with your Velopack Flow account.
## The Application
`Presentation/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 `App.xaml.cs` has been updated to contain the [Velopack application startup hook](https://docs.velopack.io/integrating/overview).
### Updating the Project file
There are two properties to set in the `csproj` file to enable the Velopack Flow integration. These are:
```xml
<VelopackPushOnPublish>true</VelopackPushOnPublish>
<VelopackPackId>Velopack.UnoSample</VelopackPackId>
```
`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.You **MUST** change this to be your own application identifier.
`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 `<Version>` with the desired version number.
The `-f` option is used to specify the target framework. Because each target platform should result in a different build, you likely will want to specify a different Velopack channel for each target platform. By default, it will default to your target OS. You can specify the channel by adding `-p:VelopackChannel=<Channel>` to the command.
This can be any of the desktop frameworks specified in the `csproj` file.
```bash
dotnet publish -c Release -f net8.0-desktop -p:VelopackChannel=<Channel> -p:Version=<Version>
```
For example:
```bash
dotnet publish -c Release -f net8.0-desktop -p:VelopackChannel=win-desktop -p:Version=1.0.5
```

View File

@@ -1,17 +1,18 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.34929.205
VisualStudioVersion = 17.13.35913.81 d17.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnoSample", "UnoSample\UnoSample.csproj", "{F9ACED52-AE70-46F6-8C7C-2EF629084661}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnoSample", "UnoSample\UnoSample.csproj", "{6BF41A07-4B32-447E-96AB-5437C3564AFD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{29980CC9-DC41-4944-966D-F088C84D1C7B}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
Directory.Packages.props = Directory.Packages.props
global.json = global.json
README.md = README.md
EndProjectSection
EndProject
Global
@@ -20,15 +21,17 @@ Global
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
{6BF41A07-4B32-447E-96AB-5437C3564AFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6BF41A07-4B32-447E-96AB-5437C3564AFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6BF41A07-4B32-447E-96AB-5437C3564AFD}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{6BF41A07-4B32-447E-96AB-5437C3564AFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6BF41A07-4B32-447E-96AB-5437C3564AFD}.Release|Any CPU.Build.0 = Release|Any CPU
{6BF41A07-4B32-447E-96AB-5437C3564AFD}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2FA3FC94-E895-443E-AAA8-9A7F956F9E92}
SolutionGuid = {800ACAFE-BC3B-4646-9989-C59A522D41E4}
EndGlobalSection
EndGlobal

View File

@@ -1,28 +1,17 @@
<Application
x:Class="UnoSample.App"
<Application x:Class="UnoSample.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">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<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>
</ResourceDictionary>
</Application.Resources>
<!-- Add resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@@ -19,98 +19,115 @@ public partial class App : Application
}
protected Window? MainWindow { get; private set; }
protected IHost? Host { get; private set; }
protected async override void OnLaunched(LaunchActivatedEventArgs args)
protected 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
MainWindow = new Window();
#if DEBUG
// Switch to Development environment when running in DEBUG
.UseEnvironment(Environments.Development)
MainWindow.UseStudio();
#endif
.UseLogging(configure: (context, logBuilder) =>
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (MainWindow.Content is not Frame rootFrame)
{
// Configure log levels for different categories of logging
logBuilder
.SetMinimumLevel(
context.HostingEnvironment.IsDevelopment() ?
LogLevel.Information :
LogLevel.Warning)
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
// Default filters for core Uno Platform namespaces
.CoreLogLevel(LogLevel.Warning);
// Place the frame in the current Window
MainWindow.Content = rootFrame;
// 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);
rootFrame.NavigationFailed += OnNavigationFailed;
}
}, 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))
.ConfigureServices((context, services) =>
if (rootFrame.Content == null)
{
// TODO: Register your services
//services.AddSingleton<IMyService, MyService>();
})
.UseNavigation(RegisterRoutes)
);
MainWindow = builder.Window;
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), args.Arguments);
}
#if DEBUG
MainWindow.EnableHotReload();
#endif
MainWindow.SetWindowIcon();
Host = await builder.NavigateAsync<Shell>();
// Ensure the current window is active
MainWindow.Activate();
}
private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes)
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
views.Register(
new ViewMap(ViewModel: typeof(ShellViewModel)),
new ViewMap<MainPage, MainViewModel>()
);
throw new InvalidOperationException($"Failed to load {e.SourcePageType.FullName}: {e.Exception}");
}
routes.Register(
new RouteMap("", View: views.FindByViewModel<ShellViewModel>(),
Nested:
[
new ("Main", View: views.FindByViewModel<MainViewModel>())
]
)
);
/// <summary>
/// Configures global Uno Platform logging
/// </summary>
public static void InitializeLogging()
{
#if DEBUG
// Logging is disabled by default for release builds, as it incurs a significant
// initialization cost from Microsoft.Extensions.Logging setup. If startup performance
// is a concern for your application, keep this disabled. If you're running on the web or
// desktop targets, you can use URL or command line parameters to enable it.
//
// For more performance documentation: https://platform.uno/docs/articles/Uno-UI-Performance.html
var factory = LoggerFactory.Create(builder =>
{
#if __WASM__
builder.AddProvider(new global::Uno.Extensions.Logging.WebAssembly.WebAssemblyConsoleLoggerProvider());
#elif __IOS__ || __MACCATALYST__
builder.AddProvider(new global::Uno.Extensions.Logging.OSLogLoggerProvider());
#else
builder.AddConsole();
#endif
// Exclude logs below this level
builder.SetMinimumLevel(LogLevel.Information);
// Default filters for Uno Platform namespaces
builder.AddFilter("Uno", LogLevel.Warning);
builder.AddFilter("Windows", LogLevel.Warning);
builder.AddFilter("Microsoft", LogLevel.Warning);
// Generic Xaml events
// builder.AddFilter("Microsoft.UI.Xaml", LogLevel.Debug );
// builder.AddFilter("Microsoft.UI.Xaml.VisualStateGroup", LogLevel.Debug );
// builder.AddFilter("Microsoft.UI.Xaml.StateTriggerBase", LogLevel.Debug );
// builder.AddFilter("Microsoft.UI.Xaml.UIElement", LogLevel.Debug );
// builder.AddFilter("Microsoft.UI.Xaml.FrameworkElement", LogLevel.Trace );
// Layouter specific messages
// builder.AddFilter("Microsoft.UI.Xaml.Controls", LogLevel.Debug );
// builder.AddFilter("Microsoft.UI.Xaml.Controls.Layouter", LogLevel.Debug );
// builder.AddFilter("Microsoft.UI.Xaml.Controls.Panel", LogLevel.Debug );
// builder.AddFilter("Windows.Storage", LogLevel.Debug );
// Binding related messages
// builder.AddFilter("Microsoft.UI.Xaml.Data", LogLevel.Debug );
// builder.AddFilter("Microsoft.UI.Xaml.Data", LogLevel.Debug );
// Binder memory references tracking
// builder.AddFilter("Uno.UI.DataBinding.BinderReferenceHolder", LogLevel.Debug );
// DevServer and HotReload related
// builder.AddFilter("Uno.UI.RemoteControl", LogLevel.Information);
// Debug JS interop
// builder.AddFilter("Uno.Foundation.WebAssemblyRuntime", LogLevel.Debug );
});
global::Uno.Extensions.LogExtensionPoint.AmbientLoggerFactory = factory;
#if HAS_UNO
global::Uno.UI.Adapter.Microsoft.Extensions.Logging.LoggingAdapter.Initialize();
#endif
#endif
}
}

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M16 7H3.83L9.42 1.41L8 0L0 8L8 16L9.41 14.59L3.83 9H16V7Z" fill="#1C1B1F"/>
</svg>

Before

Width:  |  Height:  |  Size: 188 B

View File

@@ -1,15 +1,3 @@
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;

View File

@@ -0,0 +1,24 @@
<Page x:Class="UnoSample.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UnoSample"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<StackPanel HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="16">
<TextBlock Text="The app is not installed with Velopack"
Visibility="{x:Bind NotInstalled}" />
<TextBlock Text="{x:Bind ViewModel.CurrentVersion}" />
<Button HorizontalAlignment="Center"
Command="{Binding CheckForUpdatesCommand}"
Content="Check For Updates" />
<Button HorizontalAlignment="Center"
Command="{Binding DownloadUpdatesCommand}"
Content="Download Updates"
Visibility="{x:Bind ViewModel.HasUpdate, Mode=OneWay}" />
<TextBlock Text="{Binding Status}" />
</StackPanel>
</Grid>
</Page>

View File

@@ -0,0 +1,15 @@
namespace UnoSample;
public sealed partial class MainPage : Page
{
public MainViewModel ViewModel { get; } = new MainViewModel();
public bool NotInstalled => ViewModel.IsInstalled != true;
public MainPage()
{
this.InitializeComponent();
this.DataContext = ViewModel;
}
}

View File

@@ -0,0 +1,65 @@
using Velopack;
namespace UnoSample;
public partial class MainViewModel : ObservableObject
{
private readonly UpdateManager _updateManager;
public bool IsInstalled => _updateManager.IsInstalled;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(HasUpdate))]
private UpdateInfo? _latestUpdate;
public bool HasUpdate => LatestUpdate != null;
public string CurrentVersion => _updateManager.CurrentVersion?.ToFullString() ?? "";
[ObservableProperty]
private string? _status;
public MainViewModel()
{
var updateUrl = SampleHelper.GetReleasesDir(); // replace with your update path/url
_updateManager = new UpdateManager(updateUrl!);
}
[RelayCommand(CanExecute = nameof(IsInstalled))]
private async Task CheckForUpdates()
{
if (_updateManager.IsInstalled)
{
try
{
Status = "Checking for updates...";
LatestUpdate = await _updateManager.CheckForUpdatesAsync();
Status = LatestUpdate is null ? "No updates available" : $"{LatestUpdate.TargetFullRelease.Version} - Update available";
}
catch (Exception ex)
{
Status = ex.Message;
}
}
}
[RelayCommand(CanExecute = nameof(IsInstalled))]
private async Task DownloadUpdates()
{
if (_updateManager.IsInstalled && LatestUpdate is { } latestUpdate)
{
try
{
Status = $"Downloading {0:p}";
await _updateManager.DownloadUpdatesAsync(latestUpdate, progress => Status = $"Downloading {progress / 100.0:p}");
Status = "Restarting...";
_updateManager.ApplyUpdatesAndRestart(latestUpdate.TargetFullRelease);
}
catch (Exception ex)
{
Status = ex.Message;
}
}
}
}

View File

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

View File

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

View File

@@ -1,15 +0,0 @@
namespace UnoSample.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="UnoSample"
Publisher="O=Velopack"
Version="1.0.0.0" />
<Properties>
<DisplayName>UnoSample</DisplayName>
<PublisherDisplayName>UnoSample</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="UnoSample"
Description="UnoSample">
<uap:SplashScreen />
</uap:VisualElements>
<uap:VisualElements />
</Application>
</Applications>

View File

@@ -6,10 +6,8 @@ public class Program
[STAThread]
public static void Main(string[] args)
{
#if (!useDependencyInjection && useLoggingFallback)
App.InitializeLogging();
#endif
var host = SkiaHostBuilder.Create()
.App(() => new App())
.UseX11()

View File

@@ -1,6 +0,0 @@
<?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">
<dict>
</dict>
</plist>

View File

@@ -1,26 +0,0 @@
<?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">
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>2</integer>
</array>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/icon.appiconset</string>
<!--
Adjust this to your application's encryption usage.
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
-->
</dict>
</plist>

View File

@@ -1,13 +0,0 @@
using UIKit;
namespace UnoSample.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

@@ -1,58 +0,0 @@
{
"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": ""
}
}

View File

@@ -1,23 +0,0 @@
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)
// {
// WinRT.ComWrappersSupport.InitializeComWrappers();
// Application.Start((p) =>
// {
// var context = new DispatcherQueueSynchronizationContext(
// DispatcherQueue.GetForCurrentThread());
// SynchronizationContext.SetSynchronizationContext(context);
// new App();
// });
// }
//}

View File

@@ -1,39 +0,0 @@
<Page
x:Class="UnoSample.Presentation.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UnoSample.Presentation"
xmlns:uen="using:Uno.Extensions.Navigation.UI"
xmlns:um="using:Uno.Material"
xmlns:utu="using:Uno.Toolkit.UI"
Background="{ThemeResource BackgroundBrush}"
NavigationCacheMode="Required">
<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">
<TextBlock Text="The app is not installed with Velopack" Visibility="{x:Bind NotInstalled}" />
<TextBlock Text="{x:Bind ViewModel.CurrentVersion}" />
<Button
HorizontalAlignment="Center"
Command="{Binding CheckForUpdatesCommand}"
Content="Check For Updates" />
<Button
HorizontalAlignment="Center"
Command="{Binding DownloadUpdatesCommand}"
Content="Download Updates"
Visibility="{x:Bind ViewModel.HasUpdate, Mode=OneWay}" />
<TextBlock Text="{Binding Status}" />
</StackPanel>
</Grid>
</Page>

View File

@@ -1,13 +0,0 @@
namespace UnoSample.Presentation;
public sealed partial class MainPage : Page
{
public MainViewModel ViewModel => (MainViewModel)DataContext;
public bool NotInstalled => ViewModel?.IsInstalled != true;
public MainPage()
{
InitializeComponent();
}
}

View File

@@ -1,72 +0,0 @@
using Velopack;
using Velopack.Sources;
namespace UnoSample.Presentation;
public partial class MainViewModel : ObservableObject
{
private readonly UpdateManager _updateManager;
public bool IsInstalled => _updateManager.IsInstalled;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(HasUpdate))]
private UpdateInfo? _latestUpdate;
public bool HasUpdate => LatestUpdate != null;
public string CurrentVersion => _updateManager.CurrentVersion?.ToFullString() ?? "";
[ObservableProperty]
private string? _status;
public MainViewModel(
IStringLocalizer localizer,
IOptions<AppConfig> appInfo)
{
Title = "Main";
Title += $" - {localizer["ApplicationName"]}";
Title += $" - {appInfo?.Value?.Environment}";
_updateManager = new UpdateManager(new VelopackFlowUpdateSource());
}
public string? Title { get; }
[RelayCommand(CanExecute = nameof(IsInstalled))]
private async Task CheckForUpdates()
{
if (_updateManager.IsInstalled)
{
try
{
Status = "Checking for updates...";
LatestUpdate = await _updateManager.CheckForUpdatesAsync();
Status = LatestUpdate is null ? "No updates available" : $"{LatestUpdate.TargetFullRelease.Version} - Update available";
}
catch (Exception ex)
{
Status = ex.Message;
}
}
}
[RelayCommand(CanExecute = nameof(IsInstalled))]
private async Task DownloadUpdates()
{
if (_updateManager.IsInstalled && LatestUpdate is { } latestUpdate)
{
try
{
Status = $"Downloading {0:p}";
await _updateManager.DownloadUpdatesAsync(latestUpdate, progress => Status = $"Downloading {progress / 100.0:p}");
Status = "Restarting...";
_updateManager.ApplyUpdatesAndRestart(latestUpdate.TargetFullRelease);
}
catch(Exception ex)
{
Status = ex.Message;
}
}
}
}

View File

@@ -1,36 +0,0 @@
<UserControl x:Class="UnoSample.Presentation.Shell"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UnoSample.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

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

View File

@@ -1,18 +0,0 @@
namespace UnoSample.Presentation;
public class ShellViewModel
{
private readonly INavigator _navigator;
public ShellViewModel(
INavigator navigator)
{
_navigator = navigator;
_ = Start();
}
public async Task Start()
{
await _navigator.NavigateViewModelAsync<MainViewModel>(this);
}
}

View File

@@ -12,11 +12,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<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 -->
<!--
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
<TrimMode>partial</TrimMode>
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
-->
</PropertyGroup>
</Project>

View File

@@ -12,11 +12,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<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 -->
<!--
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
<TrimMode>partial</TrimMode>
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
-->
</PropertyGroup>
</Project>

View File

@@ -12,7 +12,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<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 -->
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
<!--
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
<TrimMode>partial</TrimMode>

View File

@@ -1,23 +0,0 @@
using System.Collections.Immutable;
using System.Text.Json.Serialization;
namespace UnoSample.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

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

View File

@@ -1,76 +0,0 @@
using System.Net;
namespace UnoSample.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

@@ -1,44 +0,0 @@
namespace UnoSample.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

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

View File

@@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<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>UnoSample-es</value>
</data>
</root>

View File

@@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<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>UnoSample-fr</value>
</data>
</root>

View File

@@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<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>UnoSample-pt-BR</value>
</data>
</root>

View File

@@ -1,76 +0,0 @@
{
"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

@@ -1,65 +0,0 @@
<!-- This file is generated by a tool from the file ColorPaletteOverride.json - - YOU SHOULD NOT EDIT IT manually.-->
<ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<Color x:Key="PrimaryColor">#5946D2</Color>
<Color x:Key="SurfaceTintColor">#5946D2</Color>
<Color x:Key="OnPrimaryColor">#FFFFFF</Color>
<Color x:Key="PrimaryContainerColor">#E5DEFF</Color>
<Color x:Key="OnPrimaryContainerColor">#170065</Color>
<Color x:Key="SecondaryColor">#6B4EA2</Color>
<Color x:Key="OnSecondaryColor">#FFFFFF</Color>
<Color x:Key="SecondaryContainerColor">#EBDDFF</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>
<Color x:Key="OnTertiaryContainerColor">#001D36</Color>
<Color x:Key="ErrorColor">#B3261E</Color>
<Color x:Key="OnErrorColor">#FFFFFF</Color>
<Color x:Key="ErrorContainerColor">#F9DEDC</Color>
<Color x:Key="OnErrorContainerColor">#410E0B</Color>
<Color x:Key="BackgroundColor">#FCFBFF</Color>
<Color x:Key="OnBackgroundColor">#1C1B1F</Color>
<Color x:Key="SurfaceColor">#FFFFFF</Color>
<Color x:Key="OnSurfaceColor">#1C1B1F</Color>
<Color x:Key="SurfaceVariantColor">#F2EFF5</Color>
<Color x:Key="OnSurfaceVariantColor">#8B8494</Color>
<Color x:Key="OutlineColor">#79747E</Color>
<Color x:Key="OutlineVariantColor">#C9C5D0</Color>
<Color x:Key="SurfaceInverseColor">#E6E1E5</Color>
<Color x:Key="OnsurfaceInverseColor">#1C1B1F</Color>
<Color x:Key="PrimaryInverseColor">#2A009F</Color>
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<Color x:Key="PrimaryColor">#C7BFFF</Color>
<Color x:Key="SurfaceTintColor">#C7BFFF</Color>
<Color x:Key="OnPrimaryColor">#2A009F</Color>
<Color x:Key="PrimaryContainerColor">#4129BA</Color>
<Color x:Key="OnPrimaryContainerColor">#E4DFFF</Color>
<Color x:Key="SecondaryColor">#CDC2DC</Color>
<Color x:Key="OnSecondaryColor">#332D41</Color>
<Color x:Key="SecondaryContainerColor">#433C52</Color>
<Color x:Key="OnSecondaryContainerColor">#EDDFFF</Color>
<Color x:Key="TertiaryColor">#9FCAFF</Color>
<Color x:Key="OnTertiaryColor">#003258</Color>
<Color x:Key="TertiaryContainerColor">#00497D</Color>
<Color x:Key="OnTertiaryContainerColor">#D1E4FF</Color>
<Color x:Key="ErrorColor">#FFB4AB</Color>
<Color x:Key="OnErrorColor">#690005</Color>
<Color x:Key="ErrorContainerColor">#93000A</Color>
<Color x:Key="OnErrorContainerColor">#FFDAD6</Color>
<Color x:Key="BackgroundColor">#1C1B1F</Color>
<Color x:Key="OnBackgroundColor">#E5E1E6</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>
<Color x:Key="OutlineColor">#928F99</Color>
<Color x:Key="OutlineVariantColor">#57545D</Color>
<Color x:Key="SurfaceInverseColor">#E6E1E5</Color>
<Color x:Key="OnsurfaceInverseColor">#1C1B1F</Color>
<Color x:Key="PrimaryInverseColor">#2A009F</Color>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>

View File

@@ -1,10 +1,6 @@
<Project Sdk="Uno.Sdk">
<PropertyGroup>
<TargetFrameworks>
net8.0-maccatalyst;
net8.0-windows10.0.19041;
net8.0-desktop;
</TargetFrameworks>
<TargetFrameworks>net9.0-desktop;net9.0-windows10.0.26100</TargetFrameworks>
<OutputType>Exe</OutputType>
<UnoSingleProject>true</UnoSingleProject>
@@ -19,6 +15,10 @@
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<!-- Package Publisher -->
<ApplicationPublisher>Velopack</ApplicationPublisher>
<!-- Package Description -->
<Description>UnoSample powered by Uno Platform.</Description>
<!--
If you encounter this error message:
@@ -36,42 +36,12 @@
https://aka.platform.uno/singleproject-features
-->
<UnoFeatures>
Material;
Dsp;
Hosting;
Toolkit;
Logging;
Mvvm;
Configuration;
Http;
Serialization;
Localization;
Navigation;
ThemeService;
</UnoFeatures>
</PropertyGroup>
<!--
Disables the auto-generated Main method so that we can add in the Velopack calls at startup.
-->
<!--<PropertyGroup Condition="'$(TargetFramework)'=='net8.0-windows10.0.19041'">
<DefineConstants>$(DefineConstants);DISABLE_XAML_GENERATED_MAIN</DefineConstants>
</PropertyGroup>-->
<ItemGroup>
<PackageReference Include="System.Private.Uri" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="Velopack" />
<PackageReference Include="Velopack.Build">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Compile Update="Platforms\Windows\Program.cs">
<Sdk>Uno</Sdk>
</Compile>
</ItemGroup>
</Project>

View File

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

View File

@@ -1,16 +0,0 @@
{
"AppConfig": {
"Environment": "Production"
},
"ApiClient": {
"UseNativeHandler": true
},
"LocalizationConfiguration": {
"Cultures": [
"es",
"fr",
"pt-BR",
"en"
]
}
}

View File

@@ -0,0 +1,18 @@
@echo off
setlocal enabledelayedexpansion
if "%~1"=="" (
echo Version number is required.
echo Usage: build.bat [version]
exit /b 1
)
set "version=%~1"
echo.
echo Compiling CSharpUno with dotnet...
dotnet publish -c Release --framework net9.0-desktop -o %~dp0UnoSample\publish UnoSample\UnoSample.csproj
echo.
echo Building Velopack Release v%version%
vpk pack -u CSharpUno -v %version% -o %~dp0UnoSample\releases -p %~dp0UnoSample\publish --mainExe UnoSample.exe

View File

@@ -0,0 +1,21 @@
#!/bin/bash
# Check if version parameter is provided
if [ "$#" -ne 1 ]; then
echo "Version number is required."
echo "Usage: ./build.sh [version]"
exit 1
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_VERSION="$1"
RELEASE_DIR="$SCRIPT_DIR/UnoSample/releases"
PUBLISH_DIR="$SCRIPT_DIR/UnoSample/publish"
echo ""
echo Compiling CSharpUno with dotnet...
dotnet publish -c Release --framework net9.0-desktop -o "$PUBLISH_DIR" UnoSample/UnoSample.csproj
echo ""
echo "Building Velopack Release v$BUILD_VERSION"
vpk pack -u CSharpUno -v $BUILD_VERSION -o "$RELEASE_DIR" -p "$PUBLISH_DIR" --mainExe UnoSample

View File

@@ -2,5 +2,8 @@
// 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.6.51"
},
"sdk":{
"allowPrerelease": false
}
}

View File

@@ -10,12 +10,12 @@
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>VelopackSampleReleaseDir</_Parameter1>
<_Parameter2>$(MSBuildThisFileDirectory)$(ProjectName)/releases</_Parameter2>
<_Parameter2>$(MSBuildProjectDirectory)/releases</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>
<Compile Include="..\SampleHelper.cs" Link="SampleHelper.cs" Visible="false" />
<Compile Include="$([MSBuild]::GetPathOfFileAbove('SampleHelper.cs', '$(MSBuildThisFileDirectory)'))" Link="SampleHelper.cs" Visible="false" />
</ItemGroup>
</Project>

View File

@@ -1,10 +1,12 @@
using System.Linq;
using System.Reflection;
#nullable enable
internal static class SampleHelper
{
public static string GetReleasesDir() => Assembly.GetEntryAssembly()
public static string? GetReleasesDir() => Assembly.GetEntryAssembly()?
.GetCustomAttributes<AssemblyMetadataAttribute>()
.Where(x => x.Key == "VelopackSampleReleaseDir")
.Single().Value;
}
#nullable restore