8000 Resolving PR #9436 ( Implementing ThemeMode properties ) comments (#9… · dotnet/wpf@5922b87 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5922b87

Browse files
Resolving PR #9436 ( Implementing ThemeMode properties ) comments (#9514)
* Removed windows from FluentEnabledWindows on dispose * Simplified resync clause and removed redundant steps. * Made FluentThemeState a record struct * Added const Fluent theme dictionary strings * Removed ToString override from FluentThemeState * Renaming const and static private fields * Fixing the if clause * Formatted ThemeManager --------- Co-authored-by: Dipesh Kumar <dipeshkrj14@gmail.com>
1 parent 0b67a5a commit 5922b87

File tree

3 files changed

+127
-160
lines changed

3 files changed

+127
-160
lines changed
Lines changed: 7 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,20 @@
11
using System;
2-
using System.ComponentModel;
3-
4-
using System.ComponentModel.Design.Serialization;
5-
using System.Diagnostics;
6-
using System.Globalization;
7-
using System.Reflection;
82
using System.Windows;
9-
using System.Windows.Markup;
103
using System.Windows.Media;
11-
using System.Security;
12-
using MS.Internal;
13-
using MS.Utility;
14-
using System.Diagnostics.CodeAnalysis;
154

165
namespace System.Windows
176
{
18-
internal readonly struct FluentThemeState : IEquatable<FluentThemeState>
7+
internal readonly record struct FluentThemeState
198
{
20-
21-
public FluentThemeState(string themeName, bool useLightColors, Color accentColor)
22-
{
23-
_themeName = themeName;
24-
_useLightColors = useLightColors;
25-
_accentColor = accentColor;
26-
}
27-
289
public FluentThemeState(string themeName, bool useLightColors)
2910
{
30-
_themeName = themeName;
31-
_useLightColors = useLightColors;
32-
_accentColor = SystemColors.AccentColor;
33-
}
34-
35-
public string ThemeName => _themeName;
36-
public bool UseLightColors => _useLightColors;
37-
public Color AccentColor => _accentColor;
38-
39-
private readonly string _themeName;
40-
private readonly bool _useLightColors;
41-
private readonly Color _accentColor;
42-
43-
44-
public bool Equals(FluentThemeState other)
45-
{
46-
return string.Equals(ThemeName, other.ThemeName, StringComparison.Ordinal) &&
47-
UseLightColors == other.UseLightColors &&
48-
AccentColor == other.AccentColor;
49-
}
50-
51-
public override bool Equals(object obj)
52-
{
53-
return obj is FluentThemeState other && Equals(other);
11+
ThemeName = themeName;
12+
UseLightColors = useLightColors;
13+
AccentColor = SystemColors.AccentColor;
5414
}
5515

56-
public static bool operator ==(FluentThemeState left, FluentThemeState right)
57-
{
58-
return left.Equals(right);
59-
}
60-
61-
public static bool operator !=(FluentThemeState left, FluentThemeState right)
62-
{
63-
return !left.Equals(right);
64-
}
65-
66-
public override int GetHashCode()
67-
{
68-
return StringComparer.Ordinal.GetHashCode(ToString());
69-
}
70-
71-
72-
public override string ToString()
73-
{
74-
return $"ThemeName: {ThemeName}, UseLightColors: {UseLightColors}, AccentColor: {AccentColor}";
75-
}
16+
public string ThemeName {get; init;}
17+
public bool UseLightColors {get; init;}
18+
public Color AccentColor {get; init;}
7619
}
7720
}

0 commit comments

Comments
 (0)
0