Skip to content

Commit da77085

Browse files
committed
Fix logic & Improve code quality
1 parent 204d1d2 commit da77085

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,7 @@ private async void btnProgramSourceStatus_OnClick(object sender, RoutedEventArgs
298298

299299
if (selectedItems.Count == 0)
300300
{
301-
var msg = context.API.GetTranslation("flowlauncher_plugin_program_pls_select_program_source");
302-
context.API.ShowMsgBox(msg);
303-
return;
304-
}
305-
306-
if (IsAllItemsUserAdded(selectedItems))
307-
{
308-
var msg1 = context.API.GetTranslation("flowlauncher_plugin_program_delete_program_source_select_not_user_added");
309-
context.API.ShowMsgBox(msg1);
301+
context.API.ShowMsgBox(context.API.GetTranslation("flowlauncher_plugin_program_pls_select_program_source"));
310302
return;
311303
}
312304

@@ -376,7 +368,7 @@ private void Sort(string sortBy, ListSortDirection direction)
376368
var dataView = CollectionViewSource.GetDefaultView(programSourceView.ItemsSource);
377369

378370
dataView.SortDescriptions.Clear();
379-
SortDescription sd = new SortDescription(sortBy, direction);
371+
var sd = new SortDescription(sortBy, direction);
380372
dataView.SortDescriptions.Add(sd);
381373
dataView.Refresh();
382374
}
@@ -421,20 +413,18 @@ private async void btnDeleteProgramSource_OnClick(object sender, RoutedEventArgs
421413

422414
if (selectedItems.Count == 0)
423415
{
424-
var msg = context.API.GetTranslation("flowlauncher_plugin_program_pls_select_program_source");
425-
context.API.ShowMsgBox(msg);
416+
context.API.ShowMsgBox(context.API.GetTranslation("flowlauncher_plugin_program_pls_select_program_source"));
426417
return;
427418
}
428419

429420
if (!IsAllItemsUserAdded(selectedItems))
430421
{
431-
var msg1 = context.API.GetTranslation("flowlauncher_plugin_program_delete_program_source_select_user_added");
432-
context.API.ShowMsgBox(msg1);
422+
context.API.ShowMsgBox(context.API.GetTranslation("flowlauncher_plugin_program_delete_program_source_select_user_added"));
433423
return;
434424
}
435425

436-
var msg2 = context.API.GetTranslation("flowlauncher_plugin_program_delete_program_source");
437-
if (context.API.ShowMsgBox(msg2, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
426+
if (context.API.ShowMsgBox(context.API.GetTranslation("flowlauncher_plugin_program_delete_program_source"),
427+
string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
438428
{
439429
return;
440430
}

0 commit comments

Comments
 (0)