From 5be0846abb0ceb17ed4b7205bb3bf7d6ded472a3 Mon Sep 17 00:00:00 2001 From: jschick04 Date: Tue, 12 Nov 2024 12:23:41 -0600 Subject: [PATCH] Updated solution to .NET 9 and updated packages --- azure-pipeline-merge.yml | 4 +- azure-pipeline-release.yml | 4 +- .../EventLogExpert.EventDbTool.csproj | 2 +- .../EventLogExpert.Eventing.Tests.csproj | 14 +++--- .../EventLogExpert.Eventing.csproj | 6 +-- .../EventLogExpert.UI.Tests.csproj | 14 +++--- .../EventLogExpert.UI.csproj | 4 +- src/EventLogExpert/App.xaml.cs | 43 ++++++++++--------- src/EventLogExpert/EventLogExpert.csproj | 4 +- src/EventLogExpert/MainPage.xaml.cs | 4 +- src/EventLogExpert/MauiProgram.cs | 8 ++-- 11 files changed, 55 insertions(+), 52 deletions(-) diff --git a/azure-pipeline-merge.yml b/azure-pipeline-merge.yml index 062b3be2..875e2e6c 100644 --- a/azure-pipeline-merge.yml +++ b/azure-pipeline-merge.yml @@ -27,7 +27,7 @@ extends: - task: UseDotNet@2 displayName: 'Install .NET SDK' inputs: - version: '8.x' + version: '9.x' performMultiLevelLookup: true - script: dotnet workload restore src/EventLogExpert.sln displayName: 'dotnet workload restore' @@ -50,7 +50,7 @@ extends: dotnet publish src/EventLogExpert.EventDbTool/EventLogExpert.EventDbTool.csproj ` --self-contained ` -c Release ` -o "$(build.artifactStagingDirectory)" ` -p:IncludeNativeLibrariesForSelfExtract=true ` -p:PublishSingleFile=true ` -p:Version=$(ReleaseVersion) displayName: 'dotnet publish EventDbTool' - pwsh: > - dotnet publish src/EventLogExpert/EventLogExpert.csproj ` -c Release ` -f net8.0-windows10.0.19041.0 ` -p:AppxBundle=Never ` -p:AppInstallerCheckForUpdateFrequency=OnApplicationRun ` -p:AppInstallerUpdateFrequency=1 ` -p:AppInstallerUri="https://github.com/microsoft/EventLogExpert/releases/latest/download/" ` -p:GenerateAppInstallerFile=true ` -p:OutputPath="$(build.artifactStagingDirectory)\AppInstaller\" ` -p:RuntimeIdentifierOverride=win10-x64 ` -p:UapAppxPackageBuildMode=SideLoadOnly ` -p:Version=$(ReleaseVersion) + dotnet publish src/EventLogExpert/EventLogExpert.csproj ` -c Release ` -f net9.0-windows10.0.19041.0 ` -p:AppxBundle=Never ` -p:AppInstallerCheckForUpdateFrequency=OnApplicationRun ` -p:AppInstallerUpdateFrequency=1 ` -p:AppInstallerUri="https://github.com/microsoft/EventLogExpert/releases/latest/download/" ` -p:GenerateAppInstallerFile=true ` -p:OutputPath="$(build.artifactStagingDirectory)\AppInstaller\" ` -p:RuntimeIdentifierOverride=win10-x64 ` -p:UapAppxPackageBuildMode=SideLoadOnly ` -p:Version=$(ReleaseVersion) displayName: 'dotnet publish EventLogExpert' - pwsh: | Get-ChildItem -Recurse "$(build.artifactStagingDirectory)" diff --git a/azure-pipeline-release.yml b/azure-pipeline-release.yml index d118870d..8685b169 100644 --- a/azure-pipeline-release.yml +++ b/azure-pipeline-release.yml @@ -27,7 +27,7 @@ extends: - task: UseDotNet@2 displayName: 'Install .NET SDK' inputs: - version: '8.x' + version: '9.x' performMultiLevelLookup: true - script: dotnet workload restore src/EventLogExpert.sln displayName: 'dotnet workload restore' @@ -50,7 +50,7 @@ extends: dotnet publish src/EventLogExpert.EventDbTool/EventLogExpert.EventDbTool.csproj ` --self-contained ` -c Release ` -o "$(build.artifactStagingDirectory)" ` -p:IncludeNativeLibrariesForSelfExtract=true ` -p:PublishSingleFile=true ` -p:Version=$(ReleaseVersion) displayName: 'dotnet publish EventDbTool' - pwsh: > - dotnet publish src/EventLogExpert/EventLogExpert.csproj ` -c Release ` -f net8.0-windows10.0.19041.0 ` -p:AppxBundle=Never ` -p:AppInstallerCheckForUpdateFrequency=OnApplicationRun ` -p:AppInstallerUpdateFrequency=1 ` -p:AppInstallerUri="https://github.com/microsoft/EventLogExpert/releases/latest/download/" ` -p:GenerateAppInstallerFile=true ` -p:OutputPath="$(build.artifactStagingDirectory)\AppInstaller\" ` -p:RuntimeIdentifierOverride=win10-x64 ` -p:UapAppxPackageBuildMode=SideLoadOnly ` -p:Version=$(ReleaseVersion) + dotnet publish src/EventLogExpert/EventLogExpert.csproj ` -c Release ` -f net9.0-windows10.0.19041.0 ` -p:AppxBundle=Never ` -p:AppInstallerCheckForUpdateFrequency=OnApplicationRun ` -p:AppInstallerUpdateFrequency=1 ` -p:AppInstallerUri="https://github.com/microsoft/EventLogExpert/releases/latest/download/" ` -p:GenerateAppInstallerFile=true ` -p:OutputPath="$(build.artifactStagingDirectory)\AppInstaller\" ` -p:RuntimeIdentifierOverride=win10-x64 ` -p:UapAppxPackageBuildMode=SideLoadOnly ` -p:Version=$(ReleaseVersion) displayName: 'dotnet publish EventLogExpert' - pwsh: | Get-ChildItem -Recurse "$(build.artifactStagingDirectory)" diff --git a/src/EventLogExpert.EventDbTool/EventLogExpert.EventDbTool.csproj b/src/EventLogExpert.EventDbTool/EventLogExpert.EventDbTool.csproj index 3ce44d5f..d6b17fc1 100644 --- a/src/EventLogExpert.EventDbTool/EventLogExpert.EventDbTool.csproj +++ b/src/EventLogExpert.EventDbTool/EventLogExpert.EventDbTool.csproj @@ -2,7 +2,7 @@ Exe - net8.0-windows10.0.19041.0 + net9.0-windows10.0.19041.0 enable enable x64 diff --git a/src/EventLogExpert.Eventing.Tests/EventLogExpert.Eventing.Tests.csproj b/src/EventLogExpert.Eventing.Tests/EventLogExpert.Eventing.Tests.csproj index fe2099df..d316afb1 100644 --- a/src/EventLogExpert.Eventing.Tests/EventLogExpert.Eventing.Tests.csproj +++ b/src/EventLogExpert.Eventing.Tests/EventLogExpert.Eventing.Tests.csproj @@ -1,7 +1,7 @@ - net8.0-windows10.0.19041.0 + net9.0-windows10.0.19041.0 enable enable @@ -10,18 +10,18 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/EventLogExpert.Eventing/EventLogExpert.Eventing.csproj b/src/EventLogExpert.Eventing/EventLogExpert.Eventing.csproj index 04c34199..d845aea6 100644 --- a/src/EventLogExpert.Eventing/EventLogExpert.Eventing.csproj +++ b/src/EventLogExpert.Eventing/EventLogExpert.Eventing.csproj @@ -2,7 +2,7 @@ - $(TargetFrameworks);net8.0-windows10.0.19041.0 + $(TargetFrameworks);net9.0-windows10.0.19041.0 true @@ -19,8 +19,8 @@ - - + + diff --git a/src/EventLogExpert.UI.Tests/EventLogExpert.UI.Tests.csproj b/src/EventLogExpert.UI.Tests/EventLogExpert.UI.Tests.csproj index 75799a79..175deeb3 100644 --- a/src/EventLogExpert.UI.Tests/EventLogExpert.UI.Tests.csproj +++ b/src/EventLogExpert.UI.Tests/EventLogExpert.UI.Tests.csproj @@ -1,7 +1,7 @@  - net8.0-windows10.0.19041.0 + net9.0-windows10.0.19041.0 enable enable false @@ -9,18 +9,18 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/EventLogExpert.UI/EventLogExpert.UI.csproj b/src/EventLogExpert.UI/EventLogExpert.UI.csproj index ab11eff0..a76e8038 100644 --- a/src/EventLogExpert.UI/EventLogExpert.UI.csproj +++ b/src/EventLogExpert.UI/EventLogExpert.UI.csproj @@ -2,7 +2,7 @@ - $(TargetFrameworks);net8.0-windows10.0.19041.0 + $(TargetFrameworks);net9.0-windows10.0.19041.0 true @@ -18,7 +18,7 @@ - + diff --git a/src/EventLogExpert/App.xaml.cs b/src/EventLogExpert/App.xaml.cs index 7cdbbfd1..add21e5e 100644 --- a/src/EventLogExpert/App.xaml.cs +++ b/src/EventLogExpert/App.xaml.cs @@ -18,6 +18,8 @@ namespace EventLogExpert; public sealed partial class App : Application { + private readonly MainPage _mainPage; + public App( IActionSubscriber actionSubscriber, IDispatcher fluxorDispatcher, @@ -37,30 +39,31 @@ public App( { InitializeComponent(); - MainPage = new NavigationPage( - new MainPage( - actionSubscriber, - fluxorDispatcher, - databaseCollectionProvider, - activeLogsState, - continuouslyUpdateState, - filterPaneIsEnabledState, - loadedDatabasesState, - settingsState, - dialogService, - clipboardService, - updateService, - currentVersionProvider, - appTitleService, - fileLocationOptions, - traceLogger)); + _mainPage = new MainPage( + actionSubscriber, + fluxorDispatcher, + databaseCollectionProvider, + activeLogsState, + continuouslyUpdateState, + filterPaneIsEnabledState, + loadedDatabasesState, + settingsState, + dialogService, + clipboardService, + updateService, + currentVersionProvider, + appTitleService, + fileLocationOptions, + traceLogger); } protected override Window CreateWindow(IActivationState? activationState) { - var window = base.CreateWindow(activationState); - - window.Title = "EventLogExpert"; + var window = new Window + { + Title = "EventLogExpert", + Page = new NavigationPage(_mainPage) + }; // Ultrawide monitors create a window that is way too wide if (DeviceDisplay.Current.MainDisplayInfo.Width >= 2048) diff --git a/src/EventLogExpert/EventLogExpert.csproj b/src/EventLogExpert/EventLogExpert.csproj index 7ecc4cde..de866006 100644 --- a/src/EventLogExpert/EventLogExpert.csproj +++ b/src/EventLogExpert/EventLogExpert.csproj @@ -2,7 +2,7 @@ - $(TargetFrameworks);net8.0-windows10.0.19041.0 + $(TargetFrameworks);net9.0-windows10.0.19041.0 @@ -77,7 +77,7 @@ - + diff --git a/src/EventLogExpert/MainPage.xaml.cs b/src/EventLogExpert/MainPage.xaml.cs index 281afecf..33c0400a 100644 --- a/src/EventLogExpert/MainPage.xaml.cs +++ b/src/EventLogExpert/MainPage.xaml.cs @@ -284,7 +284,7 @@ private void EnableAddLogToViewViaDragAndDrop() } private void Exit_Clicked(object sender, EventArgs e) => - Application.Current?.CloseWindow(Application.Current.MainPage!.Window!); + Application.Current?.CloseWindow(Application.Current.Windows[0].Page!.Window!); private void LoadNewEvents_Clicked(object sender, EventArgs e) => _fluxorDispatcher.Dispatch(new EventLogAction.LoadNewEvents()); @@ -310,7 +310,7 @@ private async void OpenFile_Clicked(object sender, EventArgs e) foreach (var file in logs) { - await OpenLog(file!.FullPath, PathType.FilePath, shouldAddLog:true); + await OpenLog(file!.FullPath, PathType.FilePath, shouldAddLog: true); } } diff --git a/src/EventLogExpert/MauiProgram.cs b/src/EventLogExpert/MauiProgram.cs index fa1f3cdc..0d7d34f9 100644 --- a/src/EventLogExpert/MauiProgram.cs +++ b/src/EventLogExpert/MauiProgram.cs @@ -63,10 +63,10 @@ public static MauiApp CreateMauiApp() builder.Services.AddSingleton(); builder.Services.AddSingleton(new AlertDialogService( - async (title, message, cancel) => await Application.Current!.MainPage!.DisplayAlert(title, message, cancel), - async (title, message, accept, cancel) => await Application.Current!.MainPage!.DisplayAlert(title, message, accept, cancel), - async (title, message) => await Application.Current!.MainPage!.DisplayPromptAsync(title, message), - async (title, message, value) => await Application.Current!.MainPage!.DisplayPromptAsync(title, message, initialValue: value))); + async (title, message, cancel) => await Application.Current!.Windows[0].Page!.DisplayAlert(title, message, cancel), + async (title, message, accept, cancel) => await Application.Current!.Windows[0].Page!.DisplayAlert(title, message, accept, cancel), + async (title, message) => await Application.Current!.Windows[0].Page!.DisplayPromptAsync(title, message), + async (title, message, value) => await Application.Current!.Windows[0].Page!.DisplayPromptAsync(title, message, initialValue: value))); return builder.Build(); }