Skip to content

Commit

Permalink
Merge pull request #861 from lepoco/development
Browse files Browse the repository at this point in the history
Merge Development and bump to preview 12
  • Loading branch information
pomianowski committed Dec 7, 2023
2 parents 8afb0d9 + d5e9734 commit 538af8b
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/wpf-ui-cd-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Setup .NET Core SDK 8.x
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

Expand Down Expand Up @@ -62,4 +62,4 @@ jobs:

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v3
2 changes: 1 addition & 1 deletion .github/workflows/wpf-ui-cd-nuget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
- name: Setup .NET Core SDK 8.x
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wpf-ui-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
2 changes: 1 addition & 1 deletion .github/workflows/wpf-ui-pr-validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
- name: Setup .NET Core SDK 8.x
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Version>3.0.0-preview.11</Version>
<Version>3.0.0-preview.12</Version>
<LangVersion>12.0</LangVersion>
<Deterministic>true</Deterministic>
</PropertyGroup>
Expand Down
36 changes: 33 additions & 3 deletions src/Wpf.Ui/Interop/UnsafeNativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// This Source Code is partially based on the source code provided by the .NET Foundation.

using System.Runtime.InteropServices;
using Microsoft.Win32;
using Wpf.Ui.Controls;
using Wpf.Ui.Hardware;

Expand Down Expand Up @@ -351,11 +352,33 @@ public static bool ApplyWindowLegacyAcrylicEffect(IntPtr handle)
/// </summary>
public static Color GetDwmColor()
{
Dwmapi.DwmGetColorizationParameters(out var dwmParams);
try
{
Dwmapi.DwmGetColorizationParameters(out var dwmParams);
var values = BitConverter.GetBytes(dwmParams.clrColor);

var values = BitConverter.GetBytes(dwmParams.clrColor);
return Color.FromArgb(255, values[2], values[1], values[0]);
}
catch
{
var colorizationColorValue = Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM", "ColorizationColor", null);

return Color.FromArgb(255, values[2], values[1], values[0]);
if (colorizationColorValue is not null)
{
try
{
var colorizationColor = (uint)(int)colorizationColorValue;
var values = BitConverter.GetBytes(colorizationColor);

return Color.FromArgb(255, values[2], values[1], values[0]);
}
catch
{
}
}
}

return GetDefaultWindowsAccentColor();
}

/// <summary>
Expand Down Expand Up @@ -585,4 +608,11 @@ private static IntPtr SetWindowLong(IntPtr handle, User32.GWL nIndex, long windo

return User32.SetWindowLongPtr(handle, (int)nIndex, (IntPtr)windowStyleLong);
}

private static Color GetDefaultWindowsAccentColor()
{
// Windows default accent color
// https://learn.microsoft.com/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-themes-windowcolor#values
return Color.FromArgb(0xff, 0x00, 0x78, 0xd7);
}
}

0 comments on commit 538af8b

Please sign in to comment.