Skip to content

Commit

Permalink
Upgrade demos
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelbl committed Dec 6, 2024
1 parent 3d36867 commit 788daf1
Show file tree
Hide file tree
Showing 18 changed files with 33 additions and 27 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/demos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on: [push, pull_request]

env:
Configuration: Release
ContinuousIntegrationBuild: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Demo-ASP.NET-Core/Demo-ASP.NET-Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Net.Codecrete.QrCodeGenerator.Demo</RootNamespace>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Demo-ImageMagick/Demo-ImageMagick.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Net.Codecrete.QrCodeGenerator.Demo</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
2 changes: 1 addition & 1 deletion Demo-ImageSharp/Demo-ImageSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Net.Codecrete.QrCodeGenerator.Demo</RootNamespace>
<PackageId>Net.Codecrete.QrCodeGenerator.Demo</PackageId>
<Version>2.0.6</Version>
Expand Down
2 changes: 1 addition & 1 deletion Demo-QRCode-Variety/Demo-QRCode-Variety.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Demo_Basic</RootNamespace>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Demo-SkiaSharp/Demo-SkiaSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Net.Codecrete.QrCodeGenerator.Demo</RootNamespace>
<PackageId>Net.Codecrete.QrCodeGenerator.Demo</PackageId>
<Version>2.0.6</Version>
Expand Down
2 changes: 1 addition & 1 deletion Demo-System-Drawing/Demo-System-Drawing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Net.Codecrete.QrCodeGenerator.Demo</RootNamespace>
<PackageId>Net.Codecrete.QrCodeGenerator.Demo</PackageId>
<Version>2.0.6</Version>
Expand Down
2 changes: 1 addition & 1 deletion Demo-System-Drawing/QrCodeBitmapExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Demo-VCard/VCardDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Demo-WinForms/Demo-WinForms.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>Net.Codecrete.QrCodeGenerator.Demo</RootNamespace>
<UseWindowsForms>true</UseWindowsForms>
<UseWindowsForms>True</UseWindowsForms>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Demo-WinForms/QrCodeBitmapExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion Demo-WinUI/Demo-WinUI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
}
19 changes: 11 additions & 8 deletions Demo-WinUI/Demo-WinUI/Demo-WinUI.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>Net.Codecrete.QrCodeGenerator.Demo</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<PublishProfile>win10-$(Platform).pubxml</PublishProfile>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
<AssemblyName>QrCodeWinUIDemo</AssemblyName>
Expand All @@ -33,12 +33,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.4" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.2.221116.1" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.3.0" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.106">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.241114003" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
<PackageReference Include="Net.Codecrete.QrCodeGenerator" Version="2.0.6" />
<PackageReference Include="PInvoke.User32" Version="0.7.124" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

Expand Down
1 change: 1 addition & 0 deletions Demo-WinUI/Demo-WinUI/NativeMethods.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GetDpiForWindow
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>ARM64</Platform>
<RuntimeIdentifier>win10-arm64</RuntimeIdentifier>
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x64</Platform>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x86</Platform>
<RuntimeIdentifier>win10-x86</RuntimeIdentifier>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>Net.Codecrete.QrCodeGenerator.Demo</RootNamespace>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
Expand Down

0 comments on commit 788daf1

Please sign in to comment.