Skip to content

Commit 9e4d75c

Browse files
authored
Merge pull request #588 from peterfoot/PageNavigation
UnoCakesMobile sample to demonstrate page navigation techniques
2 parents 1108ab6 + f6589e7 commit 9e4d75c

File tree

90 files changed

+3090
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+3090
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@ A sample travel app that shows how a user could 1) search for locations, 2) favo
337337

338338
[Browse source](https://github.com/unoplatform/Uno.Samples/tree/master/UI/UnoBackgroundWorker)
339339

340+
### Uno Cakes Mobile
341+
A port of Shaw Yu's Cakes Mobile App from [XampleUI](https://github.com/shawyunz/XampleUI) to Uno Platform.
342+
Used to demonstrate simple page navigation from View and ViewModel.
343+
344+
[Browse source](https://github.com/unoplatform/Uno.Samples/tree/master/UI/UnoCakesMobile)
345+
340346
### Uno Contoso
341347
A port of Microsoft's Contoso Enterprise UWP app to Uno Platform, using Prism.
342348

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ImplicitUsings>enable</ImplicitUsings>
4+
<Nullable>enable</Nullable>
5+
6+
<DebugType>portable</DebugType>
7+
<DebugSymbols>True</DebugSymbols>
8+
9+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
10+
11+
<NoWarn>$(NoWarn);CA1416;NU1507</NoWarn>
12+
13+
<DefaultLanguage>en</DefaultLanguage>
14+
15+
<IsAndroid>false</IsAndroid>
16+
<IsIOS>false</IsIOS>
17+
<IsMac>false</IsMac>
18+
<IsMacCatalyst>false</IsMacCatalyst>
19+
<IsWinAppSdk>false</IsWinAppSdk>
20+
</PropertyGroup>
21+
22+
<Choose>
23+
<When Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
24+
<PropertyGroup>
25+
<IsAndroid>true</IsAndroid>
26+
<SupportedOSPlatformVersion>21.0</SupportedOSPlatformVersion>
27+
</PropertyGroup>
28+
</When>
29+
<When Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
30+
<PropertyGroup>
31+
<IsIOS>true</IsIOS>
32+
<SupportedOSPlatformVersion>14.2</SupportedOSPlatformVersion>
33+
</PropertyGroup>
34+
</When>
35+
<When Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'macos'">
36+
<PropertyGroup>
37+
<IsMac>true</IsMac>
38+
<SupportedOSPlatformVersion>10.14</SupportedOSPlatformVersion>
39+
</PropertyGroup>
40+
</When>
41+
<When Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
42+
<PropertyGroup>
43+
<IsMacCatalyst>true</IsMacCatalyst>
44+
<SupportedOSPlatformVersion>14.0</SupportedOSPlatformVersion>
45+
</PropertyGroup>
46+
</When>
47+
<When Condition="$(TargetFramework.Contains('windows10'))">
48+
<PropertyGroup>
49+
<IsWinAppSdk>true</IsWinAppSdk>
50+
<SupportedOSPlatformVersion>10.0.18362.0</SupportedOSPlatformVersion>
51+
<TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion>
52+
</PropertyGroup>
53+
</When>
54+
</Choose>
55+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<ItemGroup>
3+
<!-- Removes native usings to avoid Ambiguous reference -->
4+
<Using Remove="@(Using->HasMetadata('Platform'))" />
5+
</ItemGroup>
6+
</Project>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<Project ToolsVersion="15.0">
2+
<ItemGroup>
3+
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.2" />
4+
<PackageVersion Include="InTheHand.DependencyInjection" Version="1.0.0" />
5+
<PackageVersion Include="SkiaSharp.Skottie" Version="2.88.6" />
6+
<PackageVersion Include="SkiaSharp.Views.Uno.WinUI" Version="2.88.6" />
7+
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
8+
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="7.0.5" />
9+
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" />
10+
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.4.231008000" />
11+
<PackageVersion Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.1" />
12+
<PackageVersion Include="Uno.Extensions.Logging.OSLog" Version="1.7.0" />
13+
<PackageVersion Include="Uno.Extensions.Logging.WebAssembly.Console" Version="1.7.0" />
14+
<PackageVersion Include="Uno.Resizetizer" Version="1.2.0" />
15+
<PackageVersion Include="Uno.Toolkit.WinUI" Version="5.0.17" />
16+
<PackageVersion Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="5.0.19" />
17+
<PackageVersion Include="Uno.UniversalImageLoader" Version="1.9.36" />
18+
<PackageVersion Include="Uno.Wasm.Bootstrap" Version="8.0.0" />
19+
<PackageVersion Include="Uno.Wasm.Bootstrap.DevServer" Version="8.0.0" />
20+
<PackageVersion Include="Uno.Wasm.Bootstrap.Server" Version="7.0.27" />
21+
<PackageVersion Include="Uno.WinUI" Version="5.0.19" />
22+
<PackageVersion Include="Uno.WinUI.Skia.Gtk" Version="5.0.19" />
23+
<PackageVersion Include="Uno.WinUI.DevServer" Version="5.0.19" />
24+
<PackageVersion Include="Uno.WinUI.DevServer" Version="5.0.19" />
25+
<PackageVersion Include="Uno.WinUI.WebAssembly" Version="5.0.19" />
26+
<PackageVersion Include="Xamarin.Google.Android.Material" Version="1.10.0.1" />
27+
</ItemGroup>
28+
</Project>

UI/UnoCakesMobile/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# UnoCakesMobile
2+
3+
An Uno port of the Xamarin Cakes Mobile App sample from this repository
4+
https://github.com/shawyunz/XampleUI
5+
6+
Demonstrates various features of page navigation from View or View Model.
7+
It tries to maintain true to the look and feel but some layout changes were necessary for it to appear correctly on landscape orientation devices and larger screens.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<local:App x:Class="UnoCakesMobile.AppHead"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:wasm="http://platform.uno/wasm"
5+
xmlns:local="using:UnoCakesMobile"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
mc:Ignorable="wasm">
8+
9+
<local:App.Resources>
10+
<ResourceDictionary>
11+
<ResourceDictionary.MergedDictionaries>
12+
<ResourceDictionary Source="ms-appx:///UnoCakesMobile/AppResources.xaml" />
13+
</ResourceDictionary.MergedDictionaries>
14+
</ResourceDictionary>
15+
</local:App.Resources>
16+
17+
</local:App>
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
using Microsoft.Extensions.Logging;
2+
using Microsoft.UI.Xaml;
3+
using System;
4+
using Uno.Resizetizer;
5+
6+
namespace UnoCakesMobile
7+
{
8+
public sealed partial class AppHead : App
9+
{
10+
static AppHead() =>
11+
InitializeLogging();
12+
13+
/// <summary>
14+
/// Initializes the singleton application object. This is the first line of authored code
15+
/// executed, and as such is the logical equivalent of main() or WinMain().
16+
/// </summary>
17+
public AppHead()
18+
{
19+
this.InitializeComponent();
20+
}
21+
22+
/// <summary>
23+
/// Invoked when the application is launched normally by the end user. Other entry points
24+
/// will be used such as when the application is launched to open a specific file.
25+
/// </summary>
26+
/// <param name="args">Details about the launch request and process.</param>
27+
protected override void OnLaunched(LaunchActivatedEventArgs args)
28+
{
29+
base.OnLaunched(args);
30+
31+
MainWindow.SetWindowIcon();
32+
}
33+
34+
/// <summary>
35+
/// Configures global Uno Platform logging
36+
/// </summary>
37+
private static void InitializeLogging()
38+
{
39+
#if DEBUG
40+
// Logging is disabled by default for release builds, as it incurs a significant
41+
// initialization cost from Microsoft.Extensions.Logging setup. If startup performance
42+
// is a concern for your application, keep this disabled. If you're running on the web or
43+
// desktop targets, you can use URL or command line parameters to enable it.
44+
//
45+
// For more performance documentation: https://platform.uno/docs/articles/Uno-UI-Performance.html
46+
47+
var factory = LoggerFactory.Create(builder =>
48+
{
49+
#if __WASM__
50+
builder.AddProvider(new global::Uno.Extensions.Logging.WebAssembly.WebAssemblyConsoleLoggerProvider());
51+
#elif __IOS__ || __MACCATALYST__
52+
builder.AddProvider(new global::Uno.Extensions.Logging.OSLogLoggerProvider());
53+
#elif NETFX_CORE
54+
builder.AddDebug();
55+
#else
56+
builder.AddConsole();
57+
#endif
58+
59+
// Exclude logs below this level
60+
builder.SetMinimumLevel(LogLevel.Information);
61+
62+
// Default filters for Uno Platform namespaces
63+
builder.AddFilter("Uno", LogLevel.Warning);
64+
builder.AddFilter("Windows", LogLevel.Warning);
65+
builder.AddFilter("Microsoft", LogLevel.Warning);
66+
67+
// Generic Xaml events
68+
// builder.AddFilter("Microsoft.UI.Xaml", LogLevel.Debug );
69+
// builder.AddFilter("Microsoft.UI.Xaml.VisualStateGroup", LogLevel.Debug );
70+
// builder.AddFilter("Microsoft.UI.Xaml.StateTriggerBase", LogLevel.Debug );
71+
// builder.AddFilter("Microsoft.UI.Xaml.UIElement", LogLevel.Debug );
72+
// builder.AddFilter("Microsoft.UI.Xaml.FrameworkElement", LogLevel.Trace );
73+
74+
// Layouter specific messages
75+
// builder.AddFilter("Microsoft.UI.Xaml.Controls", LogLevel.Debug );
76+
// builder.AddFilter("Microsoft.UI.Xaml.Controls.Layouter", LogLevel.Debug );
77+
// builder.AddFilter("Microsoft.UI.Xaml.Controls.Panel", LogLevel.Debug );
78+
79+
// builder.AddFilter("Windows.Storage", LogLevel.Debug );
80+
81+
// Binding related messages
82+
// builder.AddFilter("Microsoft.UI.Xaml.Data", LogLevel.Debug );
83+
// builder.AddFilter("Microsoft.UI.Xaml.Data", LogLevel.Debug );
84+
85+
// Binder memory references tracking
86+
// builder.AddFilter("Uno.UI.DataBinding.BinderReferenceHolder", LogLevel.Debug );
87+
88+
// RemoteControl and HotReload related
89+
// builder.AddFilter("Uno.UI.RemoteControl", LogLevel.Information);
90+
91+
// Debug JS interop
92+
// builder.AddFilter("Uno.Foundation.WebAssemblyRuntime", LogLevel.Debug );
93+
});
94+
95+
global::Uno.Extensions.LogExtensionPoint.AmbientLoggerFactory = factory;
96+
97+
#if HAS_UNO
98+
global::Uno.UI.Adapter.Microsoft.Extensions.Logging.LoggingAdapter.Initialize();
99+
#endif
100+
#endif
101+
}
102+
}
103+
}
Lines changed: 137 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)