Skip to content

Commit 7b71f85

Browse files
committed
ux: re-arrange options in apperance page
1 parent 7d49d2b commit 7b71f85

File tree

3 files changed

+22
-34
lines changed

3 files changed

+22
-34
lines changed

src/App.axaml.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,10 @@ public static void SetLocale(string localeKey)
132132
var app = Current as App;
133133
var targetLocale = app.Resources[localeKey] as ResourceDictionary;
134134
if (targetLocale == null || targetLocale == app._activeLocale)
135-
{
136135
return;
137-
}
138136

139137
if (app._activeLocale != null)
140-
{
141138
app.Resources.MergedDictionaries.Remove(app._activeLocale);
142-
}
143139

144140
app.Resources.MergedDictionaries.Add(targetLocale);
145141
app._activeLocale = targetLocale;
@@ -150,17 +146,11 @@ public static void SetTheme(string theme, string colorsFile)
150146
var app = Current as App;
151147

152148
if (theme.Equals("Light", StringComparison.OrdinalIgnoreCase))
153-
{
154149
app.RequestedThemeVariant = ThemeVariant.Light;
155-
}
156150
else if (theme.Equals("Dark", StringComparison.OrdinalIgnoreCase))
157-
{
158151
app.RequestedThemeVariant = ThemeVariant.Dark;
159-
}
160152
else
161-
{
162153
app.RequestedThemeVariant = ThemeVariant.Default;
163-
}
164154

165155
if (app._colorOverrides != null)
166156
{
@@ -173,6 +163,7 @@ public static void SetTheme(string theme, string colorsFile)
173163
try
174164
{
175165
var resDic = new ResourceDictionary();
166+
176167
var schema = JsonSerializer.Deserialize(File.ReadAllText(colorsFile), JsonCodeGen.Default.DictionaryStringString);
177168
foreach (var kv in schema)
178169
resDic[kv.Key] = Color.Parse(kv.Value);
@@ -191,9 +182,7 @@ public static async void CopyText(string data)
191182
if (Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
192183
{
193184
if (desktop.MainWindow.Clipboard is { } clipbord)
194-
{
195185
await clipbord.SetTextAsync(data);
196-
}
197186
}
198187
}
199188

src/ViewModels/AddRemote.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ public override Task<bool> Sure()
100100
{
101101
SetProgressDescription("Fetching from added remote ...");
102102
new Commands.Config(_repo.FullPath).Set($"remote.{_name}.sshkey", _useSSH ? SSHKey : null);
103-
104103
new Commands.Fetch(_repo.FullPath, _name, true, SetProgressDescription).Exec();
105104
}
106105
CallUIThread(() =>

src/Views/Preference.axaml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -161,27 +161,12 @@
161161
<ThemeVariant>Light</ThemeVariant>
162162
</ComboBox.Items>
163163
</ComboBox>
164-
165-
<TextBlock Grid.Row="1" Grid.Column="0"
166-
Text="{DynamicResource Text.Preference.Appearance.ColorOverrides}"
167-
HorizontalAlignment="Right"
168-
Margin="0,0,16,0"/>
169-
<TextBox Grid.Row="1" Grid.Column="1"
170-
Height="28"
171-
CornerRadius="3"
172-
Text="{Binding ColorOverrides, Mode=TwoWay}">
173-
<TextBox.InnerRightContent>
174-
<Button Classes="icon_button" Width="30" Height="30" Click="SelectColorSchemaFile">
175-
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
176-
</Button>
177-
</TextBox.InnerRightContent>
178-
</TextBox>
179164

180-
<TextBlock Grid.Row="2" Grid.Column="0"
165+
<TextBlock Grid.Row="1" Grid.Column="0"
181166
Text="{DynamicResource Text.Preference.Appearance.DefaultFont}"
182167
HorizontalAlignment="Right"
183168
Margin="0,0,16,0"/>
184-
<ComboBox Grid.Row="2" Grid.Column="1"
169+
<ComboBox Grid.Row="1" Grid.Column="1"
185170
MinHeight="28"
186171
Padding="8,0"
187172
HorizontalAlignment="Stretch"
@@ -196,11 +181,11 @@
196181
</ComboBox.ItemTemplate>
197182
</ComboBox>
198183

199-
<TextBlock Grid.Row="3" Grid.Column="0"
184+
<TextBlock Grid.Row="2" Grid.Column="0"
200185
Text="{DynamicResource Text.Preference.Appearance.MonospaceFont}"
201186
HorizontalAlignment="Right"
202187
Margin="0,0,16,0"/>
203-
<ComboBox Grid.Row="3" Grid.Column="1"
188+
<ComboBox Grid.Row="2" Grid.Column="1"
204189
MinHeight="28"
205190
Padding="8,0"
206191
HorizontalAlignment="Stretch"
@@ -215,11 +200,11 @@
215200
</ComboBox.ItemTemplate>
216201
</ComboBox>
217202

218-
<TextBlock Grid.Row="4" Grid.Column="0"
203+
<TextBlock Grid.Row="3" Grid.Column="0"
219204
Text="{DynamicResource Text.Preference.Appearance.DefaultFontSize}"
220205
HorizontalAlignment="Right"
221206
Margin="0,0,16,0"/>
222-
<NumericUpDown Grid.Row="4" Grid.Column="1"
207+
<NumericUpDown Grid.Row="3" Grid.Column="1"
223208
Minimum="10" Maximum="16" Increment="0.5"
224209
Height="28"
225210
Padding="4"
@@ -239,6 +224,21 @@
239224
</Style>
240225
</NumericUpDown.Styles>
241226
</NumericUpDown>
227+
228+
<TextBlock Grid.Row="4" Grid.Column="0"
229+
Text="{DynamicResource Text.Preference.Appearance.ColorOverrides}"
230+
HorizontalAlignment="Right"
231+
Margin="0,0,16,0"/>
232+
<TextBox Grid.Row="4" Grid.Column="1"
233+
Height="28"
234+
CornerRadius="3"
235+
Text="{Binding ColorOverrides, Mode=TwoWay}">
236+
<TextBox.InnerRightContent>
237+
<Button Classes="icon_button" Width="30" Height="30" Click="SelectColorSchemaFile">
238+
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
239+
</Button>
240+
</TextBox.InnerRightContent>
241+
</TextBox>
242242
</Grid>
243243
</TabItem>
244244

0 commit comments

Comments
 (0)