Added RegistryKeyExtensions
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
namespace NotificationFlyout.Wpf.UI.Extensions
|
||||||
|
{
|
||||||
|
public static class RegistryKeyExtensions
|
||||||
|
{
|
||||||
|
public static T GetValue<T>(this RegistryKey key, string valueName, T defaultValue = default)
|
||||||
|
{
|
||||||
|
return string.IsNullOrWhiteSpace(valueName) ? defaultValue : key.GetValue(valueName, defaultValue) is T value ? value : defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,8 +37,8 @@ namespace NotificationFlyout.Wpf.UI.Helpers
|
|||||||
|
|
||||||
private SystemTheme GetSystemTheme()
|
private SystemTheme GetSystemTheme()
|
||||||
{
|
{
|
||||||
var uiTheme = _settings.GetColorValue(UIColorType.Background).ToString();
|
var color = _settings.GetColorValue(UIColorType.Background).ToString();
|
||||||
return uiTheme == "#FFFFFFFF" ? SystemTheme.Light : SystemTheme.Dark;
|
return color == "#FFFFFFFF" ? SystemTheme.Light : SystemTheme.Dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnColorValuesChanged(UISettings sender, object args)
|
private void OnColorValuesChanged(UISettings sender, object args)
|
||||||
|
|||||||
Reference in New Issue
Block a user