Skip to content

Commit 5e5c640

Browse files
Use new style localization
1 parent b95c96b commit 5e5c640

File tree

1 file changed

+5
-45
lines changed

1 file changed

+5
-45
lines changed

Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public double QueryBoxFontSize
8080
get => Settings.QueryBoxFontSize;
8181
set => Settings.QueryBoxFontSize = value;
8282
}
83+
8384
public double ResultItemFontSize
8485
{
8586
get => Settings.ResultItemFontSize;
@@ -94,30 +95,9 @@ public double ResultSubItemFontSize
9495
public List<string> Themes =>
9596
ThemeManager.Instance.LoadAvailableThemes().Select(Path.GetFileNameWithoutExtension).ToList();
9697

98+
public class ColorSchemeData : DropdownDataGeneric<ColorSchemes> { }
9799

98-
public class ColorScheme
99-
{
100-
public string Display { get; set; }
101-
public ColorSchemes Value { get; set; }
102-
}
103-
104-
public List<ColorScheme> ColorSchemes
105-
{
106-
get
107-
{
108-
List<ColorScheme> modes = new List<ColorScheme>();
109-
var enums = (ColorSchemes[])Enum.GetValues(typeof(ColorSchemes));
110-
foreach (var e in enums)
111-
{
112-
var key = $"ColorScheme{e}";
113-
var display = InternationalizationManager.Instance.GetTranslation(key);
114-
var m = new ColorScheme { Display = display, Value = e, };
115-
modes.Add(m);
116-
}
117-
118-
return modes;
119-
}
120-
}
100+
public List<ColorSchemeData> ColorSchemes { get; } = DropdownDataGeneric<ColorSchemes>.GetValues<ColorSchemeData>("ColorScheme");
121101

122102
public List<string> TimeFormatList { get; } = new()
123103
{
@@ -185,29 +165,9 @@ public bool UseAnimation
185165
set => Settings.UseAnimation = value;
186166
}
187167

188-
public class AnimationSpeed
189-
{
190-
public string Display { get; set; }
191-
public AnimationSpeeds Value { get; set; }
192-
}
168+
public class AnimationSpeedData : DropdownDataGeneric<AnimationSpeeds> { }
169+
public List<AnimationSpeedData> AnimationSpeeds { get; } = DropdownDataGeneric<AnimationSpeeds>.GetValues<AnimationSpeedData>("AnimationSpeed");
193170

194-
public List<AnimationSpeed> AnimationSpeeds
195-
{
196-
get
197-
{
198-
List<AnimationSpeed> speeds = new List<AnimationSpeed>();
199-
var enums = (AnimationSpeeds[])Enum.GetValues(typeof(AnimationSpeeds));
200-
foreach (var e in enums)
201-
{
202-
var key = $"AnimationSpeed{e}";
203-
var display = InternationalizationManager.Instance.GetTranslation(key);
204-
var m = new AnimationSpeed { Display = display, Value = e, };
205-
speeds.Add(m);
206-
}
207-
208-
return speeds;
209-
}
210-
}
211171
public bool UseSound
212172
{
213173
get => Settings.UseSound;

0 commit comments

Comments
 (0)