From 45bba53a60c075de507a20f1819a403df9fa74a2 Mon Sep 17 00:00:00 2001 From: Ieuan Walker Date: Tue, 19 Nov 2024 18:56:38 +0000 Subject: [PATCH] .NET 9 (#17) --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- Demo/App.csproj | 9 +- Demo/App.xaml.cs | 4 +- Demo/Pages/BasePage.xaml.cs | 4 +- Demo/Platforms/Android/AndroidManifest.xml | 4 +- Demo/Platforms/Android/MainActivity.cs | 1 - Demo/Platforms/iOS/AppDelegate.cs | 1 - Demo/Resources/AppIcon/appicon.svg | 4 +- Demo/Resources/AppIcon/appiconfg.svg | 10 +- Demo/Resources/Images/dotnet_bot.svg | 184 ++++++++++----------- Demo/Resources/Splash/splash.svg | 10 +- Demo/ViewModels/TestViewModel.cs | 35 ---- Scr/Breadcrumb.csproj | 11 +- Scr/Breadcrumb.xaml | 2 + Scr/Breadcrumb.xaml.cs | 5 +- 16 files changed, 127 insertions(+), 161 deletions(-) delete mode 100644 Demo/ViewModels/TestViewModel.cs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cfa3ab4..63e0b69 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: schedule: - cron: '0 0 1 */3 *' # Every 3 months env: - NET_VERSION: 8.0.204 + NET_VERSION: 9.*.* PROJECT_PATH: 'Scr/Breadcrumb.csproj' NUGET_PATH: './**/IeuanWalker.Maui.Breadcrumb.1.0.0.nupkg' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a18e2f7..1d45564 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: types: [published] env: - NET_VERSION: 8.0.204 + NET_VERSION: 9.*.* PROJECT_PATH: 'Scr/Breadcrumb.csproj' NUGET_PATH: './**/IeuanWalker.Maui.Breadcrumb.${{ github.event.release.tag_name }}.nupkg' diff --git a/Demo/App.csproj b/Demo/App.csproj index 6475fca..de27834 100644 --- a/Demo/App.csproj +++ b/Demo/App.csproj @@ -1,6 +1,6 @@  - net8.0-android;net8.0-ios; + net9.0-android;net9.0-ios; Exe App true @@ -17,6 +17,8 @@ 1 14.2 21.0 + + true @@ -32,9 +34,8 @@ - - - + + diff --git a/Demo/App.xaml.cs b/Demo/App.xaml.cs index 0182018..9cfc555 100644 --- a/Demo/App.xaml.cs +++ b/Demo/App.xaml.cs @@ -7,7 +7,7 @@ public partial class App : Application public App() { InitializeComponent(); - - MainPage = new NavigationPage(new TestPage1()); } + + protected override Window CreateWindow(IActivationState? activationState) => new(new NavigationPage(new TestPage1())); } \ No newline at end of file diff --git a/Demo/Pages/BasePage.xaml.cs b/Demo/Pages/BasePage.xaml.cs index 4bf72d0..c4c55e1 100644 --- a/Demo/Pages/BasePage.xaml.cs +++ b/Demo/Pages/BasePage.xaml.cs @@ -32,12 +32,12 @@ void ThemeToggle_Clicked(object? sender, EventArgs e) { ToolbarItem? item = (ToolbarItem?)sender; - if (item is null || Application.Current is null) + if(item is null || Application.Current is null) { return; } - switch (item.Text) + switch(item.Text) { case nameof(Theme.Light): Application.Current.Resources = new DarkTheme(); diff --git a/Demo/Platforms/Android/AndroidManifest.xml b/Demo/Platforms/Android/AndroidManifest.xml index e9937ad..bdeb5f8 100644 --- a/Demo/Platforms/Android/AndroidManifest.xml +++ b/Demo/Platforms/Android/AndroidManifest.xml @@ -1,6 +1,6 @@  - - + + \ No newline at end of file diff --git a/Demo/Platforms/Android/MainActivity.cs b/Demo/Platforms/Android/MainActivity.cs index c6ff6e4..5e48da2 100644 --- a/Demo/Platforms/Android/MainActivity.cs +++ b/Demo/Platforms/Android/MainActivity.cs @@ -1,6 +1,5 @@ using Android.App; using Android.Content.PM; -using Microsoft.Maui; namespace App; diff --git a/Demo/Platforms/iOS/AppDelegate.cs b/Demo/Platforms/iOS/AppDelegate.cs index c68523c..1510449 100644 --- a/Demo/Platforms/iOS/AppDelegate.cs +++ b/Demo/Platforms/iOS/AppDelegate.cs @@ -1,5 +1,4 @@ using Foundation; -using Microsoft.Maui; namespace App; diff --git a/Demo/Resources/AppIcon/appicon.svg b/Demo/Resources/AppIcon/appicon.svg index 9d63b65..3a4c176 100644 --- a/Demo/Resources/AppIcon/appicon.svg +++ b/Demo/Resources/AppIcon/appicon.svg @@ -1,4 +1,4 @@ - + - + \ No newline at end of file diff --git a/Demo/Resources/AppIcon/appiconfg.svg b/Demo/Resources/AppIcon/appiconfg.svg index 21dfb25..b27682e 100644 --- a/Demo/Resources/AppIcon/appiconfg.svg +++ b/Demo/Resources/AppIcon/appiconfg.svg @@ -1,8 +1,8 @@ - + - - - - + + + + \ No newline at end of file diff --git a/Demo/Resources/Images/dotnet_bot.svg b/Demo/Resources/Images/dotnet_bot.svg index abfaff2..dffd9b7 100644 --- a/Demo/Resources/Images/dotnet_bot.svg +++ b/Demo/Resources/Images/dotnet_bot.svg @@ -1,93 +1,93 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Demo/Resources/Splash/splash.svg b/Demo/Resources/Splash/splash.svg index 21dfb25..b27682e 100644 --- a/Demo/Resources/Splash/splash.svg +++ b/Demo/Resources/Splash/splash.svg @@ -1,8 +1,8 @@ - + - - - - + + + + \ No newline at end of file diff --git a/Demo/ViewModels/TestViewModel.cs b/Demo/ViewModels/TestViewModel.cs deleted file mode 100644 index 461e61d..0000000 --- a/Demo/ViewModels/TestViewModel.cs +++ /dev/null @@ -1,35 +0,0 @@ -using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; - -namespace App.ViewModels; - -[INotifyPropertyChanged] -public partial class TestViewModel -{ - [RelayCommand] - static async Task Clicked() - { - await Alert("Clicked command", "Button clicked"); - } - - [RelayCommand] - static async Task Pressed() - { - await Alert("Pressed command", "Button pressed"); - } - - [RelayCommand] - static async Task Released() - { - await Alert("Released command", "Button released"); - } - - static async Task Alert(string title, string message) - { - Page? mainpage = Application.Current?.MainPage; - if (mainpage is not null) - { - await mainpage.DisplayAlert(title, message, "OK"); - } - } -} \ No newline at end of file diff --git a/Scr/Breadcrumb.csproj b/Scr/Breadcrumb.csproj index a64e6c7..d4ef078 100644 --- a/Scr/Breadcrumb.csproj +++ b/Scr/Breadcrumb.csproj @@ -1,12 +1,14 @@ - net8.0;net8.0-android;net8.0-ios; + net9.0;net9.0-android;net9.0-ios; true true enable enable 14.2 21.0 + + true high @@ -44,13 +46,12 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + diff --git a/Scr/Breadcrumb.xaml b/Scr/Breadcrumb.xaml index 142b394..3b5b271 100644 --- a/Scr/Breadcrumb.xaml +++ b/Scr/Breadcrumb.xaml @@ -2,9 +2,11 @@ SetValue(FontFamilyProperty, value); } - // Corner radius public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create(nameof(CornerRadius), typeof(float), typeof(Breadcrumb), 10f, BindingMode.OneTime); @@ -193,7 +192,7 @@ async void BreadCrumbContainer_Loaded(object? sender, EventArgs e) BreadCrumbContainer.ChildAdded += AnimatedStack_ChildAdded; // Move BreadCrumb of selectedPage to start the animation - breadcrumb.TranslationX = Application.Current?.MainPage?.Width ?? 0; + breadcrumb.TranslationX = Application.Current?.Windows[0].Page?.Width ?? 0; // Scroll to end of control await Task.Delay(10); @@ -277,7 +276,7 @@ async void AnimatedStack_ChildAdded(object? sender, ElementEventArgs e) Animation lastBreadcrumbAnimation = new() { - { 0, 1, new Animation(_ => ((View)BreadCrumbContainer.Children[^1]).TranslationX = _, Application.Current?.MainPage?.Width ?? 0, 0, Easing.Linear) } + { 0, 1, new Animation(_ => ((View)BreadCrumbContainer.Children[^1]).TranslationX = _, Application.Current?.Windows[0].Page?.Width ?? 0, 0, Easing.Linear) } }; Point point = BreadCrumbsScrollView.GetScrollPositionForElement((View)BreadCrumbContainer.Children[^1], ScrollToPosition.End);