Skip to content

Commit 6b163f1

Browse files
committed
#5: System wide Light mode does not allow changing the context menu color
1 parent fc1991e commit 6b163f1

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

.github/workflows/dotnetpackage.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: .NET
33
on:
44
push:
55
branches: [ master ]
6-
76
workflow_dispatch:
87

98
jobs:
@@ -14,7 +13,7 @@ jobs:
1413
runs-on: windows-latest
1514

1615
steps:
17-
- name: Set up MSBuild
16+
- name: Add MSBuild to PATH
1817
uses: microsoft/setup-msbuild@v1.3.1
1918

2019
- name: Clone repository
@@ -30,7 +29,7 @@ jobs:
3029
run: dotnet pack ${{ env.ProjectName }} --no-build --configuration Release --verbosity normal
3130

3231
- name: Build Windows Forms demo
33-
run: msbuild darknet-demo-winforms -p:Configuration=Release -t:build -restore
32+
run: msbuild darknet-demo-winforms -p:Configuration=Release -t:build -restore -m
3433

3534
- name: Build WPF demo
3635
run: dotnet publish darknet-demo-wpf --no-restore --configuration Release -p:PublishSingleFile=true --runtime win-x64 --self-contained false --verbosity normal
@@ -47,3 +46,4 @@ jobs:
4746
with:
4847
name: ${{ env.ProjectName }}
4948
path: upload
49+
if-no-files-found: error

DarkNet/DarkNet.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ public void SetCurrentProcessTheme(Theme theme) {
7171

7272
try {
7373
// Windows 10 1903 and later
74-
Win32.SetPreferredAppMode(theme == Theme.Light ? AppMode.Default : AppMode.AllowDark);
74+
Win32.SetPreferredAppMode(theme switch {
75+
Theme.Light => AppMode.Default,
76+
Theme.Auto => AppMode.AllowDark,
77+
Theme.Dark => AppMode.ForceDark,
78+
_ => AppMode.Default
79+
});
7580
} catch (Exception e1) when (e1 is not OutOfMemoryException) {
7681
try {
7782
// Windows 10 1809 only

DarkNet/DarkNet.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<PropertyGroup>
55
<TargetFrameworks>netcoreapp3.1;net452</TargetFrameworks>
6-
<Version>2.1.0</Version>
6+
<Version>2.1.1</Version>
77
<LangVersion>latest</LangVersion>
88
<Nullable>enable</Nullable>
99
<UseWindowsForms>true</UseWindowsForms>

darknet-demo-winforms/Form1.Designer.cs

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)