diff --git a/global.json b/global.json index c072b63..43663cb 100644 --- a/global.json +++ b/global.json @@ -2,6 +2,6 @@ "sdk": { "allowPrerelease": true, "rollForward": "latestMinor", - "version": "7.0.100" + "version": "8.0.100" } } diff --git a/src/NET_8/global.json b/src/NET_8/global.json index 14efa8b..43663cb 100644 --- a/src/NET_8/global.json +++ b/src/NET_8/global.json @@ -1,5 +1,6 @@ { "sdk": { + "allowPrerelease": true, "rollForward": "latestMinor", "version": "8.0.100" } diff --git a/src/NET_9/EmbeddedWindows/EmbeddedWindows/App.xaml.cs b/src/NET_9/EmbeddedWindows/EmbeddedWindows/App.xaml.cs index d5d04f2..5fb083e 100644 --- a/src/NET_9/EmbeddedWindows/EmbeddedWindows/App.xaml.cs +++ b/src/NET_9/EmbeddedWindows/EmbeddedWindows/App.xaml.cs @@ -1,30 +1,26 @@ -namespace EmbeddedWindows +namespace EmbeddedWindows; + +/// +/// Provides application-specific behavior to supplement the default Application class. +/// +public partial class App : Application { + private Window? m_window; + /// - /// Provides application-specific behavior to supplement the default Application class. + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). /// - public partial class App : Application - { - /// - /// Initializes the singleton application object. This is the first line of authored code - /// executed, and as such is the logical equivalent of main() or WinMain(). - /// - public App() - { - this.InitializeComponent(); - } + public App() => this.InitializeComponent(); - /// - /// Invoked when the application is launched normally by the end user. Other entry points - /// will be used such as when the application is launched to open a specific file. - /// - /// Details about the launch request and process. - protected override void OnLaunched(LaunchActivatedEventArgs args) - { - m_window = new MainWindow(); - m_window?.Activate(); - } - - private Window? m_window; + /// + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used such as when the application is launched to open a specific file. + /// + /// Details about the launch request and process. + protected override void OnLaunched(LaunchActivatedEventArgs args) + { + m_window = new MainWindow(); + m_window?.Activate(); } } diff --git a/src/NET_9/EmbeddedWindows/EmbeddedWindows/EmbeddedWindows.csproj b/src/NET_9/EmbeddedWindows/EmbeddedWindows/EmbeddedWindows.csproj index 01fa3dc..3002ca5 100644 --- a/src/NET_9/EmbeddedWindows/EmbeddedWindows/EmbeddedWindows.csproj +++ b/src/NET_9/EmbeddedWindows/EmbeddedWindows/EmbeddedWindows.csproj @@ -10,6 +10,10 @@ true None + + true + true + enable @@ -20,8 +24,9 @@ true x86;x64;arm64 app.manifest - win10-$(Platform).pubxml - win10-x86;win10-x64;win10-arm64 + win-$(Platform).pubxml + win-x86;win-x64;win-arm64 + win10-x86;win10-x64;win10-arm64 @@ -37,10 +42,9 @@ - - + - + diff --git a/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win10-arm64.pubxml b/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win-arm64.pubxml similarity index 58% rename from src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win10-arm64.pubxml rename to src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win-arm64.pubxml index 6de21bb..3d93189 100644 --- a/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win10-arm64.pubxml +++ b/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win-arm64.pubxml @@ -5,16 +5,15 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - arm64 - win10-arm64 + ARM64 + win-arm64 + win10-arm64 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true False False True - + False + True \ No newline at end of file diff --git a/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win10-x64.pubxml b/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win-x64.pubxml similarity index 61% rename from src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win10-x64.pubxml rename to src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win-x64.pubxml index ed11b9d..eea93de 100644 --- a/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win10-x64.pubxml +++ b/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win-x64.pubxml @@ -6,15 +6,14 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem x64 - win10-x64 + win-x64 + win10-x64 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true False False True - + False + True \ No newline at end of file diff --git a/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win10-x86.pubxml b/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win-x86.pubxml similarity index 61% rename from src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win10-x86.pubxml rename to src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win-x86.pubxml index e908edd..7c8835b 100644 --- a/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win10-x86.pubxml +++ b/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win-x86.pubxml @@ -6,15 +6,14 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem x86 - win10-x86 + win-x86 + win10-x86 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true False False True - + False + True \ No newline at end of file diff --git a/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/launchSettings.json b/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/launchSettings.json index 17e88f8..280254d 100644 --- a/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/launchSettings.json +++ b/src/NET_9/EmbeddedWindows/EmbeddedWindows/Properties/launchSettings.json @@ -1,9 +1,6 @@ { "profiles": { - "EmbeddedWindows (Package)": { - "commandName": "MsixPackage" - }, - "EmbeddedWindows (Unpackaged)": { + "Windows Machine": { "commandName": "Project" } } diff --git a/src/NET_9/EmbeddedWindows/EmbeddedWindows/Views/MainWindow.xaml.cs b/src/NET_9/EmbeddedWindows/EmbeddedWindows/Views/MainWindow.xaml.cs index 428c1e5..6dbb536 100644 --- a/src/NET_9/EmbeddedWindows/EmbeddedWindows/Views/MainWindow.xaml.cs +++ b/src/NET_9/EmbeddedWindows/EmbeddedWindows/Views/MainWindow.xaml.cs @@ -1,31 +1,41 @@ using Microsoft.Maui.Hosting; using Microsoft.Maui.Platform; using Microsoft.Maui; -using Microsoft.Maui.Embedding; -using Microsoft.Extensions.DependencyInjection; +// Note: There's a change in namespace. +using Microsoft.Maui.Controls.Embedding; +//using Microsoft.Maui.Embedding; -namespace EmbeddedWindows +namespace EmbeddedWindows; + +/// +/// An empty window that can be used on its own or navigated to within a Frame. +/// +public sealed partial class MainWindow : Window { - /// - /// An empty window that can be used on its own or navigated to within a Frame. - /// - public sealed partial class MainWindow : Window + public MainWindow() { - public MainWindow() - { - this.InitializeComponent(); + this.InitializeComponent(); + + var mauiApp = MauiApp.CreateBuilder() + .UseMauiEmbeddedApp() // Note: The method name too got updated. + .ConfigureFonts(fonts => + { + fonts.AddFont("OpenSans-Regular.ttf", "OS400"); + fonts.AddFont("OpenSans-SemiBold.ttf", "OS600"); + }) + .Build(); + + // From .NET MAUI 9 Preview 7 onwards, the below method call is no longer required + // as the .NET MAUI Embedding process is revamped. + // While doing .NET MAUI Embedding, this call is required so that + // the Application object instance gets resolved. + //var _ = mauiApp.Services.GetRequiredService(); + + var mauiContext = new MauiContext(mauiApp.Services); - var mauiApp = MauiApp.CreateBuilder() - .UseMauiEmbedding() - .ConfigureFonts(fonts => - { - fonts.AddFont("OpenSans-Regular.ttf", "OS400"); - fonts.AddFont("OpenSans-SemiBold.ttf", "OS600"); - }) - .Build(); - // While doing .NET MAUI Embedding, this call is required so that the Application object instance gets resolved. - var _ = mauiApp.Services.GetRequiredService(); - Content = new MauiPage().ToPlatform(new MauiContext(mauiApp.Services)); - } + // Platform-neutral - Windowless API + Content = new MauiPage().ToPlatform(mauiContext); + // Updated Window inclusive API + Content = new MauiPage().ToPlatformEmbedded(mauiContext); } } diff --git a/src/NET_9/EmbeddedWindows/MauiLib/MauiLib.csproj b/src/NET_9/EmbeddedWindows/MauiLib/MauiLib.csproj index 6124a4d..c00fb24 100644 --- a/src/NET_9/EmbeddedWindows/MauiLib/MauiLib.csproj +++ b/src/NET_9/EmbeddedWindows/MauiLib/MauiLib.csproj @@ -26,7 +26,6 @@ - diff --git a/src/NET_9/EmbeddedWindows/MauiLib/MauiPage.xaml b/src/NET_9/EmbeddedWindows/MauiLib/MauiPage.xaml index a0261ed..83de9b0 100644 --- a/src/NET_9/EmbeddedWindows/MauiLib/MauiPage.xaml +++ b/src/NET_9/EmbeddedWindows/MauiLib/MauiPage.xaml @@ -11,7 +11,7 @@ diff --git a/src/NET_9/EmbeddedWindows/MauiLib/MauiPage.xaml.cs b/src/NET_9/EmbeddedWindows/MauiLib/MauiPage.xaml.cs index f58020b..2016c65 100644 --- a/src/NET_9/EmbeddedWindows/MauiLib/MauiPage.xaml.cs +++ b/src/NET_9/EmbeddedWindows/MauiLib/MauiPage.xaml.cs @@ -1,10 +1,6 @@ -namespace MauiLib +namespace MauiLib; + +public partial class MauiPage : ContentPage { - public partial class MauiPage : ContentPage - { - public MauiPage() - { - InitializeComponent(); - } - } + public MauiPage() => InitializeComponent(); } diff --git a/src/NET_9/EmbeddedWindows/MauiLib/MyApp.xaml.cs b/src/NET_9/EmbeddedWindows/MauiLib/MyApp.xaml.cs index 56f420b..0ac85db 100644 --- a/src/NET_9/EmbeddedWindows/MauiLib/MyApp.xaml.cs +++ b/src/NET_9/EmbeddedWindows/MauiLib/MyApp.xaml.cs @@ -1,10 +1,6 @@ -namespace MauiLib +namespace MauiLib; + +public partial class MyApp : Application { - public partial class MyApp : Application - { - public MyApp() - { - InitializeComponent(); - } - } + public MyApp() => InitializeComponent(); }