Skip to content

Commit 782c11c

Browse files
Jack251970Yusyuriv
andcommitted
Update Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
Co-authored-by: Yan Li <[email protected]>
1 parent 13fcdc6 commit 782c11c

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ public async Task InitializeAsync()
5757
}
5858
}
5959

60-
if (Configuration == null)
61-
{
62-
return;
63-
}
60+
if (Configuration == null) return;
6461

6562
foreach (var (type, attributes) in Configuration.Body)
6663
{
@@ -87,10 +84,7 @@ public async Task InitializeAsync()
8784

8885
public void UpdateSettings(IReadOnlyDictionary<string, object> settings)
8986
{
90-
if (settings == null || settings.Count == 0)
91-
{
92-
return;
93-
}
87+
if (settings == null || settings.Count == 0) return;
9488

9589
foreach (var (key, value) in settings)
9690
{
@@ -117,8 +111,7 @@ public void UpdateSettings(IReadOnlyDictionary<string, object> settings)
117111
// If can parse the default value to bool, use it, otherwise use false
118112
: value is string stringValue && bool.TryParse(stringValue, out var boolValueFromString)
119113
&& boolValueFromString;
120-
checkBox.Dispatcher.Invoke(() =>
121-
checkBox.IsChecked = isChecked);
114+
checkBox.Dispatcher.Invoke(() =>checkBox.IsChecked = isChecked);
122115
break;
123116
}
124117
}
@@ -164,10 +157,7 @@ public Control CreateSettingPanel()
164157
foreach (var (type, attributes) in Configuration!.Body)
165158
{
166159
// Skip if the setting does not have attributes or name
167-
if (attributes?.Name == null)
168-
{
169-
continue;
170-
}
160+
if (attributes?.Name == null) continue;
171161

172162
// Add a new row to the main grid
173163
mainPanel.RowDefinitions.Add(new RowDefinition()
@@ -214,10 +204,7 @@ public Control CreateSettingPanel()
214204

215205
// Add the name and description to the panel
216206
panel.Children.Add(name);
217-
if (desc != null)
218-
{
219-
panel.Children.Add(desc);
220-
}
207+
if (desc != null) panel.Children.Add(desc);
221208
}
222209

223210
switch (type)
@@ -481,10 +468,7 @@ Settings[attributes.Name] is bool isChecked
481468
}
482469

483470
// Add into SettingControls for settings storage if need
484-
if (NeedSaveInSettings(type))
485-
{
486-
SettingControls[attributes.Name] = contentControl;
487-
}
471+
if (NeedSaveInSettings(type)) SettingControls[attributes.Name] = contentControl;
488472

489473
rowCount++;
490474
}

0 commit comments

Comments
 (0)