Skip to content

Commit 4dd220c

Browse files
committed
Fix #1
1 parent b2e34c1 commit 4dd220c

2 files changed

Lines changed: 16 additions & 24 deletions

File tree

StartPro/Setting.xaml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
xmlns:System="clr-namespace:System;assembly=mscorlib"
55
xmlns:text="clr-namespace:StartPro.Resources"
66
Title="{x:Static text:Main.TitleSetting}"
7-
Loaded="WindowLoaded"
87
SizeToContent="WidthAndHeight">
98
<Grid Margin="10">
109
<Grid.ColumnDefinitions>
@@ -36,18 +35,9 @@
3635
<TextBox x:Name="BackgroundBox" />
3736
</DockPanel>
3837
<TextBlock Grid.Row="1" Text="{x:Static text:Main.UIThemeText}" />
39-
<StackPanel Grid.Row="1" Grid.Column="1" Margin="0,5,0,5">
40-
<ComboBox x:Name="UIThemeBox" SelectionChanged="UIThemeBoxSelectionChanged">
41-
<System:String>Aero.NormalColor</System:String>
42-
<System:String>Aero2.NormalColor</System:String>
43-
<System:String>Luna.NormalColor</System:String>
44-
<System:String>Luna.Homestead</System:String>
45-
<System:String>Luna.Metallic</System:String>
46-
<System:String>Royale.NormalColor</System:String>
47-
<System:String>Classic</System:String>
48-
</ComboBox>
49-
<Label x:Name="UIThemeText" />
50-
</StackPanel>
38+
<ComboBox x:Name="UIThemeBox"
39+
Grid.Row="1" Grid.Column="1"
40+
Margin="0,5,0,5" />
5141
<CheckBox x:Name="UIFlatBox" Grid.Row="2" Content="{x:Static text:Main.UIThemeFlat}" />
5242
<StackPanel Grid.Row="3" Grid.ColumnSpan="2"
5343
HorizontalAlignment="Right"

StartPro/Setting.xaml.cs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using System.Windows;
2-
using System.Windows.Controls;
1+
using System.Collections.Generic;
2+
using System.Windows;
33
using System.Windows.Media;
44
using StartPro.Api;
55
using StartPro.Resources;
@@ -10,8 +10,19 @@ public partial class Setting : Window
1010
public Setting( )
1111
{
1212
InitializeComponent( );
13+
List<string> UIThemeSource =
14+
[
15+
Main.ResourceManager.GetString("UITheme.Aero.NormalColor") + " (Aero.NormalColor)",
16+
Main.ResourceManager.GetString("UITheme.Aero2.NormalColor") + " (Aero2.NormalColor)",
17+
Main.ResourceManager.GetString("UITheme.Luna.NormalColor") + " (Luna.NormalColor)",
18+
Main.ResourceManager.GetString("UITheme.Luna.Homestead") + " (Luna.Homestead)",
19+
Main.ResourceManager.GetString("UITheme.Luna.Metallic") + " (Luna.Metallic)",
20+
Main.ResourceManager.GetString("UITheme.Royale.NormalColor") + " (Royale.NormalColor)",
21+
Main.ResourceManager.GetString("UITheme.Classic") + " (Classic)",
22+
];
1323
MaxWidth = Defaults.WidthPercent * SystemParameters.PrimaryScreenWidth;
1424
BackgroundBox.Text = App.Settings.Content.Background;
25+
UIThemeBox.ItemsSource = UIThemeSource;
1526
UIThemeBox.SelectedIndex = App.Settings.Content.UITheme;
1627
UIFlatBox.IsChecked = App.Settings.Content.UIFlat;
1728
}
@@ -42,13 +53,4 @@ private void SelectImageClick(object o, RoutedEventArgs e)
4253
if (Utils.TrySelectFile(out string fileName, ".jpg"))
4354
BackgroundBox.Text = fileName;
4455
}
45-
46-
private void UIThemeBoxSelectionChanged(object o, SelectionChangedEventArgs e)
47-
{
48-
if (UIThemeText is null || UIThemeBox is null) return;
49-
UIThemeText.Content = Main.ResourceManager.GetString($"UITheme.{UIThemeBox.SelectedValue}");
50-
}
51-
52-
private void WindowLoaded(object o, RoutedEventArgs e)
53-
=> UIThemeBoxSelectionChanged(null, null);
5456
}

0 commit comments

Comments
 (0)