From 788daf1361a0f908764e453a4cf2150ca6377a74 Mon Sep 17 00:00:00 2001 From: "Manuel Bl." Date: Fri, 6 Dec 2024 22:54:38 +0100 Subject: [PATCH] Upgrade demos --- .github/workflows/demos.yaml | 3 +-- Demo-ASP.NET-Core/Demo-ASP.NET-Core.csproj | 2 +- Demo-ImageMagick/Demo-ImageMagick.csproj | 2 +- Demo-ImageSharp/Demo-ImageSharp.csproj | 2 +- .../Demo-QRCode-Variety.csproj | 2 +- Demo-SkiaSharp/Demo-SkiaSharp.csproj | 2 +- .../Demo-System-Drawing.csproj | 2 +- Demo-System-Drawing/QrCodeBitmapExtensions.cs | 2 +- Demo-VCard/VCardDemo.csproj | 2 +- Demo-WinForms/Demo-WinForms.csproj | 6 +++--- Demo-WinForms/QrCodeBitmapExtensions.cs | 2 +- Demo-WinUI/Demo-WinUI/App.xaml.cs | 5 ++++- Demo-WinUI/Demo-WinUI/Demo-WinUI.csproj | 19 +++++++++++-------- Demo-WinUI/Demo-WinUI/NativeMethods.txt | 1 + .../{win10-arm64.pubxml => win-arm64.pubxml} | 2 +- .../{win10-x64.pubxml => win-x64.pubxml} | 2 +- .../{win10-x86.pubxml => win-x86.pubxml} | 2 +- .../Demo-WindowsPresentationFoundation.csproj | 2 +- 18 files changed, 33 insertions(+), 27 deletions(-) create mode 100644 Demo-WinUI/Demo-WinUI/NativeMethods.txt rename Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/{win10-arm64.pubxml => win-arm64.pubxml} (93%) rename Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/{win10-x64.pubxml => win-x64.pubxml} (93%) rename Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/{win10-x86.pubxml => win-x86.pubxml} (93%) diff --git a/.github/workflows/demos.yaml b/.github/workflows/demos.yaml index ff3a2e5..91f9914 100644 --- a/.github/workflows/demos.yaml +++ b/.github/workflows/demos.yaml @@ -4,7 +4,6 @@ on: [push, pull_request] env: Configuration: Release - ContinuousIntegrationBuild: true DOTNET_CLI_TELEMETRY_OPTOUT: true DOTNET_NOLOGO: true @@ -20,7 +19,7 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Create local NuGet source run: | mkdir ..\LocalPackages diff --git a/Demo-ASP.NET-Core/Demo-ASP.NET-Core.csproj b/Demo-ASP.NET-Core/Demo-ASP.NET-Core.csproj index 78a97e8..ec472ec 100644 --- a/Demo-ASP.NET-Core/Demo-ASP.NET-Core.csproj +++ b/Demo-ASP.NET-Core/Demo-ASP.NET-Core.csproj @@ -1,7 +1,7 @@ - net5.0 + net8.0 Net.Codecrete.QrCodeGenerator.Demo diff --git a/Demo-ImageMagick/Demo-ImageMagick.csproj b/Demo-ImageMagick/Demo-ImageMagick.csproj index 9bac0ab..e5c6d2b 100644 --- a/Demo-ImageMagick/Demo-ImageMagick.csproj +++ b/Demo-ImageMagick/Demo-ImageMagick.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Net.Codecrete.QrCodeGenerator.Demo enable enable diff --git a/Demo-ImageSharp/Demo-ImageSharp.csproj b/Demo-ImageSharp/Demo-ImageSharp.csproj index ace9e4c..47e3e0a 100644 --- a/Demo-ImageSharp/Demo-ImageSharp.csproj +++ b/Demo-ImageSharp/Demo-ImageSharp.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Net.Codecrete.QrCodeGenerator.Demo Net.Codecrete.QrCodeGenerator.Demo 2.0.6 diff --git a/Demo-QRCode-Variety/Demo-QRCode-Variety.csproj b/Demo-QRCode-Variety/Demo-QRCode-Variety.csproj index 2cd7e77..5cb8c69 100644 --- a/Demo-QRCode-Variety/Demo-QRCode-Variety.csproj +++ b/Demo-QRCode-Variety/Demo-QRCode-Variety.csproj @@ -2,7 +2,7 @@ Exe - net5.0 + net8.0 Demo_Basic diff --git a/Demo-SkiaSharp/Demo-SkiaSharp.csproj b/Demo-SkiaSharp/Demo-SkiaSharp.csproj index a2ff8f2..ad53042 100644 --- a/Demo-SkiaSharp/Demo-SkiaSharp.csproj +++ b/Demo-SkiaSharp/Demo-SkiaSharp.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net8.0 Net.Codecrete.QrCodeGenerator.Demo Net.Codecrete.QrCodeGenerator.Demo 2.0.6 diff --git a/Demo-System-Drawing/Demo-System-Drawing.csproj b/Demo-System-Drawing/Demo-System-Drawing.csproj index bf928f7..946367e 100644 --- a/Demo-System-Drawing/Demo-System-Drawing.csproj +++ b/Demo-System-Drawing/Demo-System-Drawing.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net8.0 Net.Codecrete.QrCodeGenerator.Demo Net.Codecrete.QrCodeGenerator.Demo 2.0.6 diff --git a/Demo-System-Drawing/QrCodeBitmapExtensions.cs b/Demo-System-Drawing/QrCodeBitmapExtensions.cs index b2bdc5d..cfe7338 100644 --- a/Demo-System-Drawing/QrCodeBitmapExtensions.cs +++ b/Demo-System-Drawing/QrCodeBitmapExtensions.cs @@ -121,7 +121,7 @@ public static void Draw(this QrCode qrCode, Graphics graphics, float scale, floa float dim = (size + border * 2) * scale; // draw background - if (background != null) + if (background != Color.Transparent) { using SolidBrush brush = new SolidBrush(background); graphics.FillRectangle(brush, 0, 0, dim, dim); diff --git a/Demo-VCard/VCardDemo.csproj b/Demo-VCard/VCardDemo.csproj index 5d46ee8..30f6f6b 100644 --- a/Demo-VCard/VCardDemo.csproj +++ b/Demo-VCard/VCardDemo.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 diff --git a/Demo-WinForms/Demo-WinForms.csproj b/Demo-WinForms/Demo-WinForms.csproj index c81dec6..33f6991 100644 --- a/Demo-WinForms/Demo-WinForms.csproj +++ b/Demo-WinForms/Demo-WinForms.csproj @@ -1,10 +1,10 @@ - + WinExe - netcoreapp3.1 + net8.0-windows Net.Codecrete.QrCodeGenerator.Demo - true + True diff --git a/Demo-WinForms/QrCodeBitmapExtensions.cs b/Demo-WinForms/QrCodeBitmapExtensions.cs index b2bdc5d..cfe7338 100644 --- a/Demo-WinForms/QrCodeBitmapExtensions.cs +++ b/Demo-WinForms/QrCodeBitmapExtensions.cs @@ -121,7 +121,7 @@ public static void Draw(this QrCode qrCode, Graphics graphics, float scale, floa float dim = (size + border * 2) * scale; // draw background - if (background != null) + if (background != Color.Transparent) { using SolidBrush brush = new SolidBrush(background); graphics.FillRectangle(brush, 0, 0, dim, dim); diff --git a/Demo-WinUI/Demo-WinUI/App.xaml.cs b/Demo-WinUI/Demo-WinUI/App.xaml.cs index 34cfbac..965d458 100644 --- a/Demo-WinUI/Demo-WinUI/App.xaml.cs +++ b/Demo-WinUI/Demo-WinUI/App.xaml.cs @@ -12,6 +12,8 @@ using System.Runtime.InteropServices; using Windows.Graphics; using WinRT.Interop; +using Windows.Win32; +using Windows.Win32.Foundation; namespace Net.Codecrete.QrCodeGenerator.Demo; @@ -63,7 +65,8 @@ private AppWindow GetAppWindow() private double GetDpiScalingFactor() { - var dpi = PInvoke.User32.GetDpiForWindow(WindowNative.GetWindowHandle(m_window)); + IntPtr hWnd = WindowNative.GetWindowHandle(m_window); + var dpi = PInvoke.GetDpiForWindow((HWND)hWnd); return (float)dpi / 96; } } diff --git a/Demo-WinUI/Demo-WinUI/Demo-WinUI.csproj b/Demo-WinUI/Demo-WinUI/Demo-WinUI.csproj index a783088..dbe7623 100644 --- a/Demo-WinUI/Demo-WinUI/Demo-WinUI.csproj +++ b/Demo-WinUI/Demo-WinUI/Demo-WinUI.csproj @@ -1,13 +1,13 @@  WinExe - net6.0-windows10.0.19041.0 + net8.0-windows10.0.19041.0 10.0.17763.0 Net.Codecrete.QrCodeGenerator.Demo app.manifest x86;x64;ARM64 - win10-x86;win10-x64;win10-arm64 - win10-$(Platform).pubxml + win-x86;win-x64;win-arm64 + win-$(Platform).pubxml true true QrCodeWinUIDemo @@ -33,12 +33,15 @@ - - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + - diff --git a/Demo-WinUI/Demo-WinUI/NativeMethods.txt b/Demo-WinUI/Demo-WinUI/NativeMethods.txt new file mode 100644 index 0000000..fb15781 --- /dev/null +++ b/Demo-WinUI/Demo-WinUI/NativeMethods.txt @@ -0,0 +1 @@ +GetDpiForWindow diff --git a/Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win10-arm64.pubxml b/Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win-arm64.pubxml similarity index 93% rename from Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win10-arm64.pubxml rename to Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win-arm64.pubxml index a7fdd16..d544e38 100644 --- a/Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win10-arm64.pubxml +++ b/Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win-arm64.pubxml @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem ARM64 - win10-arm64 + win-arm64 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true False diff --git a/Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win10-x64.pubxml b/Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win-x64.pubxml similarity index 93% rename from Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win10-x64.pubxml rename to Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win-x64.pubxml index 26ea7e5..ca40a9e 100644 --- a/Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win10-x64.pubxml +++ b/Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win-x64.pubxml @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem x64 - win10-x64 + win-x64 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true False diff --git a/Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win10-x86.pubxml b/Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win-x86.pubxml similarity index 93% rename from Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win10-x86.pubxml rename to Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win-x86.pubxml index 34d14d4..be62e6b 100644 --- a/Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win10-x86.pubxml +++ b/Demo-WinUI/Demo-WinUI/Properties/PublishProfiles/win-x86.pubxml @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem x86 - win10-x86 + win-x86 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true False diff --git a/Demo-WindowsPresentationFoundation/Demo-WindowsPresentationFoundation.csproj b/Demo-WindowsPresentationFoundation/Demo-WindowsPresentationFoundation.csproj index 918eac6..6858707 100644 --- a/Demo-WindowsPresentationFoundation/Demo-WindowsPresentationFoundation.csproj +++ b/Demo-WindowsPresentationFoundation/Demo-WindowsPresentationFoundation.csproj @@ -2,7 +2,7 @@ WinExe - net5.0-windows + net8.0-windows Net.Codecrete.QrCodeGenerator.Demo enable true