From ee43152de182f2033fbbc536271c9e605c7f0fe5 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 21 Jul 2020 14:40:44 +1000 Subject: [PATCH] save IconPath to settings for customisation --- .../SearchSource.cs | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSource.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSource.cs index 20d0dd5a4..3d548b6b1 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSource.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSource.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Windows.Media; using JetBrains.Annotations; using Newtonsoft.Json; @@ -16,11 +16,26 @@ namespace Flow.Launcher.Plugin.WebSearch public string Icon { get; set; } = DefaultIcon; /// - /// All icon should be put under Images directory + /// Default icons are placed in Images directory in the app location. + /// Custom icons are placed in the user data directory /// [NotNull] - [JsonIgnore] - internal string IconPath => Path.Combine(Main.ImagesDirectory, Icon); + public string IconPath + { + get + { + if (string.IsNullOrEmpty(iconPath)) + return Path.Combine(Main.ImagesDirectory, Icon); + + return iconPath; + } + set + { + iconPath = value; + } + } + + private string iconPath; [JsonIgnore] public ImageSource Image => ImageLoader.Load(IconPath);