Skip to content

Commit

Permalink
#5: System wide Light mode does not allow changing the context menu c…
Browse files Browse the repository at this point in the history
…olor
  • Loading branch information
Aldaviva committed Mar 3, 2023
1 parent fc1991e commit 6b163f1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/dotnetpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: .NET
on:
push:
branches: [ master ]

workflow_dispatch:

jobs:
Expand All @@ -14,7 +13,7 @@ jobs:
runs-on: windows-latest

steps:
- name: Set up MSBuild
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.3.1

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

- name: Build Windows Forms demo
run: msbuild darknet-demo-winforms -p:Configuration=Release -t:build -restore
run: msbuild darknet-demo-winforms -p:Configuration=Release -t:build -restore -m

- name: Build WPF demo
run: dotnet publish darknet-demo-wpf --no-restore --configuration Release -p:PublishSingleFile=true --runtime win-x64 --self-contained false --verbosity normal
Expand All @@ -47,3 +46,4 @@ jobs:
with:
name: ${{ env.ProjectName }}
path: upload
if-no-files-found: error
7 changes: 6 additions & 1 deletion DarkNet/DarkNet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ public class DarkNet: IDarkNet {

try {
// Windows 10 1903 and later
Win32.SetPreferredAppMode(theme == Theme.Light ? AppMode.Default : AppMode.AllowDark);
Win32.SetPreferredAppMode(theme switch {
Theme.Light => AppMode.Default,
Theme.Auto => AppMode.AllowDark,
Theme.Dark => AppMode.ForceDark,
_ => AppMode.Default
});
} catch (Exception e1) when (e1 is not OutOfMemoryException) {
try {
// Windows 10 1809 only
Expand Down
2 changes: 1 addition & 1 deletion DarkNet/DarkNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net452</TargetFrameworks>
<Version>2.1.0</Version>
<Version>2.1.1</Version>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
Expand Down
4 changes: 1 addition & 3 deletions darknet-demo-winforms/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6b163f1

Please sign in to comment.