From 4351080aea99ac6b5bfec91848f6fff519389623 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Mon, 9 Nov 2015 03:56:56 +0000 Subject: [PATCH] Fix icon path for Web Search plugin --- .../WebSearchSetting.xaml.cs | 19 +++---------------- .../Wox.Plugin.WebSearch/WebSearchStorage.cs | 6 +++--- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/Plugins/Wox.Plugin.WebSearch/WebSearchSetting.xaml.cs b/Plugins/Wox.Plugin.WebSearch/WebSearchSetting.xaml.cs index 012e2b8d80..1c85340f67 100644 --- a/Plugins/Wox.Plugin.WebSearch/WebSearchSetting.xaml.cs +++ b/Plugins/Wox.Plugin.WebSearch/WebSearchSetting.xaml.cs @@ -50,13 +50,7 @@ namespace Wox.Plugin.WebSearch private void ShowIcon(string path) { - try - { - imgIcon.Source = new BitmapImage(new Uri(path, UriKind.Relative)); - } - catch (Exception) - { - } + imgIcon.Source = new BitmapImage(new Uri($"{_defaultWebSearchImageDirectory}\\{path}", UriKind.Absolute)); } private void BtnCancel_OnClick(object sender, RoutedEventArgs e) @@ -86,13 +80,6 @@ namespace Wox.Plugin.WebSearch } string newActionKeyword = tbActionword.Text.Trim(); - if (string.IsNullOrEmpty(newActionKeyword)) - { - string warning = _context.API.GetTranslation("wox_plugin_websearch_input_action_keyword"); - MessageBox.Show(warning); - return; - } - if (_isUpdate) { try @@ -155,8 +142,8 @@ namespace Wox.Plugin.WebSearch if (result == true) { string filename = dlg.FileName; - tbIconPath.Text = filename; - ShowIcon(filename); + tbIconPath.Text = Path.GetFileName(filename); + ShowIcon(tbIconPath.Text); } } } diff --git a/Plugins/Wox.Plugin.WebSearch/WebSearchStorage.cs b/Plugins/Wox.Plugin.WebSearch/WebSearchStorage.cs index db5d0616bd..2f6d92435a 100644 --- a/Plugins/Wox.Plugin.WebSearch/WebSearchStorage.cs +++ b/Plugins/Wox.Plugin.WebSearch/WebSearchStorage.cs @@ -41,7 +41,7 @@ namespace Wox.Plugin.WebSearch { Title = "Google", ActionKeyword = "g", - IconPath = @"Images\websearch\google.png", + IconPath = @"google.png", Url = "https://www.google.com/search?q={q}", Enabled = true }; @@ -52,7 +52,7 @@ namespace Wox.Plugin.WebSearch { Title = "Wikipedia", ActionKeyword = "wiki", - IconPath = @"Images\websearch\wiki.png", + IconPath = @"wiki.png", Url = "http://en.wikipedia.org/wiki/{q}", Enabled = true }; @@ -62,7 +62,7 @@ namespace Wox.Plugin.WebSearch { Title = "FindIcon", ActionKeyword = "findicon", - IconPath = @"Images\websearch\pictures.png", + IconPath = @"pictures.png", Url = "http://findicons.com/search/{q}", Enabled = true };