From 38f9092f4a87aa0b14468b303bc2ced1567c2ec7 Mon Sep 17 00:00:00 2001 From: Nick Randolph Date: Thu, 27 Jul 2023 21:13:52 +1000 Subject: [PATCH 1/3] fix: Adding net7.0 support for maui package --- .../MauiEmbedding/Directory.Packages.props | 48 ++++++------ .../MauiEmbedding.Skia.Gtk.csproj | 25 ++++++ .../Package.appxmanifest | 43 +++++++++++ .../MauiEmbedding.Skia.Gtk/Program.cs | 21 +++++ .../MauiEmbedding.Skia.Gtk/app.manifest | 77 +++++++++++++++++++ samples/MauiEmbedding/MauiEmbedding.sln | 32 ++++++++ samples/MauiEmbedding/MauiEmbedding/App.cs | 28 ++++--- .../MauiEmbedding/MauiEmbedding.csproj | 17 +++- .../MauiEmbedding/Presentation/MainPage.xaml | 15 ++-- .../Presentation/MainViewModel.cs | 35 --------- .../Presentation/{ => Maui}/EsriMapsPage.xaml | 0 .../{ => Maui}/EsriMapsPage.xaml.cs | 0 .../{ => Maui}/EsriMapsViewModel.cs | 0 .../{ => Maui}/ExternalLibPage.xaml | 0 .../{ => Maui}/ExternalLibPage.xaml.cs | 0 .../{ => Maui}/ExternalLibViewModel.cs | 0 .../{ => Maui}/MCTControlsPage.xaml | 0 .../{ => Maui}/MCTControlsPage.xaml.cs | 0 .../{ => Maui}/MCTControlsViewModel.cs | 0 .../{ => Maui}/MauiColorsPage.xaml | 0 .../{ => Maui}/MauiColorsPage.xaml.cs | 0 .../{ => Maui}/MauiColorsViewModel.cs | 0 .../{ => Maui}/MauiControlsPage.xaml | 0 .../{ => Maui}/MauiControlsPage.xaml.cs | 0 .../{ => Maui}/MauiControlsViewModel.cs | 0 .../{ => Maui}/MauiEssentialsPage.xaml | 0 .../{ => Maui}/MauiEssentialsPage.xaml.cs | 0 .../{ => Maui}/MauiEssentialsViewModel.cs | 0 .../{ => Maui}/TelerikControlsPage.xaml | 0 .../{ => Maui}/TelerikControlsPage.xaml.cs | 0 .../{ => Maui}/TelerikControlsViewModel.cs | 0 src/Uno.Extensions.Maui.UI/GlobalUsings.cs | 13 ++-- src/Uno.Extensions.Maui.UI/MauiBinding.cs | 2 + src/Uno.Extensions.Maui.UI/MauiColor.cs | 2 + src/Uno.Extensions.Maui.UI/MauiEmbedding.cs | 7 +- .../MauiExtensionBase.cs | 4 + src/Uno.Extensions.Maui.UI/MauiHost.cs | 16 +++- src/Uno.Extensions.Maui.UI/MauiResource.cs | 2 + src/Uno.Extensions.Maui.UI/MauiThickness.cs | 3 + .../Uno.Extensions.Maui.WinUI.csproj | 22 +++++- .../build/Package.props | 5 ++ .../build/Package.targets | 2 +- src/tfms-ui-maui.props | 1 + 43 files changed, 331 insertions(+), 89 deletions(-) create mode 100644 samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/MauiEmbedding.Skia.Gtk.csproj create mode 100644 samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/Package.appxmanifest create mode 100644 samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/Program.cs create mode 100644 samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/app.manifest rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/EsriMapsPage.xaml (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/EsriMapsPage.xaml.cs (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/EsriMapsViewModel.cs (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/ExternalLibPage.xaml (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/ExternalLibPage.xaml.cs (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/ExternalLibViewModel.cs (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/MCTControlsPage.xaml (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/MCTControlsPage.xaml.cs (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/MCTControlsViewModel.cs (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/MauiColorsPage.xaml (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/MauiColorsPage.xaml.cs (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/MauiColorsViewModel.cs (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/MauiControlsPage.xaml (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/MauiControlsPage.xaml.cs (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/MauiControlsViewModel.cs (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/MauiEssentialsPage.xaml (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/MauiEssentialsPage.xaml.cs (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/MauiEssentialsViewModel.cs (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/TelerikControlsPage.xaml (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/TelerikControlsPage.xaml.cs (100%) rename samples/MauiEmbedding/MauiEmbedding/Presentation/{ => Maui}/TelerikControlsViewModel.cs (100%) diff --git a/samples/MauiEmbedding/Directory.Packages.props b/samples/MauiEmbedding/Directory.Packages.props index 8a4a39df79..c53a1d5732 100644 --- a/samples/MauiEmbedding/Directory.Packages.props +++ b/samples/MauiEmbedding/Directory.Packages.props @@ -1,25 +1,27 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/MauiEmbedding.Skia.Gtk.csproj b/samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/MauiEmbedding.Skia.Gtk.csproj new file mode 100644 index 0000000000..76ef634c11 --- /dev/null +++ b/samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/MauiEmbedding.Skia.Gtk.csproj @@ -0,0 +1,25 @@ + + + WinExe + Exe + net7.0 + app.manifest + + + + + + + + + + + + + + + + + + + diff --git a/samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/Package.appxmanifest b/samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/Package.appxmanifest new file mode 100644 index 0000000000..d4ac5a40e7 --- /dev/null +++ b/samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/Package.appxmanifest @@ -0,0 +1,43 @@ + + + + + + + + MauiEmbedding + MauiEmbedding + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/Program.cs b/samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/Program.cs new file mode 100644 index 0000000000..03392a6b0c --- /dev/null +++ b/samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/Program.cs @@ -0,0 +1,21 @@ +using System; +using GLib; +using Uno.UI.Runtime.Skia; + +namespace MauiEmbedding.Skia.Gtk; + +public class Program +{ + public static void Main(string[] args) + { + ExceptionManager.UnhandledException += delegate (UnhandledExceptionArgs expArgs) + { + Console.WriteLine("GLIB UNHANDLED EXCEPTION" + expArgs.ExceptionObject.ToString()); + expArgs.ExitApplication = true; + }; + + var host = new GtkHost(() => new AppHead()); + + host.Run(); + } +} diff --git a/samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/app.manifest b/samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/app.manifest new file mode 100644 index 0000000000..e56ae778d0 --- /dev/null +++ b/samples/MauiEmbedding/MauiEmbedding.Skia.Gtk/app.manifest @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true/PM + PerMonitorV2, PerMonitor + + + + + + + + diff --git a/samples/MauiEmbedding/MauiEmbedding.sln b/samples/MauiEmbedding/MauiEmbedding.sln index daf5cad880..4cf09d3167 100644 --- a/samples/MauiEmbedding/MauiEmbedding.sln +++ b/samples/MauiEmbedding/MauiEmbedding.sln @@ -73,6 +73,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions Items", "Extensi ..\..\src\Directory.Build.props = ..\..\src\Directory.Build.props ..\..\src\Directory.Build.targets = ..\..\src\Directory.Build.targets ..\..\src\Directory.Packages.props = ..\..\src\Directory.Packages.props + ..\..\src\tfms-ui-maui.props = ..\..\src\tfms-ui-maui.props EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MauiProjects", "MauiProjects", "{24511BF4-9869-4773-AF84-CC8F79AF5085}" @@ -81,6 +82,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiControlsExternal", "Mau EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiApp1", "MauiProjects\MauiApp1\MauiApp1.csproj", "{8577882E-DA52-4D27-A529-C70998034566}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiEmbedding.Skia.Gtk", "MauiEmbedding.Skia.Gtk\MauiEmbedding.Skia.Gtk.csproj", "{00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -875,6 +878,34 @@ Global {8577882E-DA52-4D27-A529-C70998034566}.Release|x64.Build.0 = Release|Any CPU {8577882E-DA52-4D27-A529-C70998034566}.Release|x86.ActiveCfg = Release|Any CPU {8577882E-DA52-4D27-A529-C70998034566}.Release|x86.Build.0 = Release|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Debug|ARM.ActiveCfg = Debug|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Debug|ARM.Build.0 = Debug|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Debug|ARM64.Build.0 = Debug|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Debug|iPhone.Build.0 = Debug|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Debug|x64.ActiveCfg = Debug|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Debug|x64.Build.0 = Debug|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Debug|x86.ActiveCfg = Debug|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Debug|x86.Build.0 = Debug|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Release|Any CPU.Build.0 = Release|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Release|ARM.ActiveCfg = Release|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Release|ARM.Build.0 = Release|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Release|ARM64.ActiveCfg = Release|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Release|ARM64.Build.0 = Release|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Release|iPhone.ActiveCfg = Release|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Release|iPhone.Build.0 = Release|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Release|x64.ActiveCfg = Release|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Release|x64.Build.0 = Release|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Release|x86.ActiveCfg = Release|Any CPU + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -909,6 +940,7 @@ Global {9F4A5914-3D10-4CDE-829C-BE53A9E441DB} = {9B9F35D5-E6DD-4FC7-9198-F8246D3CE366} {A158CC84-0219-4BE4-A3F2-7AB7F613855A} = {24511BF4-9869-4773-AF84-CC8F79AF5085} {8577882E-DA52-4D27-A529-C70998034566} = {24511BF4-9869-4773-AF84-CC8F79AF5085} + {00BAAAC1-9BA0-4F35-B7B6-5B4D64E45FAB} = {1C130CF4-EEF4-44D9-9DEF-C037FE1C221B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {584E156C-C094-4968-8A1F-3FB06081E34D} diff --git a/samples/MauiEmbedding/MauiEmbedding/App.cs b/samples/MauiEmbedding/MauiEmbedding/App.cs index 4e25e234cc..477263d2cb 100644 --- a/samples/MauiEmbedding/MauiEmbedding/App.cs +++ b/samples/MauiEmbedding/MauiEmbedding/App.cs @@ -1,3 +1,4 @@ +#if MAUI_EMBEDDING using CommunityToolkit.Maui; using Microsoft.Maui; //using Telerik.Maui.Controls; @@ -5,6 +6,7 @@ using MControls = Microsoft.Maui.Controls; using MauiControlsExternal; using Esri.ArcGISRuntime.Maui; +#endif namespace MauiEmbedding; @@ -16,6 +18,7 @@ public class App : Application protected async override void OnLaunched(LaunchActivatedEventArgs args) { var builder = this.CreateBuilder(args) +#if MAUI_EMBEDDING .UseMauiEmbedding(maui => { @@ -35,6 +38,7 @@ protected async override void OnLaunched(LaunchActivatedEventArgs args) } }); }) +#endif // Add navigation support for toolkit controls such as TabBar and NavigationView .UseToolkitNavigation() .Configure(host => host @@ -98,14 +102,16 @@ private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes) { views.Register( new ViewMap(ViewModel: typeof(ShellViewModel)), - new ViewMap(), - new ViewMap(), + new ViewMap() +#if MAUI_EMBEDDING + ,new ViewMap(), new ViewMap(), - //new ViewMap(), + new ViewMap(), new ViewMap(), new ViewMap(), new ViewMap(), new ViewMap() +#endif ); routes.Register( @@ -113,13 +119,15 @@ private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes) Nested: new RouteMap[] { new RouteMap("Main", View: views.FindByViewModel()), - new RouteMap(nameof(MauiControlsViewModel), View: views.FindByViewModel()), - new RouteMap(nameof(MCTControlsViewModel), View: views.FindByViewModel()), - new RouteMap(nameof(MauiEssentialsViewModel), View: views.FindByViewModel()), - new RouteMap(nameof(MauiColorsViewModel), View: views.FindByViewModel()), - new RouteMap(nameof(EsriMapsViewModel), View: views.FindByViewModel()), - new RouteMap(nameof(ExternalLibPage), View: views.FindByViewModel()), - //new RouteMap(nameof(TelerikControlsViewModel), View: views.FindByViewModel()), +#if MAUI_EMBEDDING + new RouteMap("MauiControls", View: views.FindByViewModel()), + new RouteMap("MCTControls", View: views.FindByViewModel()), + new RouteMap("MauiEssentials", View: views.FindByViewModel()), + new RouteMap("MauiColors", View: views.FindByViewModel()), + new RouteMap("EsriMaps", View: views.FindByViewModel()), + new RouteMap("ExternalLib", View: views.FindByViewModel()), + new RouteMap("TelerikControls", View: views.FindByViewModel()), +#endif } ) ); diff --git a/samples/MauiEmbedding/MauiEmbedding/MauiEmbedding.csproj b/samples/MauiEmbedding/MauiEmbedding/MauiEmbedding.csproj index be5ace9d76..e4bab0ed0c 100644 --- a/samples/MauiEmbedding/MauiEmbedding/MauiEmbedding.csproj +++ b/samples/MauiEmbedding/MauiEmbedding/MauiEmbedding.csproj @@ -4,14 +4,14 @@ $(TargetFrameworks);net7.0-windows10.0.19041 - $(TargetFrameworks);net7.0-ios;net7.0-android;net7.0-maccatalyst + $(TargetFrameworks);net7.0;net7.0-ios;net7.0-android;net7.0-maccatalyst true + false - @@ -20,6 +20,9 @@ + + + @@ -56,6 +59,11 @@ + + + + + @@ -83,6 +91,11 @@ + + + + + diff --git a/samples/MauiEmbedding/MauiEmbedding/Presentation/MainPage.xaml b/samples/MauiEmbedding/MauiEmbedding/Presentation/MainPage.xaml index e29f9bdc96..3b91a33d71 100644 --- a/samples/MauiEmbedding/MauiEmbedding/Presentation/MainPage.xaml +++ b/samples/MauiEmbedding/MauiEmbedding/Presentation/MainPage.xaml @@ -4,6 +4,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:uen="using:Uno.Extensions.Navigation.UI" NavigationCacheMode="Required" mc:Ignorable="d"> @@ -11,13 +12,13 @@ HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="10"> -