detect windows version

This commit is contained in:
Hongtao Zhang 2022-01-08 16:03:53 -06:00
parent 73056534bb
commit 9fc0e03b3d
2 changed files with 8 additions and 6 deletions

View file

@ -128,7 +128,7 @@ namespace Flow.Launcher.Plugin.Program
await indexTask;
Win32.WatchProgramUpdate(_settings);
UWP.WatchUWPInstallation();
UWP.WatchPackageChange();
}
public static void IndexWin32Programs()

View file

@ -18,6 +18,7 @@ using Flow.Launcher.Plugin.Program.Logger;
using Rect = System.Windows.Rect;
using Flow.Launcher.Plugin.SharedModels;
using Flow.Launcher.Infrastructure.Logger;
using System.Runtime.Versioning;
namespace Flow.Launcher.Plugin.Program.Programs
{
@ -251,12 +252,13 @@ namespace Flow.Launcher.Plugin.Program.Programs
watcher.EnableRaisingEvents = true;
}
public static void WatchUWPInstallation()
public static void WatchPackageChange()
{
PackageCatalog.OpenForCurrentUser().PackageStatusChanged += (_, _) =>
{
Task.Delay(10000).ContinueWith(t => Main.IndexUwpPrograms());
};
if (Environment.OSVersion.Version.Build >= 19041)
PackageCatalog.OpenForCurrentUser().PackageStatusChanged += (_, _) =>
{
Task.Delay(10000).ContinueWith(t => Main.IndexUwpPrograms());
};
}
public override string ToString()