minor changes

This commit is contained in:
Vic 2022-10-30 01:27:41 +08:00
parent cc7d2bc855
commit 0b247db1b2
4 changed files with 8 additions and 14 deletions

View file

@ -99,7 +99,7 @@ namespace Flow.Launcher.Plugin.Program
var b = Task.Run(() =>
{
Stopwatch.Normal("|Flow.Launcher.Plugin.Program.Main|Win32Program index cost", IndexUwpPrograms);
Stopwatch.Normal("|Flow.Launcher.Plugin.Program.Main|UWPProgram index cost", IndexUwpPrograms);
});
if (cacheEmpty)

View file

@ -41,13 +41,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
FullName = package.Id.FullName;
FamilyName = package.Id.FamilyName;
InitializeAppInfo();
Apps = Apps.Where(a =>
{
var valid =
!string.IsNullOrEmpty(a.UserModelId) &&
!string.IsNullOrEmpty(a.DisplayName);
return valid;
}).ToArray();
Apps = Apps.Where(a => !string.IsNullOrEmpty(a.UserModelId) && !string.IsNullOrEmpty(a.DisplayName))
.ToArray();
}
private void InitializeAppInfo()
@ -80,7 +75,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
ProgramLogger.LogException($"|UWP|InitializeAppInfo|{path}" +
"|Error caused while trying to get the details of the UWP program", e);
Apps = new List<Application>().ToArray();
Apps = Array.Empty<Application>();
}
if (stream != null && Marshal.ReleaseComObject(stream) > 0)

View file

@ -496,7 +496,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
if (temp.Any())
return DistinctBy(temp, x => x.Description);
return g.Take(1);
}).ToArray();
});
}

View file

@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@ -224,7 +223,7 @@ namespace Flow.Launcher.Plugin.Program.Views
}
}
if (directoriesToAdd.Count() > 0)
if (directoriesToAdd.Count > 0)
{
directoriesToAdd.ForEach(x => _settings.ProgramSources.Add(x));
directoriesToAdd.ForEach(x => ProgramSettingDisplayList.Add(x));
@ -347,8 +346,8 @@ namespace Flow.Launcher.Plugin.Program.Views
private void programSourceView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var selectedItems = programSourceView
.SelectedItems.Cast<ProgramSource>()
.ToList();
.SelectedItems.Cast<ProgramSource>()
.ToList();
if (IsAllItemsUserAdded(selectedItems))
{