Skip to content

Commit

Permalink
Rename SystemTheme.Theme property to SystemTheme.AppTheme
Browse files Browse the repository at this point in the history
  • Loading branch information
sourcechord committed Oct 13, 2019
1 parent b2e956e commit 3991d3e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion FluentWPF/Resources/ResourceDictionaryEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private void ChangeTheme()
break;
case ElementTheme.Default:
default:
this.ChangeTheme(SystemTheme.Theme.ToString());
this.ChangeTheme(SystemTheme.AppTheme.ToString());
break;
}
}
Expand Down
14 changes: 7 additions & 7 deletions FluentWPF/Resources/SystemTheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class SystemTheme : ThemeHandler
static SystemTheme()
{
SystemTheme.Instance = new SystemTheme();
Theme = GetTheme();
AppTheme = GetAppTheme();
WindowsTheme = GetWindowsTheme();
}

Expand All @@ -41,7 +41,7 @@ protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lP
if (systemParmeter == "ImmersiveColorSet")
{
// 再度レジストリから Dark/Lightの設定を取得
Theme = GetTheme();
AppTheme = GetAppTheme();
WindowsTheme = GetWindowsTheme();
SystemTheme.ThemeChanged?.Invoke(null, null);

Expand All @@ -52,7 +52,7 @@ protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lP
return IntPtr.Zero;
}

private static ApplicationTheme GetTheme()
private static ApplicationTheme GetAppTheme()
{
var regkey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", false);
// キーが存在しないときはnullが返る
Expand All @@ -72,11 +72,11 @@ private static WindowsTheme GetWindowsTheme()
return intValue == 0 ? WindowsTheme.Dark : WindowsTheme.Light;
}

private static ApplicationTheme theme;
public static ApplicationTheme Theme
private static ApplicationTheme appTheme;
public static ApplicationTheme AppTheme
{
get { return theme; }
private set { if (!object.Equals(theme, value)) { theme = value; OnStaticPropertyChanged(); } }
get { return appTheme; }
private set { if (!object.Equals(appTheme, value)) { appTheme = value; OnStaticPropertyChanged(); } }
}

private static WindowsTheme windowsTheme;
Expand Down
4 changes: 2 additions & 2 deletions Sample/FluentWPFSample/Views/AccentColorsSample.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
<TextBlock Text="Application Theme"/>
<RadioButton Content="Light"
IsEnabled="False"
IsChecked="{Binding Path=(fw:SystemTheme.Theme),
IsChecked="{Binding Path=(fw:SystemTheme.AppTheme),
Converter={StaticResource radioButtonConverter}, ConverterParameter=Light, Mode=OneWay}"/>
<RadioButton Content="Dark"
IsEnabled="False"
IsChecked="{Binding Path=(fw:SystemTheme.Theme),
IsChecked="{Binding Path=(fw:SystemTheme.AppTheme),
Converter={StaticResource radioButtonConverter}, ConverterParameter=Dark, Mode=OneWay}"/>
</StackPanel>
</Border>
Expand Down

0 comments on commit 3991d3e

Please sign in to comment.