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(); diff --git a/Plugins/Wox.Plugin.Sys/Main.cs b/Plugins/Wox.Plugin.Sys/Main.cs index 1334034a3b..7cb35c55f8 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 = "Save Settings", + SubTitle = "Save all Wox settings", + IcoPath = "Images\\app.png", + Action = c => + { + context.API.SaveAppAllSettings(); + context.API.ShowMsg("Success","All Wox settings saved"); + return true; + } + }, + new Result { Title = "Restart Wox", SubTitle = context.API.GetTranslation("wox_plugin_sys_restart"), diff --git a/Plugins/Wox.Plugin.Url/Main.cs b/Plugins/Wox.Plugin.Url/Main.cs index 6cd486919b..1c3a708c84 100644 --- a/Plugins/Wox.Plugin.Url/Main.cs +++ b/Plugins/Wox.Plugin.Url/Main.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.Collections.Generic; -using System.Diagnostics; using System.Text.RegularExpressions; using System.Windows.Controls; using Wox.Infrastructure.Storage; +using Wox.Plugin.SharedCommands; namespace Wox.Plugin.Url { @@ -79,15 +79,8 @@ namespace Wox.Plugin.Url } try { - if (_settings.BrowserPath.Length == 0) - { - Process.Start(raw); - } - else - { - Process.Start(_settings.BrowserPath,raw); - } - + raw.NewBrowserWindow(_settings.BrowserPath); + return true; } catch(Exception ex) diff --git a/Plugins/Wox.Plugin.WebSearch/Main.cs b/Plugins/Wox.Plugin.WebSearch/Main.cs index a89c110d01..c322a9a1f1 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.SharedCommands; namespace Wox.Plugin.WebSearch { @@ -23,6 +24,8 @@ namespace Wox.Plugin.WebSearch public const string Images = "Images"; public static string ImagesDirectory; + private readonly string SearchSourceGlobalPluginWildCardSign = "*"; + public void Save() { _viewModel.Save(); @@ -30,59 +33,65 @@ 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; + + _settings.SearchSources.Where(o => (o.ActionKeyword == query.ActionKeyword || o.ActionKeyword == SearchSourceGlobalPluginWildCardSign) + && 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); - ResultsUpdated?.Invoke(this, new ResultUpdatedEventArgs + Title = subtitle, + SubTitle = string.Empty, + IcoPath = searchSource.IconPath + }; + results.Add(result); + } + else { - Results = results, - Query = query - }); - UpdateResultsFromSuggestion(results, keyword, subtitle, searchSource, query); + var result = new Result + { + Title = title, + SubTitle = subtitle, + Score = 6, + IcoPath = searchSource.IconPath, + Action = c => + { + searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)).NewBrowserWindow(""); - return results; + return true; + } + }; + + results.Add(result); + ResultsUpdated?.Invoke(this, new ResultUpdatedEventArgs + { + Results = results, + Query = query + }); + + UpdateResultsFromSuggestion(results, keyword, subtitle, searchSource, query); + } } } - else - { - return new List(); - } + + return results; } private void UpdateResultsFromSuggestion(List results, string keyword, string subtitle, @@ -122,7 +131,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; } }); @@ -167,4 +176,4 @@ namespace Wox.Plugin.WebSearch public event ResultUpdatedEventHandler ResultsUpdated; } -} \ No newline at end of file +} 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/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 +} diff --git a/README.md b/README.md index 3612536468..22a1a45d47 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,17 @@ 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 + +This project requires Windows 10 SDK: + + 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 ------------- diff --git a/Wox.Core/Plugin/PluginManager.cs b/Wox.Core/Plugin/PluginManager.cs index ecbf9e3905..6ca826fd9b 100644 --- a/Wox.Core/Plugin/PluginManager.cs +++ b/Wox.Core/Plugin/PluginManager.cs @@ -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); } } @@ -289,14 +285,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); } 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.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/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; } diff --git a/Wox.Infrastructure/Wox.cs b/Wox.Infrastructure/Wox.cs index 50107737b4..fbab671edc 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,26 @@ namespace Wox.Infrastructure { public static class Constant { + public static string DetermineDataDirectory() + { + 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"; 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.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.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs new file mode 100644 index 0000000000..853fca43dc --- /dev/null +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -0,0 +1,34 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; + +namespace Wox.Plugin.SharedCommands +{ + 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. + /// + public 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; + + try + { + Process.Start(browser, browserArguements); + } + catch (System.ComponentModel.Win32Exception) + { + Process.Start(url); + } + } + } +} 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 @@ + 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/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 }; 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] 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) 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; } }; 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);