From 1b81570338e530d3194be6c99347362d4620cb54 Mon Sep 17 00:00:00 2001 From: Itzik S Date: Mon, 24 Jun 2019 18:01:00 +0300 Subject: [PATCH 01/28] added build instructions for VS 2019 --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3612536468..7d8cd1008b 100644 --- a/README.md +++ b/README.md @@ -58,8 +58,17 @@ Build 1. Install Visual Studio 2015 and tick all Windows 10 sdk options 2. Open powershell with admin permission and `Set-ExecutionPolicy Unrestricted -Scope CurrentUser` +3. Building with VS 2019: + - Apparently last Windows 10 SDK which supported UwpDesktop is version 14393. + (see *https://github.com/Wox-launcher/Wox/pull/1827#commitcomment-26475392* ) + - This is needed to compile "Programs" Plugin (UWP.cs) + - If you use a later SDK version, you will see the "References" of Plugin.Programs as broken. + - However this SDK cannot be intsalled via installer of VS 2019. + - If you encounter problems building using VS 2019, then install above listed SDK using the installer of VS 2017. + - After that you can build using VS 2019. + Documentation ------------- - [Wiki](https://github.com/Wox-launcher/Wox/wiki) - Outdated doc: [WoX doc](http://doc.wox.one). -- Just ask questions in [issues](https://github.com/Wox-launcher/Wox/issues) for now. +- Just ask questions in [issues](https://github.com/Wox-launcher/Wox/issues) for now. \ No newline at end of file From 057108882f06185813faeb14f1c539c635ee9d32 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 1 Aug 2019 20:52:50 +1000 Subject: [PATCH 02/28] Open URL in new window browser --- Plugins/Wox.Plugin.Url/Main.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Wox.Plugin.Url/Main.cs b/Plugins/Wox.Plugin.Url/Main.cs index 6cd486919b..78cb13fac2 100644 --- a/Plugins/Wox.Plugin.Url/Main.cs +++ b/Plugins/Wox.Plugin.Url/Main.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Text.RegularExpressions; @@ -85,7 +85,7 @@ namespace Wox.Plugin.Url } else { - Process.Start(_settings.BrowserPath,raw); + Process.Start(_settings.BrowserPath,"--new-window" + raw); } return true; From 52252453d99249ae7da8eb1c2a8faa1f9ed5adf1 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 1 Aug 2019 20:55:13 +1000 Subject: [PATCH 03/28] Update WebSearch plugin as System Plugin or User Plugin --- Plugins/Wox.Plugin.WebSearch/Main.cs | 80 +++++++++++++++------------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/Plugins/Wox.Plugin.WebSearch/Main.cs b/Plugins/Wox.Plugin.WebSearch/Main.cs index 1581ddb334..ddb126d84d 100644 --- a/Plugins/Wox.Plugin.WebSearch/Main.cs +++ b/Plugins/Wox.Plugin.WebSearch/Main.cs @@ -23,6 +23,8 @@ namespace Wox.Plugin.WebSearch public const string Images = "Images"; public static string ImagesDirectory; + private readonly string SystemPluginSearchSourceWildCardSign = "*"; + public void Save() { _viewModel.Save(); @@ -33,49 +35,55 @@ namespace Wox.Plugin.WebSearch _updateSource?.Cancel(); _updateSource = new CancellationTokenSource(); _updateToken = _updateSource.Token; + + var searchSourceList = new List(); + + _settings.SearchSources.Where(o => (o.ActionKeyword == query.ActionKeyword || o.ActionKeyword == SystemPluginSearchSourceWildCardSign) + && o.Enabled) + .ToList() + .ForEach(x => searchSourceList.Add(x)); - SearchSource searchSource = - _settings.SearchSources.FirstOrDefault(o => o.ActionKeyword == query.ActionKeyword && o.Enabled); - - if (searchSource != null) + if (searchSourceList.Any()) { - string keyword = query.Search; - string title = keyword; - string subtitle = _context.API.GetTranslation("wox_plugin_websearch_search") + " " + searchSource.Title; - if (string.IsNullOrEmpty(keyword)) + foreach (SearchSource searchSource in searchSourceList) { - var result = new Result + string keyword = query.Search; + string title = keyword; + string subtitle = _context.API.GetTranslation("wox_plugin_websearch_search") + " " + + searchSource.Title; + if (string.IsNullOrEmpty(keyword)) { - Title = subtitle, - SubTitle = string.Empty, - IcoPath = searchSource.IconPath - }; - return new List {result}; - } - else - { - var results = new List(); - var result = new Result - { - Title = title, - SubTitle = subtitle, - Score = 6, - IcoPath = searchSource.IconPath, - Action = c => + var result = new Result { - Process.Start(searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword))); - return true; - } - }; - results.Add(result); - UpdateResultsFromSuggestion(results, keyword, subtitle, searchSource, query); - return results; + Title = subtitle, + SubTitle = string.Empty, + IcoPath = searchSource.IconPath + }; + return new List {result}; + } + else + { + var results = new List(); + var result = new Result + { + Title = title, + SubTitle = subtitle, + Score = 6, + IcoPath = searchSource.IconPath, + Action = c => + { + Process.Start(searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword))); + return true; + } + }; + results.Add(result); + UpdateResultsFromSuggestion(results, keyword, subtitle, searchSource, query); + return results; + } } } - else - { - return new List(); - } + + return new List(); } private void UpdateResultsFromSuggestion(List results, string keyword, string subtitle, From 89f0cdffc72a6aac432cbe9832beb093770a67e8 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 2 Aug 2019 12:32:02 +1000 Subject: [PATCH 04/28] Update Main.cs --- Plugins/Wox.Plugin.WebSearch/Main.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Wox.Plugin.WebSearch/Main.cs b/Plugins/Wox.Plugin.WebSearch/Main.cs index ddb126d84d..8340a326f8 100644 --- a/Plugins/Wox.Plugin.WebSearch/Main.cs +++ b/Plugins/Wox.Plugin.WebSearch/Main.cs @@ -23,7 +23,7 @@ namespace Wox.Plugin.WebSearch public const string Images = "Images"; public static string ImagesDirectory; - private readonly string SystemPluginSearchSourceWildCardSign = "*"; + private readonly string SearchSourceGlobalPluginWildCardSign = "*"; public void Save() { @@ -38,7 +38,7 @@ namespace Wox.Plugin.WebSearch var searchSourceList = new List(); - _settings.SearchSources.Where(o => (o.ActionKeyword == query.ActionKeyword || o.ActionKeyword == SystemPluginSearchSourceWildCardSign) + _settings.SearchSources.Where(o => (o.ActionKeyword == query.ActionKeyword || o.ActionKeyword == SearchSourceGlobalPluginWildCardSign) && o.Enabled) .ToList() .ForEach(x => searchSourceList.Add(x)); @@ -168,4 +168,4 @@ namespace Wox.Plugin.WebSearch public event ResultUpdatedEventHandler ResultsUpdated; } -} \ No newline at end of file +} From 977d21c929a4cc33b2fc947399ea74b9bc472684 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 2 Aug 2019 13:18:38 +1000 Subject: [PATCH 05/28] Bug fix- Edit & Delete buttons will crash if selected search source is null SelectedSearchSource will be null if the user clicks on Edit or Delete after finishing with previous edit and not highlighting the search source again. --- .../SettingsControl.xaml.cs | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Plugins/Wox.Plugin.WebSearch/SettingsControl.xaml.cs b/Plugins/Wox.Plugin.WebSearch/SettingsControl.xaml.cs index d50e595a89..6e210c0d3f 100644 --- a/Plugins/Wox.Plugin.WebSearch/SettingsControl.xaml.cs +++ b/Plugins/Wox.Plugin.WebSearch/SettingsControl.xaml.cs @@ -1,4 +1,4 @@ -using System.Windows; +using System.Windows; using System.Windows.Controls; using Wox.Core.Plugin; @@ -28,27 +28,33 @@ namespace Wox.Plugin.WebSearch private void OnDeleteSearchSearchClick(object sender, RoutedEventArgs e) { - var selected = _settings.SelectedSearchSource; - var warning = _context.API.GetTranslation("wox_plugin_websearch_delete_warning"); - var formated = string.Format(warning, selected.Title); - - var result = MessageBox.Show(formated, string.Empty, MessageBoxButton.YesNo); - if (result == MessageBoxResult.Yes) + if (_settings.SelectedSearchSource != null) { - var id = _context.CurrentPluginMetadata.ID; - PluginManager.RemoveActionKeyword(id, selected.ActionKeyword); - _settings.SearchSources.Remove(selected); + var selected = _settings.SelectedSearchSource; + var warning = _context.API.GetTranslation("wox_plugin_websearch_delete_warning"); + var formated = string.Format(warning, selected.Title); + + var result = MessageBox.Show(formated, string.Empty, MessageBoxButton.YesNo); + if (result == MessageBoxResult.Yes) + { + var id = _context.CurrentPluginMetadata.ID; + PluginManager.RemoveActionKeyword(id, selected.ActionKeyword); + _settings.SearchSources.Remove(selected); + } } } private void OnEditSearchSourceClick(object sender, RoutedEventArgs e) { - var selected = _settings.SelectedSearchSource; - var webSearch = new SearchSourceSettingWindow + if (_settings.SelectedSearchSource != null) + { + var webSearch = new SearchSourceSettingWindow ( - _settings.SearchSources, _context, selected + _settings.SearchSources, _context, _settings.SelectedSearchSource ); - webSearch.ShowDialog(); + + webSearch.ShowDialog(); + } } } -} \ No newline at end of file +} From e18e923ac6aeff795c0163c672758dbdc3b1e3a9 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 2 Aug 2019 22:14:08 +1000 Subject: [PATCH 06/28] Bugfix and update Fix bug when no browser path specified will be null instead of .Length == 0. Add open url in new browser window by default --- Plugins/Wox.Plugin.Url/Main.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Plugins/Wox.Plugin.Url/Main.cs b/Plugins/Wox.Plugin.Url/Main.cs index 78cb13fac2..c3229064e1 100644 --- a/Plugins/Wox.Plugin.Url/Main.cs +++ b/Plugins/Wox.Plugin.Url/Main.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; using System.Text.RegularExpressions; using System.Windows.Controls; using Wox.Infrastructure.Storage; @@ -79,14 +80,14 @@ namespace Wox.Plugin.Url } try { - if (_settings.BrowserPath.Length == 0) - { - Process.Start(raw); - } - else - { - Process.Start(_settings.BrowserPath,"--new-window" + raw); - } + var browserExecutableName = _settings.BrowserPath?.Split(new[] { System.IO.Path.DirectorySeparatorChar }, StringSplitOptions.None).Last(); + + var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : _settings.BrowserPath; + + // Internet Explorer will open url in new browser window, and does not take the --new-window parameter + var browserArguements = browserExecutableName == "iexplore.exe" ? raw : "--new-window " + raw; + + Process.Start(browser, browserArguements); return true; } From cb4fde9a0b45d9c4883536fac819c11b67fa6f7f Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 4 Aug 2019 11:42:08 +1000 Subject: [PATCH 07/28] Mini refactor Move Process.Start to static class level --- .../Commands/SearchWeb.cs | 27 +++++++++++++++++++ Plugins/Wox.Plugin.WebSearch/Main.cs | 6 +++-- .../Wox.Plugin.WebSearch.csproj | 1 + 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs diff --git a/Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs b/Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs new file mode 100644 index 0000000000..7c2cc31813 --- /dev/null +++ b/Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs @@ -0,0 +1,27 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; + +namespace Wox.Plugin.WebSearch.Commands +{ + internal static class SearchWeb + { + /// Opens search in a new browser. If no browser path is passed in then Chrome is used. + /// Leave browser path blank to use Chrome. + /// + internal static void NewBrowserWindow(this string url, string browserPath) + { + var browserExecutableName = browserPath? + .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) + .Last(); + + var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath; + + // Internet Explorer will open url in new browser window, and does not take the --new-window parameter + var browserArguements = browserExecutableName == "iexplore.exe" ? url : "--new-window " + url; + + Process.Start(browser, browserArguements); + } + } +} diff --git a/Plugins/Wox.Plugin.WebSearch/Main.cs b/Plugins/Wox.Plugin.WebSearch/Main.cs index 8340a326f8..28d0757613 100644 --- a/Plugins/Wox.Plugin.WebSearch/Main.cs +++ b/Plugins/Wox.Plugin.WebSearch/Main.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using System.Windows.Controls; using Wox.Infrastructure; using Wox.Infrastructure.Storage; +using Wox.Plugin.WebSearch.Commands; namespace Wox.Plugin.WebSearch { @@ -72,7 +73,8 @@ namespace Wox.Plugin.WebSearch IcoPath = searchSource.IconPath, Action = c => { - Process.Start(searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword))); + searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)).NewBrowserWindow(""); + return true; } }; @@ -123,7 +125,7 @@ namespace Wox.Plugin.WebSearch IcoPath = searchSource.IconPath, Action = c => { - Process.Start(searchSource.Url.Replace("{q}", Uri.EscapeDataString(o))); + searchSource.Url.Replace("{q}", Uri.EscapeDataString(o)).NewBrowserWindow(""); return true; } }); diff --git a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj index 858b6fd433..ae06a9f3c4 100644 --- a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj +++ b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj @@ -58,6 +58,7 @@ Properties\SolutionAssemblyInfo.cs + From 9d89c1d692127b0c5be252b483d714502a4887b2 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 4 Aug 2019 21:38:36 +1000 Subject: [PATCH 08/28] update --- Plugins/Wox.Plugin.WebSearch/Main.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Plugins/Wox.Plugin.WebSearch/Main.cs b/Plugins/Wox.Plugin.WebSearch/Main.cs index 28d0757613..1df937d564 100644 --- a/Plugins/Wox.Plugin.WebSearch/Main.cs +++ b/Plugins/Wox.Plugin.WebSearch/Main.cs @@ -33,12 +33,13 @@ namespace Wox.Plugin.WebSearch public List Query(Query query) { + var searchSourceList = new List(); + var results = new List(); + _updateSource?.Cancel(); _updateSource = new CancellationTokenSource(); _updateToken = _updateSource.Token; - var searchSourceList = new List(); - _settings.SearchSources.Where(o => (o.ActionKeyword == query.ActionKeyword || o.ActionKeyword == SearchSourceGlobalPluginWildCardSign) && o.Enabled) .ToList() @@ -60,11 +61,10 @@ namespace Wox.Plugin.WebSearch SubTitle = string.Empty, IcoPath = searchSource.IconPath }; - return new List {result}; + results.Add(result); } else { - var results = new List(); var result = new Result { Title = title, @@ -79,13 +79,12 @@ namespace Wox.Plugin.WebSearch } }; results.Add(result); - UpdateResultsFromSuggestion(results, keyword, subtitle, searchSource, query); - return results; + UpdateResultsFromSuggestion(results, keyword, subtitle, searchSource, query); } } } - return new List(); + return results; } private void UpdateResultsFromSuggestion(List results, string keyword, string subtitle, From 45483809c50ec35ce448d95a53348a51eff5bee3 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 4 Aug 2019 21:44:56 +1000 Subject: [PATCH 09/28] Update RemoveActionKeyword method Update the method to handle removal when a plugin has multiple ActionKeywords ie. mix of global and non-global ActionKeywords --- Wox.Core/Plugin/PluginManager.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Wox.Core/Plugin/PluginManager.cs b/Wox.Core/Plugin/PluginManager.cs index ecbf9e3905..97b260114e 100644 --- a/Wox.Core/Plugin/PluginManager.cs +++ b/Wox.Core/Plugin/PluginManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -289,14 +289,20 @@ namespace Wox.Core.Plugin public static void RemoveActionKeyword(string id, string oldActionkeyword) { var plugin = GetPluginForId(id); - if (oldActionkeyword == Query.GlobalPluginWildcardSign) + if (oldActionkeyword == Query.GlobalPluginWildcardSign + && // Plugins may have multiple ActionKeywords that are global, eg. WebSearch + plugin.Metadata.ActionKeywords + .Where(x => x == Query.GlobalPluginWildcardSign) + .ToList() + .Count == 1) { GlobalPlugins.Remove(plugin); } - else - { + + if(oldActionkeyword != Query.GlobalPluginWildcardSign) NonGlobalPlugins.Remove(oldActionkeyword); - } + + plugin.Metadata.ActionKeywords.Remove(oldActionkeyword); } From ef34a63f7a4416e1499e98fa32055262079f6f6d Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 4 Aug 2019 21:47:05 +1000 Subject: [PATCH 10/28] Update Initialisation of plugin method Handle when plugin has a mix of global and non-global action keywords --- Wox.Core/Plugin/PluginManager.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Wox.Core/Plugin/PluginManager.cs b/Wox.Core/Plugin/PluginManager.cs index 97b260114e..6ca826fd9b 100644 --- a/Wox.Core/Plugin/PluginManager.cs +++ b/Wox.Core/Plugin/PluginManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -106,16 +106,12 @@ namespace Wox.Core.Plugin foreach (var plugin in AllPlugins) { if (IsGlobalPlugin(plugin.Metadata)) - { GlobalPlugins.Add(plugin); - } - else - { - foreach (string actionKeyword in plugin.Metadata.ActionKeywords) - { - NonGlobalPlugins[actionKeyword] = plugin; - } - } + + // Plugins may have multiple ActionKeywords, eg. WebSearch + plugin.Metadata.ActionKeywords.Where(x => x != Query.GlobalPluginWildcardSign) + .ToList() + .ForEach(x => NonGlobalPlugins[x] = plugin); } } From 07060a8584bd862b1d18e4096b6418378959722b Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 6 Aug 2019 21:27:54 +1000 Subject: [PATCH 11/28] Add shared commands for plugins to use --- Wox.Plugin/SharedCommands/SearchWeb.cs | 27 ++++++++++++++++++++++++++ Wox.Plugin/Wox.Plugin.csproj | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 Wox.Plugin/SharedCommands/SearchWeb.cs diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs new file mode 100644 index 0000000000..7c2cc31813 --- /dev/null +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -0,0 +1,27 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; + +namespace Wox.Plugin.WebSearch.Commands +{ + internal static class SearchWeb + { + /// Opens search in a new browser. If no browser path is passed in then Chrome is used. + /// Leave browser path blank to use Chrome. + /// + internal static void NewBrowserWindow(this string url, string browserPath) + { + var browserExecutableName = browserPath? + .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) + .Last(); + + var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath; + + // Internet Explorer will open url in new browser window, and does not take the --new-window parameter + var browserArguements = browserExecutableName == "iexplore.exe" ? url : "--new-window " + url; + + Process.Start(browser, browserArguements); + } + } +} diff --git a/Wox.Plugin/Wox.Plugin.csproj b/Wox.Plugin/Wox.Plugin.csproj index 1acfef9491..8b1e9f0ca7 100644 --- a/Wox.Plugin/Wox.Plugin.csproj +++ b/Wox.Plugin/Wox.Plugin.csproj @@ -76,6 +76,7 @@ + @@ -84,6 +85,7 @@ + From 06d4a82706e832e03a64752fcda5fe960feb03e0 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 6 Aug 2019 21:49:51 +1000 Subject: [PATCH 12/28] Add shared commands and move to shared --- .../Commands/SearchWeb.cs | 27 ------------------- Plugins/Wox.Plugin.WebSearch/Main.cs | 2 +- .../Wox.Plugin.WebSearch.csproj | 1 - Wox.Plugin/SharedCommands/SearchWeb.cs | 6 ++--- 4 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs diff --git a/Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs b/Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs deleted file mode 100644 index 7c2cc31813..0000000000 --- a/Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Diagnostics; -using System.IO; -using System.Linq; - -namespace Wox.Plugin.WebSearch.Commands -{ - internal static class SearchWeb - { - /// Opens search in a new browser. If no browser path is passed in then Chrome is used. - /// Leave browser path blank to use Chrome. - /// - internal static void NewBrowserWindow(this string url, string browserPath) - { - var browserExecutableName = browserPath? - .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) - .Last(); - - var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath; - - // Internet Explorer will open url in new browser window, and does not take the --new-window parameter - var browserArguements = browserExecutableName == "iexplore.exe" ? url : "--new-window " + url; - - Process.Start(browser, browserArguements); - } - } -} diff --git a/Plugins/Wox.Plugin.WebSearch/Main.cs b/Plugins/Wox.Plugin.WebSearch/Main.cs index 1df937d564..ea7720329f 100644 --- a/Plugins/Wox.Plugin.WebSearch/Main.cs +++ b/Plugins/Wox.Plugin.WebSearch/Main.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using System.Windows.Controls; using Wox.Infrastructure; using Wox.Infrastructure.Storage; -using Wox.Plugin.WebSearch.Commands; +using Wox.Plugin.SharedCommands; namespace Wox.Plugin.WebSearch { diff --git a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj index ae06a9f3c4..858b6fd433 100644 --- a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj +++ b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj @@ -58,7 +58,6 @@ Properties\SolutionAssemblyInfo.cs - diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs index 7c2cc31813..0dc03ee6d5 100644 --- a/Wox.Plugin/SharedCommands/SearchWeb.cs +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -3,14 +3,14 @@ using System.Diagnostics; using System.IO; using System.Linq; -namespace Wox.Plugin.WebSearch.Commands +namespace Wox.Plugin.SharedCommands { - internal static class SearchWeb + public static class SearchWeb { /// Opens search in a new browser. If no browser path is passed in then Chrome is used. /// Leave browser path blank to use Chrome. /// - internal static void NewBrowserWindow(this string url, string browserPath) + public static void NewBrowserWindow(this string url, string browserPath) { var browserExecutableName = browserPath? .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) From 7d9e848edb23ec6dae5b3679f5d69e43cbc41afc Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 6 Aug 2019 21:58:46 +1000 Subject: [PATCH 13/28] use shared commands --- Plugins/Wox.Plugin.Url/Main.cs | 12 ++---------- Wox.Plugin/SharedCommands/SearchWeb.cs | 6 +++--- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Plugins/Wox.Plugin.Url/Main.cs b/Plugins/Wox.Plugin.Url/Main.cs index c3229064e1..1c3a708c84 100644 --- a/Plugins/Wox.Plugin.Url/Main.cs +++ b/Plugins/Wox.Plugin.Url/Main.cs @@ -1,10 +1,9 @@ using System; using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; using System.Text.RegularExpressions; using System.Windows.Controls; using Wox.Infrastructure.Storage; +using Wox.Plugin.SharedCommands; namespace Wox.Plugin.Url { @@ -80,15 +79,8 @@ namespace Wox.Plugin.Url } try { - var browserExecutableName = _settings.BrowserPath?.Split(new[] { System.IO.Path.DirectorySeparatorChar }, StringSplitOptions.None).Last(); - - var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : _settings.BrowserPath; + raw.NewBrowserWindow(_settings.BrowserPath); - // Internet Explorer will open url in new browser window, and does not take the --new-window parameter - var browserArguements = browserExecutableName == "iexplore.exe" ? raw : "--new-window " + raw; - - Process.Start(browser, browserArguements); - return true; } catch(Exception ex) diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs index 7c2cc31813..0dc03ee6d5 100644 --- a/Wox.Plugin/SharedCommands/SearchWeb.cs +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -3,14 +3,14 @@ using System.Diagnostics; using System.IO; using System.Linq; -namespace Wox.Plugin.WebSearch.Commands +namespace Wox.Plugin.SharedCommands { - internal static class SearchWeb + public static class SearchWeb { /// Opens search in a new browser. If no browser path is passed in then Chrome is used. /// Leave browser path blank to use Chrome. /// - internal static void NewBrowserWindow(this string url, string browserPath) + public static void NewBrowserWindow(this string url, string browserPath) { var browserExecutableName = browserPath? .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) From 2310d366047641c5e9834dc5b6cfb02da99b7e4e Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 6 Aug 2019 22:00:38 +1000 Subject: [PATCH 14/28] update --- Wox.Plugin/SharedCommands/SearchWeb.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs index 7c2cc31813..0dc03ee6d5 100644 --- a/Wox.Plugin/SharedCommands/SearchWeb.cs +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -3,14 +3,14 @@ using System.Diagnostics; using System.IO; using System.Linq; -namespace Wox.Plugin.WebSearch.Commands +namespace Wox.Plugin.SharedCommands { - internal static class SearchWeb + public static class SearchWeb { /// Opens search in a new browser. If no browser path is passed in then Chrome is used. /// Leave browser path blank to use Chrome. /// - internal static void NewBrowserWindow(this string url, string browserPath) + public static void NewBrowserWindow(this string url, string browserPath) { var browserExecutableName = browserPath? .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) From 585e2627bf6a1e92181a1692cf81dc2d65afceb6 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 6 Aug 2019 22:23:41 +1000 Subject: [PATCH 15/28] Use shared command and open in new browser window --- Plugins/Wox.Plugin.BrowserBookmark/Main.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/Wox.Plugin.BrowserBookmark/Main.cs b/Plugins/Wox.Plugin.BrowserBookmark/Main.cs index f0a595f2fb..23f1135a6f 100644 --- a/Plugins/Wox.Plugin.BrowserBookmark/Main.cs +++ b/Plugins/Wox.Plugin.BrowserBookmark/Main.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using Wox.Infrastructure; +using Wox.Plugin.SharedCommands; namespace Wox.Plugin.BrowserBookmark { @@ -54,7 +55,7 @@ namespace Wox.Plugin.BrowserBookmark Action = (e) => { context.API.HideApp(); - System.Diagnostics.Process.Start(c.Url); + c.Url.NewBrowserWindow(""); return true; } }).ToList(); From 1fa9543e4754ca5da4c643b3fc4d533526d21a2d Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 13 Aug 2019 20:02:26 +1000 Subject: [PATCH 16/28] Set AutoUpdates off as default setting --- Wox.Infrastructure/UserSettings/Settings.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Wox.Infrastructure/UserSettings/Settings.cs b/Wox.Infrastructure/UserSettings/Settings.cs index 8e72a24875..fc676d7838 100644 --- a/Wox.Infrastructure/UserSettings/Settings.cs +++ b/Wox.Infrastructure/UserSettings/Settings.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.ObjectModel; using System.Drawing; using Newtonsoft.Json; @@ -21,7 +21,7 @@ namespace Wox.Infrastructure.UserSettings public string ResultFontWeight { get; set; } public string ResultFontStretch { get; set; } - public bool AutoUpdates { get; set; } = true; + public bool AutoUpdates { get; set; } = false; public double WindowLeft { get; set; } public double WindowTop { get; set; } From 56bd31fe222418248ee2acff75bc94a91da1e0f9 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 20 Aug 2019 06:30:25 +1000 Subject: [PATCH 17/28] Update README.md build instructions for VS 2017/2019 --- README.md | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 7d8cd1008b..7d9ab639ce 100644 --- a/README.md +++ b/README.md @@ -55,20 +55,18 @@ Contribution Build ----- -1. Install Visual Studio 2015 and tick all Windows 10 sdk options -2. Open powershell with admin permission and `Set-ExecutionPolicy Unrestricted -Scope CurrentUser` +Install Visual Studio 2015/2017/2019 -3. Building with VS 2019: - - Apparently last Windows 10 SDK which supported UwpDesktop is version 14393. - (see *https://github.com/Wox-launcher/Wox/pull/1827#commitcomment-26475392* ) - - This is needed to compile "Programs" Plugin (UWP.cs) - - If you use a later SDK version, you will see the "References" of Plugin.Programs as broken. - - However this SDK cannot be intsalled via installer of VS 2019. - - If you encounter problems building using VS 2019, then install above listed SDK using the installer of VS 2017. - - After that you can build using VS 2019. +VS 2015: + - Tick all Windows 10 sdk options + +VS 2017/2019 and later: + - Last Windows 10 SDK which [supported](https://github.com/Wox-launcher/Wox/pull/1827#commitcomment-26475392) UwpDesktop is version 10.0.14393.795. It is needed to compile "Programs" Plugin (UWP.cs), you will see the "References" of Plugin.Programs as broken if you use a later SDK version. + - This SDK cannot be installed via VS 2019 installer. + - Download and install [Windows 10 SDK version 10.0.14393.795](https://go.microsoft.com/fwlink/p/?LinkId=838916). Documentation ------------- - [Wiki](https://github.com/Wox-launcher/Wox/wiki) - Outdated doc: [WoX doc](http://doc.wox.one). -- Just ask questions in [issues](https://github.com/Wox-launcher/Wox/issues) for now. \ No newline at end of file +- Just ask questions in [issues](https://github.com/Wox-launcher/Wox/issues) for now. From ec54f9a5490cf1efa8d57502567ece9009ea5589 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 20 Aug 2019 06:44:51 +1000 Subject: [PATCH 18/28] Update README.md build instructions for VS 2017/2019 --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7d9ab639ce..22a1a45d47 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,12 @@ Build Install Visual Studio 2015/2017/2019 -VS 2015: +This project requires Windows 10 SDK: + + VS 2015: - Tick all Windows 10 sdk options -VS 2017/2019 and later: + VS 2017/2019 and later: - Last Windows 10 SDK which [supported](https://github.com/Wox-launcher/Wox/pull/1827#commitcomment-26475392) UwpDesktop is version 10.0.14393.795. It is needed to compile "Programs" Plugin (UWP.cs), you will see the "References" of Plugin.Programs as broken if you use a later SDK version. - This SDK cannot be installed via VS 2019 installer. - Download and install [Windows 10 SDK version 10.0.14393.795](https://go.microsoft.com/fwlink/p/?LinkId=838916). From 6a33173384debdab67f11745fdf717927691cf7d Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 20 Aug 2019 21:29:30 +1000 Subject: [PATCH 19/28] Enable portable mode --- Wox.Infrastructure/Logger/Log.cs | 5 ++--- Wox.Infrastructure/Wox.cs | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Wox.Infrastructure/Logger/Log.cs b/Wox.Infrastructure/Logger/Log.cs index f7ea74b31c..dfa05c7154 100644 --- a/Wox.Infrastructure/Logger/Log.cs +++ b/Wox.Infrastructure/Logger/Log.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; using NLog; @@ -22,8 +22,7 @@ namespace Wox.Infrastructure.Logger var configuration = new LoggingConfiguration(); var target = new FileTarget(); configuration.AddTarget("file", target); - target.FileName = "${specialfolder:folder=ApplicationData}/" + Constant.Wox + "/" + DirectoryName + "/" + - Constant.Version + "/${shortdate}.txt"; + target.FileName = path.Replace(@"\", "/") + "/${shortdate}.txt"; #if DEBUG var rule = new LoggingRule("*", LogLevel.Debug, target); #else diff --git a/Wox.Infrastructure/Wox.cs b/Wox.Infrastructure/Wox.cs index 50107737b4..886c55b047 100644 --- a/Wox.Infrastructure/Wox.cs +++ b/Wox.Infrastructure/Wox.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.IO; using System.Reflection; @@ -7,13 +7,28 @@ namespace Wox.Infrastructure { public static class Constant { + public static string DetermineDataDirectory() + { + // use the method of VSCode to enable portable mode + // https://code.visualstudio.com/docs/editor/portable + string portableDataPath = Path.Combine(ProgramDirectory, "UserData"); + if (Directory.Exists(portableDataPath)) + { + return portableDataPath; + } + else + { + return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Wox); + } + } + public const string Wox = "Wox"; public const string Plugins = "Plugins"; private static readonly Assembly Assembly = Assembly.GetExecutingAssembly(); public static readonly string ProgramDirectory = Directory.GetParent(Assembly.Location.NonNull()).ToString(); public static readonly string ExecutablePath = Path.Combine(ProgramDirectory, Wox + ".exe"); - public static readonly string DataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Wox); + public static readonly string DataDirectory = DetermineDataDirectory(); public static readonly string PluginsDirectory = Path.Combine(DataDirectory, Plugins); public static readonly string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins); public const string Repository = "https://github.com/Wox-launcher/Wox"; From 7217ef5ec5bb2cb7d92a37d64eef48db667ad137 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 20 Aug 2019 21:43:32 +1000 Subject: [PATCH 20/28] Move comment to PR --- Wox.Infrastructure/Wox.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Wox.Infrastructure/Wox.cs b/Wox.Infrastructure/Wox.cs index 886c55b047..fbab671edc 100644 --- a/Wox.Infrastructure/Wox.cs +++ b/Wox.Infrastructure/Wox.cs @@ -9,8 +9,6 @@ namespace Wox.Infrastructure { public static string DetermineDataDirectory() { - // use the method of VSCode to enable portable mode - // https://code.visualstudio.com/docs/editor/portable string portableDataPath = Path.Combine(ProgramDirectory, "UserData"); if (Directory.Exists(portableDataPath)) { From fe6d7d16c8c272f65cab3e3dbf6307cefbd316a6 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 21 Aug 2019 08:30:18 +1000 Subject: [PATCH 21/28] Handling chrome browser not installed --- Wox.Plugin/SharedCommands/SearchWeb.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs index 0dc03ee6d5..853fca43dc 100644 --- a/Wox.Plugin/SharedCommands/SearchWeb.cs +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.IO; using System.Linq; @@ -21,7 +21,14 @@ namespace Wox.Plugin.SharedCommands // Internet Explorer will open url in new browser window, and does not take the --new-window parameter var browserArguements = browserExecutableName == "iexplore.exe" ? url : "--new-window " + url; - Process.Start(browser, browserArguements); + try + { + Process.Start(browser, browserArguements); + } + catch (System.ComponentModel.Win32Exception) + { + Process.Start(url); + } } } } From dedac39d994deed65e9879deb5c9af66cb36cca4 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 21 Aug 2019 08:37:50 +1000 Subject: [PATCH 22/28] Increase error message fade from 1 to 5 secs --- Wox/Msg.xaml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Wox/Msg.xaml.cs b/Wox/Msg.xaml.cs index 70cf320d44..df82edb124 100644 --- a/Wox/Msg.xaml.cs +++ b/Wox/Msg.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Windows; using System.Windows.Forms; @@ -30,7 +30,7 @@ namespace Wox // Create the fade out storyboard fadeOutStoryboard.Completed += fadeOutStoryboard_Completed; - DoubleAnimation fadeOutAnimation = new DoubleAnimation(dipWorkingArea.Y - Height, dipWorkingArea.Y, new Duration(TimeSpan.FromSeconds(1))) + DoubleAnimation fadeOutAnimation = new DoubleAnimation(dipWorkingArea.Y - Height, dipWorkingArea.Y, new Duration(TimeSpan.FromSeconds(5))) { AccelerationRatio = 0.2 }; From e625dc63b47233596d92995ed3e63dbdfe28d15d Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 21 Aug 2019 20:18:20 +1000 Subject: [PATCH 23/28] Fix typo 'success' --- Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs | 4 ++-- Wox.Core/Updater.cs | 2 +- Wox/ActionKeywords.xaml.cs | 2 +- Wox/CustomQueryHotkeySetting.xaml.cs | 4 ++-- Wox/HotkeyControl.xaml.cs | 2 +- Wox/Languages/da.xaml | 2 +- Wox/Languages/de.xaml | 2 +- Wox/Languages/en.xaml | 2 +- Wox/Languages/fr.xaml | 2 +- Wox/Languages/it.xaml | 2 +- Wox/Languages/ja.xaml | 2 +- Wox/Languages/ko.xaml | 2 +- Wox/Languages/nb-NO.xaml | 2 +- Wox/Languages/nl.xaml | 2 +- Wox/Languages/pl.xaml | 2 +- Wox/Languages/pt-br.xaml | 2 +- Wox/Languages/ru.xaml | 2 +- Wox/Languages/sk.xaml | 2 +- Wox/Languages/sr.xaml | 2 +- Wox/Languages/uk-UA.xaml | 2 +- Wox/Languages/zh-cn.xaml | 2 +- Wox/Languages/zh-tw.xaml | 2 +- Wox/ViewModel/MainViewModel.cs | 4 ++-- 23 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs b/Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs index 539b6d2c26..9bc31dd03f 100644 --- a/Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs +++ b/Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs @@ -83,7 +83,7 @@ namespace Wox.Plugin.WebSearch _searchSources.Add(_searchSource); - var info = _api.GetTranslation("succeed"); + var info = _api.GetTranslation("success"); MessageBox.Show(info); Close(); } @@ -106,7 +106,7 @@ namespace Wox.Plugin.WebSearch var index = _searchSources.IndexOf(_oldSearchSource); _searchSources[index] = _searchSource; - var info = _api.GetTranslation("succeed"); + var info = _api.GetTranslation("success"); MessageBox.Show(info); Close(); } diff --git a/Wox.Core/Updater.cs b/Wox.Core/Updater.cs index 050ccceb81..d2461baf4a 100644 --- a/Wox.Core/Updater.cs +++ b/Wox.Core/Updater.cs @@ -69,7 +69,7 @@ namespace Wox.Core var newVersionTips = Translater.GetTranslation("newVersionTips"); newVersionTips = string.Format(newVersionTips, fr.Version); MessageBox.Show(newVersionTips); - Log.Info($"|Updater.UpdateApp|Update succeed:{newVersionTips}"); + Log.Info($"|Updater.UpdateApp|Update success:{newVersionTips}"); } // always dispose UpdateManager diff --git a/Wox/ActionKeywords.xaml.cs b/Wox/ActionKeywords.xaml.cs index c86671c6ef..68024b1270 100644 --- a/Wox/ActionKeywords.xaml.cs +++ b/Wox/ActionKeywords.xaml.cs @@ -45,7 +45,7 @@ namespace Wox { var id = _plugin.Metadata.ID; PluginManager.ReplaceActionKeyword(id, oldActionKeyword, newActionKeyword); - MessageBox.Show(_translater.GetTranslation("succeed")); + MessageBox.Show(_translater.GetTranslation("success")); Close(); } else diff --git a/Wox/CustomQueryHotkeySetting.xaml.cs b/Wox/CustomQueryHotkeySetting.xaml.cs index 233c3b2b87..f5ce9cabf3 100644 --- a/Wox/CustomQueryHotkeySetting.xaml.cs +++ b/Wox/CustomQueryHotkeySetting.xaml.cs @@ -57,7 +57,7 @@ namespace Wox App.API.ChangeQuery(pluginHotkey.ActionKeyword); Application.Current.MainWindow.Visibility = Visibility.Visible; }); - MessageBox.Show(InternationalizationManager.Instance.GetTranslation("succeed")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("success")); } else { @@ -76,7 +76,7 @@ namespace Wox App.API.ChangeQuery(updateCustomHotkey.ActionKeyword); Application.Current.MainWindow.Visibility = Visibility.Visible; }); - MessageBox.Show(InternationalizationManager.Instance.GetTranslation("succeed")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("success")); } Close(); diff --git a/Wox/HotkeyControl.xaml.cs b/Wox/HotkeyControl.xaml.cs index fd7a1205e1..f2ba82a06c 100644 --- a/Wox/HotkeyControl.xaml.cs +++ b/Wox/HotkeyControl.xaml.cs @@ -78,7 +78,7 @@ namespace Wox else { tbMsg.Foreground = new SolidColorBrush(Colors.Green); - tbMsg.Text = InternationalizationManager.Instance.GetTranslation("succeed"); + tbMsg.Text = InternationalizationManager.Instance.GetTranslation("success"); } tbMsg.Visibility = Visibility.Visible; OnHotkeyChanged(); diff --git a/Wox/Languages/da.xaml b/Wox/Languages/da.xaml index 0d8b500d5c..f6b05597e5 100644 --- a/Wox/Languages/da.xaml +++ b/Wox/Languages/da.xaml @@ -91,7 +91,7 @@ Kan ikke finde det valgte plugin Nyt nøgleord må ikke være tomt Nyt nøgleord er tilknyttet et andet plugin, tilknyt venligst et andet nyt nøgeleord - Fortsæt + Fortsæt Brug * hvis du ikke vil angive et nøgleord diff --git a/Wox/Languages/de.xaml b/Wox/Languages/de.xaml index 270084ab29..3efa653e63 100644 --- a/Wox/Languages/de.xaml +++ b/Wox/Languages/de.xaml @@ -91,7 +91,7 @@ Kann das angegebene Plugin nicht finden Neues Aktionsschlüsselwort darf nicht leer sein Aktionsschlüsselwort ist schon bei einem anderen Plugin in verwendung. Bitte stellen Sie ein anderes Aktionsschlüsselwort ein. - Erfolgreich + Erfolgreich Benutzen Sie * wenn Sie ein Aktionsschlüsselwort definieren wollen. diff --git a/Wox/Languages/en.xaml b/Wox/Languages/en.xaml index 37f944d871..75654dbf9c 100644 --- a/Wox/Languages/en.xaml +++ b/Wox/Languages/en.xaml @@ -103,7 +103,7 @@ Can't find specified plugin New Action Keyword can't be empty New Action Keywords have been assigned to another plugin, please assign other new action keyword - Succeed + Success Use * if you don't want to specify an action keyword diff --git a/Wox/Languages/fr.xaml b/Wox/Languages/fr.xaml index 1e05ba6175..2f8ebc8fc7 100644 --- a/Wox/Languages/fr.xaml +++ b/Wox/Languages/fr.xaml @@ -97,7 +97,7 @@ Impossible de trouver le module spécifié Le nouveau mot-clé d'action doit être spécifié Le nouveau mot-clé d'action a été assigné à un autre module, veuillez en choisir un autre - Ajouté + Ajouté Saisissez * si vous ne souhaitez pas utiliser de mot-clé spécifique diff --git a/Wox/Languages/it.xaml b/Wox/Languages/it.xaml index a8c823aaeb..7696e9dc9e 100644 --- a/Wox/Languages/it.xaml +++ b/Wox/Languages/it.xaml @@ -100,7 +100,7 @@ Impossibile trovare il plugin specificato La nuova parola chiave d'azione non può essere vuota La nuova parola chiave d'azione è stata assegnata ad un altro plugin, per favore sceglierne una differente - Successo + Successo Usa * se non vuoi specificare una parola chiave d'azione diff --git a/Wox/Languages/ja.xaml b/Wox/Languages/ja.xaml index c5bd5a8858..d9a203a241 100644 --- a/Wox/Languages/ja.xaml +++ b/Wox/Languages/ja.xaml @@ -103,7 +103,7 @@ プラグインが見つかりません 新しいアクションキーボードを空にすることはできません 新しいアクションキーボードは他のプラグインに割り当てられています。他のアクションキーボードを指定してください - 成功しました + 成功しました アクションキーボードを指定しない場合、* を使用してください diff --git a/Wox/Languages/ko.xaml b/Wox/Languages/ko.xaml index 5a206622df..7810beec78 100644 --- a/Wox/Languages/ko.xaml +++ b/Wox/Languages/ko.xaml @@ -95,7 +95,7 @@ 플러그인을 찾을 수 없습니다. 새 액션 키워드를 입력하세요. 새 액션 키워드가 할당된 플러그인이 이미 있습니다. 다른 액션 키워드를 입력하세요. - 성공 + 성공 액션 키워드를 지정하지 않으려면 *를 사용하세요. diff --git a/Wox/Languages/nb-NO.xaml b/Wox/Languages/nb-NO.xaml index 778cb7db19..c7f294d932 100644 --- a/Wox/Languages/nb-NO.xaml +++ b/Wox/Languages/nb-NO.xaml @@ -100,7 +100,7 @@ Kan ikke finne den angitte utvidelsen Nytt handlingsnøkkelord kan ikke være tomt De nye handlingsnøkkelordene er tildelt en annen utvidelse, vennligst velg et annet nøkkelord - Vellykket + Vellykket Bruk * hvis du ikke ønsker å angi et handlingsnøkkelord diff --git a/Wox/Languages/nl.xaml b/Wox/Languages/nl.xaml index e81cdd585c..ffb77a7933 100644 --- a/Wox/Languages/nl.xaml +++ b/Wox/Languages/nl.xaml @@ -91,7 +91,7 @@ Kan plugin niet vinden Nieuwe actie sneltoets moet ingevuld worden Nieuwe actie sneltoets is toegewezen aan een andere plugin, wijs een nieuwe actie sneltoets aan - Succesvol + Succesvol Gebruik * wanneer je geen nieuwe actie sneltoets wilt specificeren diff --git a/Wox/Languages/pl.xaml b/Wox/Languages/pl.xaml index 6d1c226686..f6d638fbc8 100644 --- a/Wox/Languages/pl.xaml +++ b/Wox/Languages/pl.xaml @@ -91,7 +91,7 @@ Nie można odnaleźć podanej wtyczki Nowy wyzwalacz nie może być pusty Ten wyzwalacz został już przypisany do innej wtyczki, musisz podać inny wyzwalacz. - Sukces + Sukces Użyj * jeżeli nie chcesz podawać wyzwalacza diff --git a/Wox/Languages/pt-br.xaml b/Wox/Languages/pt-br.xaml index b1b2d0192c..bd4e70f242 100644 --- a/Wox/Languages/pt-br.xaml +++ b/Wox/Languages/pt-br.xaml @@ -100,7 +100,7 @@ Não foi possível encontrar o plugin especificado A nova palavra-chave da ação não pode ser vazia A nova palavra-chave da ação já foi atribuída a outro plugin, por favor tente outra - Sucesso + Sucesso Use * se não quiser especificar uma palavra-chave de ação diff --git a/Wox/Languages/ru.xaml b/Wox/Languages/ru.xaml index 32bee83f0d..945162b425 100644 --- a/Wox/Languages/ru.xaml +++ b/Wox/Languages/ru.xaml @@ -91,7 +91,7 @@ Не удалось найти заданный плагин Новая горячая клавиша не может быть пустой Новая горячая клавиша уже используется другим плагином. Пожалуйста, задайте новую - Сохранено + Сохранено Используйте * в случае, если вы не хотите задавать конкретную горячую клавишу diff --git a/Wox/Languages/sk.xaml b/Wox/Languages/sk.xaml index 08b84f2e25..7a7f083cac 100644 --- a/Wox/Languages/sk.xaml +++ b/Wox/Languages/sk.xaml @@ -101,7 +101,7 @@ Nepodarilo sa nájsť zadaný plugin Nová skratka pre akciu nemôže byť prázdna Nová skratka pre akciu bola priradená pre iný plugin, prosím, zvoľte inú skratku - Úspešné + Úspešné Použite * ak nechcete určiť skratku pre akciu diff --git a/Wox/Languages/sr.xaml b/Wox/Languages/sr.xaml index aa730d7740..dd8826e1c7 100644 --- a/Wox/Languages/sr.xaml +++ b/Wox/Languages/sr.xaml @@ -100,7 +100,7 @@ Navedeni plugin nije moguće pronaći Prečica za novu radnju ne može da bude prazna Prečica za novu radnju je dodeljena drugom plugin-u, molim Vas dodelite drugu prečicu - Uspešno + Uspešno Koristite * ako ne želite da navedete prečicu za radnju diff --git a/Wox/Languages/uk-UA.xaml b/Wox/Languages/uk-UA.xaml index 2e4d71f773..e114c2706d 100644 --- a/Wox/Languages/uk-UA.xaml +++ b/Wox/Languages/uk-UA.xaml @@ -91,7 +91,7 @@ Не вдалося знайти вказаний плагін Нова гаряча клавіша не може бути порожньою Нова гаряча клавіша вже використовується іншим плагіном. Будь ласка, вкажіть нову - Збережено + Збережено Використовуйте * у разі, якщо ви не хочете ставити конкретну гарячу клавішу diff --git a/Wox/Languages/zh-cn.xaml b/Wox/Languages/zh-cn.xaml index 5e9570d543..679040928c 100644 --- a/Wox/Languages/zh-cn.xaml +++ b/Wox/Languages/zh-cn.xaml @@ -98,7 +98,7 @@ 找不到指定的插件 新触发关键字不能为空 新触发关键字已经被指派给其他插件了,请重新选择一个关键字 - 成功 + 成功 如果你不想设置触发关键字,可以使用*代替 diff --git a/Wox/Languages/zh-tw.xaml b/Wox/Languages/zh-tw.xaml index b32c925cc1..9b26b0d067 100644 --- a/Wox/Languages/zh-tw.xaml +++ b/Wox/Languages/zh-tw.xaml @@ -91,7 +91,7 @@ 找不到指定的外掛 新觸發關鍵字不能為空白 新觸發關鍵字已經被指派給另一外掛,請設定其他關鍵字。 - 成功 + 成功 如果不想設定觸發關鍵字,可以使用*代替 diff --git a/Wox/ViewModel/MainViewModel.cs b/Wox/ViewModel/MainViewModel.cs index 1c1611704d..afee65f060 100644 --- a/Wox/ViewModel/MainViewModel.cs +++ b/Wox/ViewModel/MainViewModel.cs @@ -440,7 +440,7 @@ namespace Wox.ViewModel Action = _ => { _topMostRecord.Remove(result); - App.API.ShowMsg("Succeed"); + App.API.ShowMsg("Success"); return false; } }; @@ -455,7 +455,7 @@ namespace Wox.ViewModel Action = _ => { _topMostRecord.AddOrUpdate(result); - App.API.ShowMsg("Succeed"); + App.API.ShowMsg("Success"); return false; } }; From c0c55a7af87b503d0a34e027661a9ecee3a78f7c Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 22 Aug 2019 21:37:36 +1000 Subject: [PATCH 24/28] Add to Sys plugin- save all Wox settings --- Plugins/Wox.Plugin.Sys/Languages/en.xaml | 4 ++++ Plugins/Wox.Plugin.Sys/Main.cs | 12 ++++++++++++ Wox.Plugin/IPublicAPI.cs | 5 +++++ Wox/PublicAPIInstance.cs | 9 +++++++-- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Plugins/Wox.Plugin.Sys/Languages/en.xaml b/Plugins/Wox.Plugin.Sys/Languages/en.xaml index 0d3fb8e61f..daf616989c 100644 --- a/Plugins/Wox.Plugin.Sys/Languages/en.xaml +++ b/Plugins/Wox.Plugin.Sys/Languages/en.xaml @@ -5,16 +5,20 @@ Command Description + Save Settings + Shutdown Computer Restart Computer Log off Lock this computer Close Wox Restart Wox + Save all Wox settings Tweak this app Put computer to sleep Empty recycle bin + Successfully saved all Wox settings System Commands Provides System related commands. e.g. shutdown, lock, settings etc. diff --git a/Plugins/Wox.Plugin.Sys/Main.cs b/Plugins/Wox.Plugin.Sys/Main.cs index 1334034a3b..e9f1b6a271 100644 --- a/Plugins/Wox.Plugin.Sys/Main.cs +++ b/Plugins/Wox.Plugin.Sys/Main.cs @@ -168,6 +168,18 @@ namespace Wox.Plugin.Sys } }, new Result + { + Title = context.API.GetTranslation("wox_plugin_sys_save_command"), + SubTitle = context.API.GetTranslation("wox_plugin_sys_save"), + IcoPath = "Images\\app.png", + Action = c => + { + context.API.SaveAppAllSettings(); + context.API.ShowMsg(string.Format(context.API.GetTranslation("wox_plugin_sys_save_success"))); + return true; + } + }, + new Result { Title = "Restart Wox", SubTitle = context.API.GetTranslation("wox_plugin_sys_restart"), diff --git a/Wox.Plugin/IPublicAPI.cs b/Wox.Plugin/IPublicAPI.cs index c726c962a6..7dcac48440 100644 --- a/Wox.Plugin/IPublicAPI.cs +++ b/Wox.Plugin/IPublicAPI.cs @@ -57,6 +57,11 @@ namespace Wox.Plugin [Obsolete] void ShowApp(); + /// + /// Save all Wox settings + /// + void SaveAppAllSettings(); + /// /// Show message box /// diff --git a/Wox/PublicAPIInstance.cs b/Wox/PublicAPIInstance.cs index 748c7aac65..9c8e7008bd 100644 --- a/Wox/PublicAPIInstance.cs +++ b/Wox/PublicAPIInstance.cs @@ -59,13 +59,18 @@ namespace Wox // we must manually save // UpdateManager.RestartApp() will call Environment.Exit(0) // which will cause ungraceful exit + SaveAppAllSettings(); + + UpdateManager.RestartApp(); + } + + public void SaveAppAllSettings() + { _mainVM.Save(); _settingsVM.Save(); PluginManager.Save(); ImageLoader.Save(); Alphabet.Save(); - - UpdateManager.RestartApp(); } [Obsolete] From 16e8cfdf311e46c73111464f56ed97d9f6595445 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 22 Aug 2019 22:03:51 +1000 Subject: [PATCH 25/28] Revert get translation as none is provided --- Plugins/Wox.Plugin.Sys/Languages/en.xaml | 4 ---- Plugins/Wox.Plugin.Sys/Main.cs | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Plugins/Wox.Plugin.Sys/Languages/en.xaml b/Plugins/Wox.Plugin.Sys/Languages/en.xaml index daf616989c..0d3fb8e61f 100644 --- a/Plugins/Wox.Plugin.Sys/Languages/en.xaml +++ b/Plugins/Wox.Plugin.Sys/Languages/en.xaml @@ -5,20 +5,16 @@ Command Description - Save Settings - Shutdown Computer Restart Computer Log off Lock this computer Close Wox Restart Wox - Save all Wox settings Tweak this app Put computer to sleep Empty recycle bin - Successfully saved all Wox settings System Commands Provides System related commands. e.g. shutdown, lock, settings etc. diff --git a/Plugins/Wox.Plugin.Sys/Main.cs b/Plugins/Wox.Plugin.Sys/Main.cs index e9f1b6a271..b3a45bf1cf 100644 --- a/Plugins/Wox.Plugin.Sys/Main.cs +++ b/Plugins/Wox.Plugin.Sys/Main.cs @@ -169,13 +169,13 @@ namespace Wox.Plugin.Sys }, new Result { - Title = context.API.GetTranslation("wox_plugin_sys_save_command"), - SubTitle = context.API.GetTranslation("wox_plugin_sys_save"), + Title = "Save Settings", + SubTitle = "Save all Wox settings", IcoPath = "Images\\app.png", Action = c => { context.API.SaveAppAllSettings(); - context.API.ShowMsg(string.Format(context.API.GetTranslation("wox_plugin_sys_save_success"))); + context.API.ShowMsg(string.Format("Successfully saved all Wox settings")); return true; } }, From 768a195c10ac501b7cc46ad853ff5bfb37aededc Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 23 Aug 2019 07:20:50 +1000 Subject: [PATCH 26/28] update showmsg --- Plugins/Wox.Plugin.Sys/Main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Wox.Plugin.Sys/Main.cs b/Plugins/Wox.Plugin.Sys/Main.cs index b3a45bf1cf..7cb35c55f8 100644 --- a/Plugins/Wox.Plugin.Sys/Main.cs +++ b/Plugins/Wox.Plugin.Sys/Main.cs @@ -175,7 +175,7 @@ namespace Wox.Plugin.Sys Action = c => { context.API.SaveAppAllSettings(); - context.API.ShowMsg(string.Format("Successfully saved all Wox settings")); + context.API.ShowMsg("Success","All Wox settings saved"); return true; } }, From 83b4a3da3049717a7ba1c8ed2d4ad9580f001548 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 23 Aug 2019 07:38:39 +1000 Subject: [PATCH 27/28] Save all plugins' settings on settings menu close --- Wox/SettingWindow.xaml.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index fccfb97948..c041d7ddd3 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -318,6 +318,7 @@ namespace Wox private void OnClosed(object sender, EventArgs e) { _viewModel.Save(); + PluginManager.Save(); } private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e) From 909fbaab95774fc370412d44b8fe9223467ff1ea Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sat, 31 Aug 2019 16:58:15 +1000 Subject: [PATCH 28/28] Fix Result object comparison bug --- Wox.Plugin/Result.cs | 18 +++++++----------- Wox/ViewModel/ResultsViewModel.cs | 23 +++++++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Wox.Plugin/Result.cs b/Wox.Plugin/Result.cs index cdeabbdc24..88b8679f24 100644 --- a/Wox.Plugin/Result.cs +++ b/Wox.Plugin/Result.cs @@ -65,17 +65,13 @@ namespace Wox.Plugin public override bool Equals(object obj) { - Result r = obj as Result; - if (r != null) - { - var equality = string.Equals(r.Title, Title) && - string.Equals(r.SubTitle, SubTitle); - return equality; - } - else - { - return false; - } + var r = obj as Result; + + var equality = string.Equals(r?.Title, Title) && + string.Equals(r?.SubTitle, SubTitle) && + string.Equals(r?.IcoPath, IcoPath); + + return equality; } public override int GetHashCode() diff --git a/Wox/ViewModel/ResultsViewModel.cs b/Wox/ViewModel/ResultsViewModel.cs index a92b84930f..674923228e 100644 --- a/Wox/ViewModel/ResultsViewModel.cs +++ b/Wox/ViewModel/ResultsViewModel.cs @@ -148,25 +148,28 @@ namespace Wox.ViewModel private List NewResults(List newRawResults, string resultId) { - var newResults = newRawResults.Select(r => new ResultViewModel(r)).ToList(); var results = Results.ToList(); + var newResults = newRawResults.Select(r => new ResultViewModel(r)).ToList(); var oldResults = results.Where(r => r.Result.PluginID == resultId).ToList(); - // intersection of A (old results) and B (new newResults) - var intersection = oldResults.Intersect(newResults).ToList(); - + // Find the same results in A (old results) and B (new newResults) + var sameResults = oldResults + .Where(t1 => newResults.Any(x => x.Result.Equals(t1.Result))) + .Select(t1 => t1) + .ToList(); + // remove result of relative complement of B in A - foreach (var result in oldResults.Except(intersection)) + foreach (var result in oldResults.Except(sameResults)) { results.Remove(result); } - // update index for result in intersection of A and B - foreach (var commonResult in intersection) + // update result with B's score and index position + foreach (var sameResult in sameResults) { - int oldIndex = results.IndexOf(commonResult); + int oldIndex = results.IndexOf(sameResult); int oldScore = results[oldIndex].Result.Score; - var newResult = newResults[newResults.IndexOf(commonResult)]; + var newResult = newResults[newResults.IndexOf(sameResult)]; int newScore = newResult.Result.Score; if (newScore != oldScore) { @@ -182,7 +185,7 @@ namespace Wox.ViewModel } // insert result in relative complement of A in B - foreach (var result in newResults.Except(intersection)) + foreach (var result in newResults.Except(sameResults)) { int newIndex = InsertIndexOf(result.Result.Score, results); results.Insert(newIndex, result);