diff --git a/FluentWPF/FluentWPF.csproj b/FluentWPF/FluentWPF.csproj
index 8c4d418..54e3575 100644
--- a/FluentWPF/FluentWPF.csproj
+++ b/FluentWPF/FluentWPF.csproj
@@ -52,6 +52,15 @@
+
+
+ $(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll
+
+
+ $(MSBuildProgramFiles32)\Windows Kits\10\UnionMetadata\10.0.19041.0\Windows.winmd
+ true
+
+
@@ -59,4 +68,19 @@
+
+
+ True
+ True
+ Settings.settings
+
+
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
\ No newline at end of file
diff --git a/FluentWPF/Properties/Settings.Designer.cs b/FluentWPF/Properties/Settings.Designer.cs
index 99f0685..70a26df 100644
--- a/FluentWPF/Properties/Settings.Designer.cs
+++ b/FluentWPF/Properties/Settings.Designer.cs
@@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
//
-// このコードはツールによって生成されました。
-// ランタイム バージョン:4.0.30319.42000
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
//
-// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
-// コードが再生成されるときに損失したりします。
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
//
//------------------------------------------------------------------------------
@@ -12,7 +12,7 @@ namespace SourceChord.FluentWPF.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.1.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
diff --git a/FluentWPF/Resources/AccentColors.cs b/FluentWPF/Resources/AccentColors.cs
index 722193c..b0ab6d0 100644
--- a/FluentWPF/Resources/AccentColors.cs
+++ b/FluentWPF/Resources/AccentColors.cs
@@ -1,13 +1,11 @@
using SourceChord.FluentWPF.Utility;
using System;
-using System.Collections.Generic;
using System.ComponentModel;
-using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Media;
+using System.Windows.Threading;
+using Windows.UI.ViewManagement;
namespace SourceChord.FluentWPF
{
@@ -22,12 +20,16 @@ public class AccentColors : ThemeHandler
private static readonly int WM_DWMCOLORIZATIONCOLORCHANGED = 0x0320;
-
+ private static readonly UISettings settings = new UISettings();
static AccentColors()
{
AccentColors.Instance = new AccentColors();
+ if (SystemInfo.IsWin10())
+ {
+ settings.ColorValuesChanged += OnWin10AccentColorChanged;
+ }
Initialize();
}
@@ -36,11 +38,20 @@ public AccentColors()
}
+ private static void OnWin10AccentColorChanged(UISettings sender, object args)
+ {
+ Dispatcher.CurrentDispatcher.Invoke(() =>
+ {
+ Initialize();
+ });
+ }
+
protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
- if (msg == WM_DWMCOLORIZATIONCOLORCHANGED)
+ if (!SystemInfo.IsWin10() && msg == WM_DWMCOLORIZATIONCOLORCHANGED)
{
// 再取得
+ //Console.WriteLine("WM_DWMCOLORIZATIONCOLORCHANGED");
Initialize();
}
@@ -157,12 +168,20 @@ public static Brush ImmersiveSystemAccentLight3Brush
}
#endregion
-
-
internal static void Initialize()
{
// 各種Color定義
- if (!SystemInfo.IsWin7())
+ if (SystemInfo.IsWin10())
+ {
+ ImmersiveSystemAccent = TranslateColor(settings.GetColorValue(UIColorType.Accent));
+ ImmersiveSystemAccentDark1 = TranslateColor(settings.GetColorValue(UIColorType.AccentDark1));
+ ImmersiveSystemAccentDark2 = TranslateColor(settings.GetColorValue(UIColorType.AccentDark2));
+ ImmersiveSystemAccentDark3 = TranslateColor(settings.GetColorValue(UIColorType.AccentDark3));
+ ImmersiveSystemAccentLight1 = TranslateColor(settings.GetColorValue(UIColorType.AccentLight1));
+ ImmersiveSystemAccentLight2 = TranslateColor(settings.GetColorValue(UIColorType.AccentLight1));
+ ImmersiveSystemAccentLight3 = TranslateColor(settings.GetColorValue(UIColorType.AccentLight2));
+ }
+ else if (!SystemInfo.IsWin7())
{
ImmersiveSystemAccent = GetColorByTypeName("ImmersiveSystemAccent");
ImmersiveSystemAccentDark1 = GetColorByTypeName("ImmersiveSystemAccentDark1");
@@ -194,6 +213,11 @@ internal static void Initialize()
ImmersiveSystemAccentLight3Brush = CreateBrush(ImmersiveSystemAccentLight3);
}
+ internal static Color TranslateColor(Windows.UI.Color color)
+ {
+ return Color.FromArgb(color.A, color.R, color.G, color.B);
+ }
+
internal static Brush CreateBrush(Color color)
{
var brush = new SolidColorBrush(color);
@@ -203,7 +227,7 @@ internal static Brush CreateBrush(Color color)
public static event EventHandler StaticPropertyChanged;
- protected static void OnStaticPropertyChanged([CallerMemberName]string propertyName = null)
+ protected static void OnStaticPropertyChanged([CallerMemberName] string propertyName = null)
{
StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(propertyName));
}