Merge branch 'master' into update_websearch_when_suggestions_on

This commit is contained in:
Jeremy Wu
2019-09-22 18:25:53 +10:00
41 changed files with 233 additions and 143 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Wox.Infrastructure; using Wox.Infrastructure;
using Wox.Plugin.SharedCommands;
namespace Wox.Plugin.BrowserBookmark namespace Wox.Plugin.BrowserBookmark
{ {
@@ -54,7 +55,7 @@ namespace Wox.Plugin.BrowserBookmark
Action = (e) => Action = (e) =>
{ {
context.API.HideApp(); context.API.HideApp();
System.Diagnostics.Process.Start(c.Url); c.Url.NewBrowserWindow("");
return true; return true;
} }
}).ToList(); }).ToList();

View File

@@ -168,6 +168,18 @@ namespace Wox.Plugin.Sys
} }
}, },
new Result 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", Title = "Restart Wox",
SubTitle = context.API.GetTranslation("wox_plugin_sys_restart"), SubTitle = context.API.GetTranslation("wox_plugin_sys_restart"),

View File

@@ -1,9 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Controls; using System.Windows.Controls;
using Wox.Infrastructure.Storage; using Wox.Infrastructure.Storage;
using Wox.Plugin.SharedCommands;
namespace Wox.Plugin.Url namespace Wox.Plugin.Url
{ {
@@ -79,14 +79,7 @@ namespace Wox.Plugin.Url
} }
try try
{ {
if (_settings.BrowserPath.Length == 0) raw.NewBrowserWindow(_settings.BrowserPath);
{
Process.Start(raw);
}
else
{
Process.Start(_settings.BrowserPath,raw);
}
return true; return true;
} }

View File

@@ -8,6 +8,7 @@ using System.Threading.Tasks;
using System.Windows.Controls; using System.Windows.Controls;
using Wox.Infrastructure; using Wox.Infrastructure;
using Wox.Infrastructure.Storage; using Wox.Infrastructure.Storage;
using Wox.Plugin.SharedCommands;
namespace Wox.Plugin.WebSearch namespace Wox.Plugin.WebSearch
{ {
@@ -23,6 +24,8 @@ namespace Wox.Plugin.WebSearch
public const string Images = "Images"; public const string Images = "Images";
public static string ImagesDirectory; public static string ImagesDirectory;
private readonly string SearchSourceGlobalPluginWildCardSign = "*";
public void Save() public void Save()
{ {
_viewModel.Save(); _viewModel.Save();
@@ -30,59 +33,65 @@ namespace Wox.Plugin.WebSearch
public List<Result> Query(Query query) public List<Result> Query(Query query)
{ {
var searchSourceList = new List<SearchSource>();
var results = new List<Result>();
_updateSource?.Cancel(); _updateSource?.Cancel();
_updateSource = new CancellationTokenSource(); _updateSource = new CancellationTokenSource();
_updateToken = _updateSource.Token; _updateToken = _updateSource.Token;
SearchSource searchSource = _settings.SearchSources.Where(o => (o.ActionKeyword == query.ActionKeyword || o.ActionKeyword == SearchSourceGlobalPluginWildCardSign)
_settings.SearchSources.FirstOrDefault(o => o.ActionKeyword == query.ActionKeyword && o.Enabled); && o.Enabled)
.ToList()
.ForEach(x => searchSourceList.Add(x));
if (searchSource != null) if (searchSourceList.Any())
{ {
string keyword = query.Search; foreach (SearchSource searchSource in searchSourceList)
string title = keyword;
string subtitle = _context.API.GetTranslation("wox_plugin_websearch_search") + " " + searchSource.Title;
if (string.IsNullOrEmpty(keyword))
{ {
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, var result = new Result
SubTitle = string.Empty,
IcoPath = searchSource.IconPath
};
return new List<Result> {result};
}
else
{
var results = new List<Result>();
var result = new Result
{
Title = title,
SubTitle = subtitle,
Score = 6,
IcoPath = searchSource.IconPath,
Action = c =>
{ {
Process.Start(searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword))); Title = subtitle,
return true; SubTitle = string.Empty,
} IcoPath = searchSource.IconPath
}; };
results.Add(result);
results.Add(result); }
ResultsUpdated?.Invoke(this, new ResultUpdatedEventArgs else
{ {
Results = results, var result = new Result
Query = query {
}); Title = title,
UpdateResultsFromSuggestion(results, keyword, subtitle, searchSource, query); 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 results;
return new List<Result>();
}
} }
private void UpdateResultsFromSuggestion(List<Result> results, string keyword, string subtitle, private void UpdateResultsFromSuggestion(List<Result> results, string keyword, string subtitle,
@@ -122,7 +131,7 @@ namespace Wox.Plugin.WebSearch
IcoPath = searchSource.IconPath, IcoPath = searchSource.IconPath,
Action = c => Action = c =>
{ {
Process.Start(searchSource.Url.Replace("{q}", Uri.EscapeDataString(o))); searchSource.Url.Replace("{q}", Uri.EscapeDataString(o)).NewBrowserWindow("");
return true; return true;
} }
}); });

View File

@@ -83,7 +83,7 @@ namespace Wox.Plugin.WebSearch
_searchSources.Add(_searchSource); _searchSources.Add(_searchSource);
var info = _api.GetTranslation("succeed"); var info = _api.GetTranslation("success");
MessageBox.Show(info); MessageBox.Show(info);
Close(); Close();
} }
@@ -106,7 +106,7 @@ namespace Wox.Plugin.WebSearch
var index = _searchSources.IndexOf(_oldSearchSource); var index = _searchSources.IndexOf(_oldSearchSource);
_searchSources[index] = _searchSource; _searchSources[index] = _searchSource;
var info = _api.GetTranslation("succeed"); var info = _api.GetTranslation("success");
MessageBox.Show(info); MessageBox.Show(info);
Close(); Close();
} }

View File

@@ -1,4 +1,4 @@
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using Wox.Core.Plugin; using Wox.Core.Plugin;
@@ -28,27 +28,33 @@ namespace Wox.Plugin.WebSearch
private void OnDeleteSearchSearchClick(object sender, RoutedEventArgs e) private void OnDeleteSearchSearchClick(object sender, RoutedEventArgs e)
{ {
var selected = _settings.SelectedSearchSource; if (_settings.SelectedSearchSource != null)
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; var selected = _settings.SelectedSearchSource;
PluginManager.RemoveActionKeyword(id, selected.ActionKeyword); var warning = _context.API.GetTranslation("wox_plugin_websearch_delete_warning");
_settings.SearchSources.Remove(selected); 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) private void OnEditSearchSourceClick(object sender, RoutedEventArgs e)
{ {
var selected = _settings.SelectedSearchSource; if (_settings.SelectedSearchSource != null)
var webSearch = new SearchSourceSettingWindow {
var webSearch = new SearchSourceSettingWindow
( (
_settings.SearchSources, _context, selected _settings.SearchSources, _context, _settings.SelectedSearchSource
); );
webSearch.ShowDialog();
webSearch.ShowDialog();
}
} }
} }
} }

View File

@@ -55,8 +55,17 @@ Contribution
Build Build
----- -----
1. Install Visual Studio 2015 and tick all Windows 10 sdk options Install Visual Studio 2015/2017/2019
2. Open powershell with admin permission and `Set-ExecutionPolicy Unrestricted -Scope CurrentUser`
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 Documentation
------------- -------------

View File

@@ -106,16 +106,12 @@ namespace Wox.Core.Plugin
foreach (var plugin in AllPlugins) foreach (var plugin in AllPlugins)
{ {
if (IsGlobalPlugin(plugin.Metadata)) if (IsGlobalPlugin(plugin.Metadata))
{
GlobalPlugins.Add(plugin); GlobalPlugins.Add(plugin);
}
else // Plugins may have multiple ActionKeywords, eg. WebSearch
{ plugin.Metadata.ActionKeywords.Where(x => x != Query.GlobalPluginWildcardSign)
foreach (string actionKeyword in plugin.Metadata.ActionKeywords) .ToList()
{ .ForEach(x => NonGlobalPlugins[x] = plugin);
NonGlobalPlugins[actionKeyword] = plugin;
}
}
} }
} }
@@ -289,14 +285,20 @@ namespace Wox.Core.Plugin
public static void RemoveActionKeyword(string id, string oldActionkeyword) public static void RemoveActionKeyword(string id, string oldActionkeyword)
{ {
var plugin = GetPluginForId(id); 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); GlobalPlugins.Remove(plugin);
} }
else
{ if(oldActionkeyword != Query.GlobalPluginWildcardSign)
NonGlobalPlugins.Remove(oldActionkeyword); NonGlobalPlugins.Remove(oldActionkeyword);
}
plugin.Metadata.ActionKeywords.Remove(oldActionkeyword); plugin.Metadata.ActionKeywords.Remove(oldActionkeyword);
} }

View File

@@ -69,7 +69,7 @@ namespace Wox.Core
var newVersionTips = Translater.GetTranslation("newVersionTips"); var newVersionTips = Translater.GetTranslation("newVersionTips");
newVersionTips = string.Format(newVersionTips, fr.Version); newVersionTips = string.Format(newVersionTips, fr.Version);
MessageBox.Show(newVersionTips); MessageBox.Show(newVersionTips);
Log.Info($"|Updater.UpdateApp|Update succeed:{newVersionTips}"); Log.Info($"|Updater.UpdateApp|Update success:{newVersionTips}");
} }
// always dispose UpdateManager // always dispose UpdateManager

View File

@@ -1,4 +1,4 @@
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using NLog; using NLog;
@@ -22,8 +22,7 @@ namespace Wox.Infrastructure.Logger
var configuration = new LoggingConfiguration(); var configuration = new LoggingConfiguration();
var target = new FileTarget(); var target = new FileTarget();
configuration.AddTarget("file", target); configuration.AddTarget("file", target);
target.FileName = "${specialfolder:folder=ApplicationData}/" + Constant.Wox + "/" + DirectoryName + "/" + target.FileName = path.Replace(@"\", "/") + "/${shortdate}.txt";
Constant.Version + "/${shortdate}.txt";
#if DEBUG #if DEBUG
var rule = new LoggingRule("*", LogLevel.Debug, target); var rule = new LoggingRule("*", LogLevel.Debug, target);
#else #else

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Drawing; using System.Drawing;
using Newtonsoft.Json; using Newtonsoft.Json;
@@ -21,7 +21,7 @@ namespace Wox.Infrastructure.UserSettings
public string ResultFontWeight { get; set; } public string ResultFontWeight { get; set; }
public string ResultFontStretch { 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 WindowLeft { get; set; }
public double WindowTop { get; set; } public double WindowTop { get; set; }

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
@@ -7,13 +7,26 @@ namespace Wox.Infrastructure
{ {
public static class Constant 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 Wox = "Wox";
public const string Plugins = "Plugins"; public const string Plugins = "Plugins";
private static readonly Assembly Assembly = Assembly.GetExecutingAssembly(); private static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
public static readonly string ProgramDirectory = Directory.GetParent(Assembly.Location.NonNull()).ToString(); 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 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 PluginsDirectory = Path.Combine(DataDirectory, Plugins);
public static readonly string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins); public static readonly string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins);
public const string Repository = "https://github.com/Wox-launcher/Wox"; public const string Repository = "https://github.com/Wox-launcher/Wox";

View File

@@ -57,6 +57,11 @@ namespace Wox.Plugin
[Obsolete] [Obsolete]
void ShowApp(); void ShowApp();
/// <summary>
/// Save all Wox settings
/// </summary>
void SaveAppAllSettings();
/// <summary> /// <summary>
/// Show message box /// Show message box
/// </summary> /// </summary>

View File

@@ -65,17 +65,13 @@ namespace Wox.Plugin
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
Result r = obj as Result; var r = obj as Result;
if (r != null)
{ var equality = string.Equals(r?.Title, Title) &&
var equality = string.Equals(r.Title, Title) && string.Equals(r?.SubTitle, SubTitle) &&
string.Equals(r.SubTitle, SubTitle); string.Equals(r?.IcoPath, IcoPath);
return equality;
} return equality;
else
{
return false;
}
} }
public override int GetHashCode() public override int GetHashCode()

View File

@@ -0,0 +1,34 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
namespace Wox.Plugin.SharedCommands
{
public static class SearchWeb
{
/// <summary> Opens search in a new browser. If no browser path is passed in then Chrome is used.
/// Leave browser path blank to use Chrome.
/// </summary>
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);
}
}
}
}

View File

@@ -76,6 +76,7 @@
<Compile Include="Query.cs" /> <Compile Include="Query.cs" />
<Compile Include="Result.cs" /> <Compile Include="Result.cs" />
<Compile Include="ActionContext.cs" /> <Compile Include="ActionContext.cs" />
<Compile Include="SharedCommands\SearchWeb.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
@@ -84,6 +85,7 @@
<ItemGroup> <ItemGroup>
<Content Include="FodyWeavers.xml" /> <Content Include="FodyWeavers.xml" />
</ItemGroup> </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.1.29.2\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.1.29.2\build\dotnet\Fody.targets')" /> <Import Project="..\packages\Fody.1.29.2\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.1.29.2\build\dotnet\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View File

@@ -45,7 +45,7 @@ namespace Wox
{ {
var id = _plugin.Metadata.ID; var id = _plugin.Metadata.ID;
PluginManager.ReplaceActionKeyword(id, oldActionKeyword, newActionKeyword); PluginManager.ReplaceActionKeyword(id, oldActionKeyword, newActionKeyword);
MessageBox.Show(_translater.GetTranslation("succeed")); MessageBox.Show(_translater.GetTranslation("success"));
Close(); Close();
} }
else else

View File

@@ -57,7 +57,7 @@ namespace Wox
App.API.ChangeQuery(pluginHotkey.ActionKeyword); App.API.ChangeQuery(pluginHotkey.ActionKeyword);
Application.Current.MainWindow.Visibility = Visibility.Visible; Application.Current.MainWindow.Visibility = Visibility.Visible;
}); });
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("succeed")); MessageBox.Show(InternationalizationManager.Instance.GetTranslation("success"));
} }
else else
{ {
@@ -76,7 +76,7 @@ namespace Wox
App.API.ChangeQuery(updateCustomHotkey.ActionKeyword); App.API.ChangeQuery(updateCustomHotkey.ActionKeyword);
Application.Current.MainWindow.Visibility = Visibility.Visible; Application.Current.MainWindow.Visibility = Visibility.Visible;
}); });
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("succeed")); MessageBox.Show(InternationalizationManager.Instance.GetTranslation("success"));
} }
Close(); Close();

View File

@@ -78,7 +78,7 @@ namespace Wox
else else
{ {
tbMsg.Foreground = new SolidColorBrush(Colors.Green); tbMsg.Foreground = new SolidColorBrush(Colors.Green);
tbMsg.Text = InternationalizationManager.Instance.GetTranslation("succeed"); tbMsg.Text = InternationalizationManager.Instance.GetTranslation("success");
} }
tbMsg.Visibility = Visibility.Visible; tbMsg.Visibility = Visibility.Visible;
OnHotkeyChanged(); OnHotkeyChanged();

View File

@@ -91,7 +91,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">Kan ikke finde det valgte plugin</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">Kan ikke finde det valgte plugin</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">Nyt nøgleord må ikke være tomt</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">Nyt nøgleord må ikke være tomt</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">Nyt nøgleord er tilknyttet et andet plugin, tilknyt venligst et andet nyt nøgeleord</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">Nyt nøgleord er tilknyttet et andet plugin, tilknyt venligst et andet nyt nøgeleord</system:String>
<system:String x:Key="succeed">Fortsæt</system:String> <system:String x:Key="success">Fortsæt</system:String>
<system:String x:Key="actionkeyword_tips">Brug * hvis du ikke vil angive et nøgleord</system:String> <system:String x:Key="actionkeyword_tips">Brug * hvis du ikke vil angive et nøgleord</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -91,7 +91,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">Kann das angegebene Plugin nicht finden</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">Kann das angegebene Plugin nicht finden</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">Neues Aktionsschlüsselwort darf nicht leer sein</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">Neues Aktionsschlüsselwort darf nicht leer sein</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">Aktionsschlüsselwort ist schon bei einem anderen Plugin in verwendung. Bitte stellen Sie ein anderes Aktionsschlüsselwort ein.</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">Aktionsschlüsselwort ist schon bei einem anderen Plugin in verwendung. Bitte stellen Sie ein anderes Aktionsschlüsselwort ein.</system:String>
<system:String x:Key="succeed">Erfolgreich</system:String> <system:String x:Key="success">Erfolgreich</system:String>
<system:String x:Key="actionkeyword_tips">Benutzen Sie * wenn Sie ein Aktionsschlüsselwort definieren wollen.</system:String> <system:String x:Key="actionkeyword_tips">Benutzen Sie * wenn Sie ein Aktionsschlüsselwort definieren wollen.</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -103,7 +103,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">Can't find specified plugin</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">Can't find specified plugin</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">New Action Keyword can't be empty</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">New Action Keyword can't be empty</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">New Action Keywords have been assigned to another plugin, please assign other new action keyword</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">New Action Keywords have been assigned to another plugin, please assign other new action keyword</system:String>
<system:String x:Key="succeed">Succeed</system:String> <system:String x:Key="success">Success</system:String>
<system:String x:Key="actionkeyword_tips">Use * if you don't want to specify an action keyword</system:String> <system:String x:Key="actionkeyword_tips">Use * if you don't want to specify an action keyword</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -97,7 +97,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">Impossible de trouver le module spécifié</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">Impossible de trouver le module spécifié</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">Le nouveau mot-clé d'action doit être spécifié</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">Le nouveau mot-clé d'action doit être spécifié</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">Le nouveau mot-clé d'action a été assigné à un autre module, veuillez en choisir un autre</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">Le nouveau mot-clé d'action a été assigné à un autre module, veuillez en choisir un autre</system:String>
<system:String x:Key="succeed">Ajouté</system:String> <system:String x:Key="success">Ajouté</system:String>
<system:String x:Key="actionkeyword_tips">Saisissez * si vous ne souhaitez pas utiliser de mot-clé spécifique</system:String> <system:String x:Key="actionkeyword_tips">Saisissez * si vous ne souhaitez pas utiliser de mot-clé spécifique</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -100,7 +100,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">Impossibile trovare il plugin specificato</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">Impossibile trovare il plugin specificato</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">La nuova parola chiave d'azione non può essere vuota</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">La nuova parola chiave d'azione non può essere vuota</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">La nuova parola chiave d'azione è stata assegnata ad un altro plugin, per favore sceglierne una differente</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">La nuova parola chiave d'azione è stata assegnata ad un altro plugin, per favore sceglierne una differente</system:String>
<system:String x:Key="succeed">Successo</system:String> <system:String x:Key="success">Successo</system:String>
<system:String x:Key="actionkeyword_tips">Usa * se non vuoi specificare una parola chiave d'azione</system:String> <system:String x:Key="actionkeyword_tips">Usa * se non vuoi specificare una parola chiave d'azione</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -103,7 +103,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">プラグインが見つかりません</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">プラグインが見つかりません</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">新しいアクションキーボードを空にすることはできません</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">新しいアクションキーボードを空にすることはできません</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">新しいアクションキーボードは他のプラグインに割り当てられています。他のアクションキーボードを指定してください</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">新しいアクションキーボードは他のプラグインに割り当てられています。他のアクションキーボードを指定してください</system:String>
<system:String x:Key="succeed">成功しました</system:String> <system:String x:Key="success">成功しました</system:String>
<system:String x:Key="actionkeyword_tips">アクションキーボードを指定しない場合、* を使用してください</system:String> <system:String x:Key="actionkeyword_tips">アクションキーボードを指定しない場合、* を使用してください</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -95,7 +95,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">플러그인을 찾을 수 없습니다.</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">플러그인을 찾을 수 없습니다.</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">새 액션 키워드를 입력하세요.</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">새 액션 키워드를 입력하세요.</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">새 액션 키워드가 할당된 플러그인이 이미 있습니다. 다른 액션 키워드를 입력하세요.</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">새 액션 키워드가 할당된 플러그인이 이미 있습니다. 다른 액션 키워드를 입력하세요.</system:String>
<system:String x:Key="succeed">성공</system:String> <system:String x:Key="success">성공</system:String>
<system:String x:Key="actionkeyword_tips">액션 키워드를 지정하지 않으려면 *를 사용하세요.</system:String> <system:String x:Key="actionkeyword_tips">액션 키워드를 지정하지 않으려면 *를 사용하세요.</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -100,7 +100,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">Kan ikke finne den angitte utvidelsen</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">Kan ikke finne den angitte utvidelsen</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">Nytt handlingsnøkkelord kan ikke være tomt</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">Nytt handlingsnøkkelord kan ikke være tomt</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">De nye handlingsnøkkelordene er tildelt en annen utvidelse, vennligst velg et annet nøkkelord</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">De nye handlingsnøkkelordene er tildelt en annen utvidelse, vennligst velg et annet nøkkelord</system:String>
<system:String x:Key="succeed">Vellykket</system:String> <system:String x:Key="success">Vellykket</system:String>
<system:String x:Key="actionkeyword_tips">Bruk * hvis du ikke ønsker å angi et handlingsnøkkelord</system:String> <system:String x:Key="actionkeyword_tips">Bruk * hvis du ikke ønsker å angi et handlingsnøkkelord</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -91,7 +91,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">Kan plugin niet vinden</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">Kan plugin niet vinden</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">Nieuwe actie sneltoets moet ingevuld worden</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">Nieuwe actie sneltoets moet ingevuld worden</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">Nieuwe actie sneltoets is toegewezen aan een andere plugin, wijs een nieuwe actie sneltoets aan</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">Nieuwe actie sneltoets is toegewezen aan een andere plugin, wijs een nieuwe actie sneltoets aan</system:String>
<system:String x:Key="succeed">Succesvol</system:String> <system:String x:Key="success">Succesvol</system:String>
<system:String x:Key="actionkeyword_tips">Gebruik * wanneer je geen nieuwe actie sneltoets wilt specificeren</system:String> <system:String x:Key="actionkeyword_tips">Gebruik * wanneer je geen nieuwe actie sneltoets wilt specificeren</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -91,7 +91,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">Nie można odnaleźć podanej wtyczki</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">Nie można odnaleźć podanej wtyczki</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">Nowy wyzwalacz nie może być pusty</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">Nowy wyzwalacz nie może być pusty</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">Ten wyzwalacz został już przypisany do innej wtyczki, musisz podać inny wyzwalacz.</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">Ten wyzwalacz został już przypisany do innej wtyczki, musisz podać inny wyzwalacz.</system:String>
<system:String x:Key="succeed">Sukces</system:String> <system:String x:Key="success">Sukces</system:String>
<system:String x:Key="actionkeyword_tips">Użyj * jeżeli nie chcesz podawać wyzwalacza</system:String> <system:String x:Key="actionkeyword_tips">Użyj * jeżeli nie chcesz podawać wyzwalacza</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -100,7 +100,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">Não foi possível encontrar o plugin especificado</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">Não foi possível encontrar o plugin especificado</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">A nova palavra-chave da ação não pode ser vazia</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">A nova palavra-chave da ação não pode ser vazia</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">A nova palavra-chave da ação já foi atribuída a outro plugin, por favor tente outra</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">A nova palavra-chave da ação já foi atribuída a outro plugin, por favor tente outra</system:String>
<system:String x:Key="succeed">Sucesso</system:String> <system:String x:Key="success">Sucesso</system:String>
<system:String x:Key="actionkeyword_tips">Use * se não quiser especificar uma palavra-chave de ação</system:String> <system:String x:Key="actionkeyword_tips">Use * se não quiser especificar uma palavra-chave de ação</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -91,7 +91,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">Не удалось найти заданный плагин</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">Не удалось найти заданный плагин</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">Новая горячая клавиша не может быть пустой</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">Новая горячая клавиша не может быть пустой</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">Новая горячая клавиша уже используется другим плагином. Пожалуйста, задайте новую</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">Новая горячая клавиша уже используется другим плагином. Пожалуйста, задайте новую</system:String>
<system:String x:Key="succeed">Сохранено</system:String> <system:String x:Key="success">Сохранено</system:String>
<system:String x:Key="actionkeyword_tips">Используйте * в случае, если вы не хотите задавать конкретную горячую клавишу</system:String> <system:String x:Key="actionkeyword_tips">Используйте * в случае, если вы не хотите задавать конкретную горячую клавишу</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -101,7 +101,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">Nepodarilo sa nájsť zadaný plugin</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">Nepodarilo sa nájsť zadaný plugin</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">Nová skratka pre akciu nemôže byť prázdna</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">Nová skratka pre akciu nemôže byť prázdna</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">Nová skratka pre akciu bola priradená pre iný plugin, prosím, zvoľte inú skratku</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">Nová skratka pre akciu bola priradená pre iný plugin, prosím, zvoľte inú skratku</system:String>
<system:String x:Key="succeed">Úspešné</system:String> <system:String x:Key="success">Úspešné</system:String>
<system:String x:Key="actionkeyword_tips">Použite * ak nechcete určiť skratku pre akciu</system:String> <system:String x:Key="actionkeyword_tips">Použite * ak nechcete určiť skratku pre akciu</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -100,7 +100,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">Navedeni plugin nije moguće pronaći</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">Navedeni plugin nije moguće pronaći</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">Prečica za novu radnju ne može da bude prazna</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">Prečica za novu radnju ne može da bude prazna</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">Prečica za novu radnju je dodeljena drugom plugin-u, molim Vas dodelite drugu prečicu</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">Prečica za novu radnju je dodeljena drugom plugin-u, molim Vas dodelite drugu prečicu</system:String>
<system:String x:Key="succeed">Uspešno</system:String> <system:String x:Key="success">Uspešno</system:String>
<system:String x:Key="actionkeyword_tips">Koristite * ako ne želite da navedete prečicu za radnju</system:String> <system:String x:Key="actionkeyword_tips">Koristite * ako ne želite da navedete prečicu za radnju</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -91,7 +91,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">Не вдалося знайти вказаний плагін</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">Не вдалося знайти вказаний плагін</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">Нова гаряча клавіша не може бути порожньою</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">Нова гаряча клавіша не може бути порожньою</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">Нова гаряча клавіша вже використовується іншим плагіном. Будь ласка, вкажіть нову</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">Нова гаряча клавіша вже використовується іншим плагіном. Будь ласка, вкажіть нову</system:String>
<system:String x:Key="succeed">Збережено</system:String> <system:String x:Key="success">Збережено</system:String>
<system:String x:Key="actionkeyword_tips">Використовуйте * у разі, якщо ви не хочете ставити конкретну гарячу клавішу</system:String> <system:String x:Key="actionkeyword_tips">Використовуйте * у разі, якщо ви не хочете ставити конкретну гарячу клавішу</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->

View File

@@ -98,7 +98,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">找不到指定的插件</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">找不到指定的插件</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">新触发关键字不能为空</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">新触发关键字不能为空</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">新触发关键字已经被指派给其他插件了,请重新选择一个关键字</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">新触发关键字已经被指派给其他插件了,请重新选择一个关键字</system:String>
<system:String x:Key="succeed">成功</system:String> <system:String x:Key="success">成功</system:String>
<system:String x:Key="actionkeyword_tips">如果你不想设置触发关键字,可以使用*代替</system:String> <system:String x:Key="actionkeyword_tips">如果你不想设置触发关键字,可以使用*代替</system:String>
<!--Custom Query Hotkey 对话框--> <!--Custom Query Hotkey 对话框-->

View File

@@ -91,7 +91,7 @@
<system:String x:Key="cannotFindSpecifiedPlugin">找不到指定的外掛</system:String> <system:String x:Key="cannotFindSpecifiedPlugin">找不到指定的外掛</system:String>
<system:String x:Key="newActionKeywordsCannotBeEmpty">新觸發關鍵字不能為空白</system:String> <system:String x:Key="newActionKeywordsCannotBeEmpty">新觸發關鍵字不能為空白</system:String>
<system:String x:Key="newActionKeywordsHasBeenAssigned">新觸發關鍵字已經被指派給另一外掛,請設定其他關鍵字。</system:String> <system:String x:Key="newActionKeywordsHasBeenAssigned">新觸發關鍵字已經被指派給另一外掛,請設定其他關鍵字。</system:String>
<system:String x:Key="succeed">成功</system:String> <system:String x:Key="success">成功</system:String>
<system:String x:Key="actionkeyword_tips">如果不想設定觸發關鍵字,可以使用*代替</system:String> <system:String x:Key="actionkeyword_tips">如果不想設定觸發關鍵字,可以使用*代替</system:String>
<!--Custom Query Hotkey 對話框--> <!--Custom Query Hotkey 對話框-->

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.IO; using System.IO;
using System.Windows; using System.Windows;
using System.Windows.Forms; using System.Windows.Forms;
@@ -30,7 +30,7 @@ namespace Wox
// Create the fade out storyboard // Create the fade out storyboard
fadeOutStoryboard.Completed += fadeOutStoryboard_Completed; 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 AccelerationRatio = 0.2
}; };

View File

@@ -59,13 +59,18 @@ namespace Wox
// we must manually save // we must manually save
// UpdateManager.RestartApp() will call Environment.Exit(0) // UpdateManager.RestartApp() will call Environment.Exit(0)
// which will cause ungraceful exit // which will cause ungraceful exit
SaveAppAllSettings();
UpdateManager.RestartApp();
}
public void SaveAppAllSettings()
{
_mainVM.Save(); _mainVM.Save();
_settingsVM.Save(); _settingsVM.Save();
PluginManager.Save(); PluginManager.Save();
ImageLoader.Save(); ImageLoader.Save();
Alphabet.Save(); Alphabet.Save();
UpdateManager.RestartApp();
} }
[Obsolete] [Obsolete]

View File

@@ -318,6 +318,7 @@ namespace Wox
private void OnClosed(object sender, EventArgs e) private void OnClosed(object sender, EventArgs e)
{ {
_viewModel.Save(); _viewModel.Save();
PluginManager.Save();
} }
private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e) private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e)

View File

@@ -440,7 +440,7 @@ namespace Wox.ViewModel
Action = _ => Action = _ =>
{ {
_topMostRecord.Remove(result); _topMostRecord.Remove(result);
App.API.ShowMsg("Succeed"); App.API.ShowMsg("Success");
return false; return false;
} }
}; };
@@ -455,7 +455,7 @@ namespace Wox.ViewModel
Action = _ => Action = _ =>
{ {
_topMostRecord.AddOrUpdate(result); _topMostRecord.AddOrUpdate(result);
App.API.ShowMsg("Succeed"); App.API.ShowMsg("Success");
return false; return false;
} }
}; };

View File

@@ -148,25 +148,28 @@ namespace Wox.ViewModel
private List<ResultViewModel> NewResults(List<Result> newRawResults, string resultId) private List<ResultViewModel> NewResults(List<Result> newRawResults, string resultId)
{ {
var newResults = newRawResults.Select(r => new ResultViewModel(r)).ToList();
var results = Results.ToList(); var results = Results.ToList();
var newResults = newRawResults.Select(r => new ResultViewModel(r)).ToList();
var oldResults = results.Where(r => r.Result.PluginID == resultId).ToList(); var oldResults = results.Where(r => r.Result.PluginID == resultId).ToList();
// intersection of A (old results) and B (new newResults) // Find the same results in A (old results) and B (new newResults)
var intersection = oldResults.Intersect(newResults).ToList(); 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 // 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); results.Remove(result);
} }
// update index for result in intersection of A and B // update result with B's score and index position
foreach (var commonResult in intersection) foreach (var sameResult in sameResults)
{ {
int oldIndex = results.IndexOf(commonResult); int oldIndex = results.IndexOf(sameResult);
int oldScore = results[oldIndex].Result.Score; int oldScore = results[oldIndex].Result.Score;
var newResult = newResults[newResults.IndexOf(commonResult)]; var newResult = newResults[newResults.IndexOf(sameResult)];
int newScore = newResult.Result.Score; int newScore = newResult.Result.Score;
if (newScore != oldScore) if (newScore != oldScore)
{ {
@@ -182,7 +185,7 @@ namespace Wox.ViewModel
} }
// insert result in relative complement of A in B // 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); int newIndex = InsertIndexOf(result.Result.Score, results);
results.Insert(newIndex, result); results.Insert(newIndex, result);