-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…ifferent windows? [appears to work, API is neither documented nor finalized]
- Loading branch information
Showing
14 changed files
with
319 additions
and
70 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Windows; | ||
using System.Windows.Forms; | ||
using System.Windows.Interop; | ||
|
||
namespace Dark.Net.Events; | ||
|
||
public abstract class WindowThemeChangedEventArgs: EventArgs { | ||
|
||
public IntPtr WindowHandle { get; } | ||
public bool EffectiveWindowThemeIsDark { get; } | ||
|
||
protected WindowThemeChangedEventArgs(IntPtr windowHandle, bool effectiveWindowThemeIsDark) { | ||
WindowHandle = windowHandle; | ||
EffectiveWindowThemeIsDark = effectiveWindowThemeIsDark; | ||
} | ||
|
||
} | ||
|
||
public class WpfWindowThemeChangedEventArgs: WindowThemeChangedEventArgs { | ||
|
||
public Window Window { get; } | ||
|
||
public WpfWindowThemeChangedEventArgs(Window window, bool effectiveWindowThemeIsDark): base(new WindowInteropHelper(window).Handle, effectiveWindowThemeIsDark) { | ||
Window = window; | ||
} | ||
|
||
} | ||
|
||
public class FormsWindowThemeChangedEventArgs: WindowThemeChangedEventArgs { | ||
|
||
public Form Window { get; } | ||
|
||
public FormsWindowThemeChangedEventArgs(Form window, bool isEffectiveWindowThemeDark): base(window.Handle, isEffectiveWindowThemeDark) { | ||
Window = window; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Windows; | ||
using System.Windows.Forms; | ||
|
||
namespace Dark.Net; | ||
|
||
internal class WindowThemeState { | ||
|
||
internal Theme PreferredTheme { get; set; } | ||
internal ThemeOptions? Options { get; set; } | ||
internal Window? WpfWindow { get; set; } | ||
internal Form? FormsWindow { get; set; } | ||
internal IntPtr WindowHandle { get; set; } | ||
|
||
private bool _effectiveThemeIsDark; | ||
|
||
internal event WindowThemeStateEventHandler? EffectiveThemeChanged; | ||
|
||
internal WindowThemeState(IntPtr windowHandle, Theme preferredTheme, ThemeOptions? options = null) { | ||
WindowHandle = windowHandle; | ||
PreferredTheme = preferredTheme; | ||
Options = options; | ||
} | ||
|
||
internal bool EffectiveThemeIsDark { | ||
get => _effectiveThemeIsDark; | ||
set { | ||
if (value != _effectiveThemeIsDark) { | ||
_effectiveThemeIsDark = value; | ||
EffectiveThemeChanged?.Invoke(this, value); | ||
} | ||
} | ||
} | ||
|
||
internal delegate void WindowThemeStateEventHandler(WindowThemeState windowThemeState, bool isDarkMode); | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
<Application x:Class="darknet_demo_wpf.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:darknet="clr-namespace:Dark.Net.Wpf;assembly=DarkNet" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<!-- This will be replaced with the correct skin to match the title bar theme by SkinManager --> | ||
<ResourceDictionary Source="Skins/Skin.Dark.xaml" /> | ||
<!-- <ResourceDictionary Source="Skins/Skin.Dark.xaml" /> --> | ||
<!-- <ResourceDictionary Source="Skins/Skin.Light.xaml" /> --> | ||
</ResourceDictionary.MergedDictionaries> | ||
|
||
<darknet:SkinManager x:Key="skinManager"/> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
Oops, something went wrong.