From 84b1c26369da18326d7877c525463de73c6441d8 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Sat, 22 Oct 2022 00:28:17 +0800 Subject: [PATCH] Fix image file usage See https://github.com/microsoft/PowerToys/pull/5109 --- Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs index b2008c178..948e9b437 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs @@ -18,7 +18,6 @@ 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; using System.Threading.Channels; namespace Flow.Launcher.Plugin.Program.Programs @@ -688,9 +687,14 @@ namespace Flow.Launcher.Plugin.Program.Programs private BitmapImage ImageFromPath(string path) { + // TODO: Consider using infrastructure.image.imageloader? if (File.Exists(path)) { - var image = new BitmapImage(new Uri(path)); + var image = new BitmapImage(); + image.BeginInit(); + image.UriSource = new Uri(path); + image.CacheOption = BitmapCacheOption.OnLoad; + image.EndInit(); return image; } else