-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
1,766 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<Application x:Class="Sample.Uno.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:utum="using:Uno.Toolkit.UI.Material"> | ||
|
||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<!-- Load WinUI resources --> | ||
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" /> | ||
<utum:MaterialToolkitTheme | ||
ColorOverrideSource="ms-appx:///Styles/ColorPaletteOverride.xaml"> | ||
<!-- NOTE: You can override the default Roboto font by providing your font assets here. --> | ||
<!-- <utum:MaterialToolkitTheme.FontOverrideDictionary> | ||
<ResourceDictionary> | ||
<FontFamily x:Key="MaterialLightFontFamily">ms-appx:///Uno.Fonts.Roboto/Fonts/Roboto-Light.ttf#Roboto</FontFamily> | ||
<FontFamily x:Key="MaterialMediumFontFamily">ms-appx:///Uno.Fonts.Roboto/Fonts/Roboto-Medium.ttf#Roboto</FontFamily> | ||
<FontFamily x:Key="MaterialRegularFontFamily">ms-appx:///Uno.Fonts.Roboto/Fonts/Roboto-Regular.ttf#Roboto</FontFamily> | ||
</ResourceDictionary> | ||
</utum:MaterialToolkitTheme.FontOverrideDictionary> --> | ||
</utum:MaterialToolkitTheme> | ||
</ResourceDictionary.MergedDictionaries> | ||
|
||
<!-- Add resources here --> | ||
|
||
</ResourceDictionary> | ||
</Application.Resources> | ||
|
||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
using Microsoft.UI.Xaml; | ||
using Shiny.Mediator; | ||
using Uno.Extensions; | ||
using Uno.Extensions.Configuration; | ||
using Uno.Extensions.Hosting; | ||
using Uno.Extensions.Navigation; | ||
using Uno.Resizetizer; | ||
using Uno.UI; | ||
using Window = ABI.Microsoft.UI.Xaml.Window; | ||
|
||
namespace Sample.Uno; | ||
|
||
public partial class App : Application | ||
{ | ||
/// <summary> | ||
/// Initializes the singleton application object. This is the first line of authored code | ||
/// executed, and as such is the logical equivalent of main() or WinMain(). | ||
/// </summary> | ||
public App() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
protected Window? MainWindow { get; private set; } | ||
protected IHost? Host { get; private set; } | ||
|
||
protected async override void OnLaunched(LaunchActivatedEventArgs args) | ||
{ | ||
var builder = this.CreateBuilder(args) | ||
// Add navigation support for toolkit controls such as TabBar and NavigationView | ||
.UseToolkitNavigation() | ||
.Configure(host => host | ||
#if DEBUG | ||
// Switch to Development environment when running in DEBUG | ||
.UseEnvironment(Environments.Development) | ||
#endif | ||
.UseLogging(configure: (context, logBuilder) => | ||
{ | ||
// Configure log levels for different categories of logging | ||
logBuilder | ||
.SetMinimumLevel( | ||
context.HostingEnvironment.IsDevelopment() ? LogLevel.Information : LogLevel.Warning) | ||
|
||
// Default filters for core Uno Platform namespaces | ||
.CoreLogLevel(LogLevel.Warning); | ||
|
||
// Uno Platform namespace filter groups | ||
// Uncomment individual methods to see more detailed logging | ||
//// Generic Xaml events | ||
//logBuilder.XamlLogLevel(LogLevel.Debug); | ||
//// Layout specific messages | ||
//logBuilder.XamlLayoutLogLevel(LogLevel.Debug); | ||
//// Storage messages | ||
//logBuilder.StorageLogLevel(LogLevel.Debug); | ||
//// Binding related messages | ||
//logBuilder.XamlBindingLogLevel(LogLevel.Debug); | ||
//// Binder memory references tracking | ||
//logBuilder.BinderMemoryReferenceLogLevel(LogLevel.Debug); | ||
//// DevServer and HotReload related | ||
//logBuilder.HotReloadCoreLogLevel(LogLevel.Information); | ||
//// Debug JS interop | ||
//logBuilder.WebAssemblyLogLevel(LogLevel.Debug); | ||
}, enableUnoLogging: true) | ||
.UseConfiguration(configure: configBuilder => | ||
configBuilder | ||
.EmbeddedSource<App>() | ||
.Section<AppConfig>() | ||
) | ||
.ConfigureServices((context, services) => | ||
{ | ||
// TODO: Register your services | ||
//services.AddSingleton<IMyService, MyService>(); | ||
}) | ||
.UseNavigation(RegisterRoutes) | ||
.AddShinyMediator() | ||
); | ||
MainWindow = builder.Window; | ||
|
||
#if DEBUG | ||
MainWindow.UseStudio(); | ||
#endif | ||
MainWindow.SetWindowIcon(); | ||
|
||
Host = await builder.NavigateAsync<Shell>(); | ||
} | ||
|
||
private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes) | ||
{ | ||
views.Register( | ||
new ViewMap(ViewModel: typeof(ShellViewModel)), | ||
new ViewMap<MainPage, MainViewModel>(), | ||
new DataViewMap<SecondPage, SecondViewModel, Entity>() | ||
); | ||
|
||
routes.Register( | ||
new RouteMap("", View: views.FindByViewModel<ShellViewModel>(), | ||
Nested: | ||
[ | ||
new("Main", View: views.FindByViewModel<MainViewModel>(), IsDefault: true), | ||
new("Second", View: views.FindByViewModel<SecondViewModel>()), | ||
] | ||
) | ||
); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | |
Oops, something went wrong.