mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 01:08:18 +08:00
parent
59a4abff7c
commit
a07d6aa1e7
@ -12,7 +12,7 @@ using Control = System.Windows.Controls.Control;
|
||||
|
||||
namespace Wox.Plugin.CMD
|
||||
{
|
||||
public class CMD : IPlugin, ISettingProvider, IPluginI18n, IInstantQuery, IExclusiveQuery, IContextMenu
|
||||
public class CMD : IPlugin, ISettingProvider, IPluginI18n, IInstantQuery, IContextMenu
|
||||
{
|
||||
private PluginInitContext context;
|
||||
private bool WinRStroked;
|
||||
@ -202,11 +202,6 @@ namespace Wox.Plugin.CMD
|
||||
|
||||
public bool IsInstantQuery(string query) => false;
|
||||
|
||||
public bool IsExclusiveQuery(Query query)
|
||||
{
|
||||
return query.Search.StartsWith(">");
|
||||
}
|
||||
|
||||
public List<Result> LoadContextMenus(Result selectedResult)
|
||||
{
|
||||
return new List<Result>()
|
||||
|
@ -23,7 +23,7 @@
|
||||
<system:String x:Key="wox_plugin_websearch_input_title">Please input title</system:String>
|
||||
<system:String x:Key="wox_plugin_websearch_input_action_keyword">Please input action keyword</system:String>
|
||||
<system:String x:Key="wox_plugin_websearch_input_url">Please input URL</system:String>
|
||||
<system:String x:Key="wox_plugin_websearch_action_keyword_exist">ActionWord has existed, please input a new one</system:String>
|
||||
<system:String x:Key="wox_plugin_websearch_action_keyword_exist">ActionKeyword has existed, please input a new one</system:String>
|
||||
<system:String x:Key="wox_plugin_websearch_succeed">Succeed</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_websearch_plugin_name">Web Searches</system:String>
|
||||
|
@ -6,7 +6,7 @@ namespace Wox.Plugin.WebSearch
|
||||
public class WebSearch
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string ActionWord { get; set; }
|
||||
public string ActionKeyword { get; set; }
|
||||
public string IconPath { get; set; }
|
||||
public string Url { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
|
@ -8,7 +8,7 @@ using Wox.Plugin.WebSearch.SuggestionSources;
|
||||
|
||||
namespace Wox.Plugin.WebSearch
|
||||
{
|
||||
public class WebSearchPlugin : IPlugin, ISettingProvider, IPluginI18n, IInstantQuery, IExclusiveQuery
|
||||
public class WebSearchPlugin : IPlugin, ISettingProvider, IPluginI18n, IInstantQuery
|
||||
{
|
||||
private PluginInitContext context;
|
||||
private IDisposable suggestionTimer;
|
||||
@ -16,17 +16,12 @@ namespace Wox.Plugin.WebSearch
|
||||
public List<Result> Query(Query query)
|
||||
{
|
||||
List<Result> results = new List<Result>();
|
||||
if (!query.Search.Contains(' '))
|
||||
{
|
||||
return results;
|
||||
}
|
||||
|
||||
WebSearch webSearch =
|
||||
WebSearchStorage.Instance.WebSearches.FirstOrDefault(o => o.ActionWord == query.FirstSearch.Trim() && o.Enabled);
|
||||
WebSearchStorage.Instance.WebSearches.FirstOrDefault(o => o.ActionKeyword == query.ActionKeyword && o.Enabled);
|
||||
|
||||
if (webSearch != null)
|
||||
{
|
||||
string keyword = query.SecondToEndSearch;
|
||||
string keyword = query.ActionKeyword;
|
||||
string title = keyword;
|
||||
string subtitle = context.API.GetTranslation("wox_plugin_websearch_search") + " " + webSearch.Title;
|
||||
if (string.IsNullOrEmpty(keyword))
|
||||
@ -122,14 +117,5 @@ namespace Wox.Plugin.WebSearch
|
||||
|
||||
public bool IsInstantQuery(string query) => false;
|
||||
|
||||
public bool IsExclusiveQuery(Query query)
|
||||
{
|
||||
var strings = query.RawQuery.Split(' ');
|
||||
if (strings.Length > 1)
|
||||
{
|
||||
return WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionWord == strings[0] && o.Enabled);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -42,7 +42,7 @@ namespace Wox.Plugin.WebSearch
|
||||
cbEnable.IsChecked = webSearch.Enabled;
|
||||
tbTitle.Text = webSearch.Title;
|
||||
tbUrl.Text = webSearch.Url;
|
||||
tbActionword.Text = webSearch.ActionWord;
|
||||
tbActionword.Text = webSearch.ActionKeyword;
|
||||
}
|
||||
|
||||
private void ShowIcon(string path)
|
||||
@ -90,7 +90,7 @@ namespace Wox.Plugin.WebSearch
|
||||
|
||||
if (!update)
|
||||
{
|
||||
if (WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionWord == action))
|
||||
if (WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionKeyword == action))
|
||||
{
|
||||
string warning = context.API.GetTranslation("wox_plugin_websearch_action_keyword_exist");
|
||||
MessageBox.Show(warning);
|
||||
@ -98,7 +98,7 @@ namespace Wox.Plugin.WebSearch
|
||||
}
|
||||
WebSearchStorage.Instance.WebSearches.Add(new WebSearch()
|
||||
{
|
||||
ActionWord = action,
|
||||
ActionKeyword = action,
|
||||
Enabled = cbEnable.IsChecked ?? false,
|
||||
IconPath = tbIconPath.Text,
|
||||
Url = url,
|
||||
@ -109,13 +109,13 @@ namespace Wox.Plugin.WebSearch
|
||||
}
|
||||
else
|
||||
{
|
||||
if (WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionWord == action && o != updateWebSearch))
|
||||
if (WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionKeyword == action && o != updateWebSearch))
|
||||
{
|
||||
string warning = context.API.GetTranslation("wox_plugin_websearch_action_keyword_exist");
|
||||
MessageBox.Show(warning);
|
||||
return;
|
||||
}
|
||||
updateWebSearch.ActionWord = action;
|
||||
updateWebSearch.ActionKeyword = action;
|
||||
updateWebSearch.IconPath = tbIconPath.Text;
|
||||
updateWebSearch.Enabled = cbEnable.IsChecked ?? false;
|
||||
updateWebSearch.Url = url;
|
||||
|
@ -40,7 +40,7 @@ namespace Wox.Plugin.WebSearch
|
||||
WebSearch googleWebSearch = new WebSearch()
|
||||
{
|
||||
Title = "Google",
|
||||
ActionWord = "g",
|
||||
ActionKeyword = "g",
|
||||
IconPath = @"Images\websearch\google.png",
|
||||
Url = "https://www.google.com/search?q={q}",
|
||||
Enabled = true
|
||||
@ -51,7 +51,7 @@ namespace Wox.Plugin.WebSearch
|
||||
WebSearch wikiWebSearch = new WebSearch()
|
||||
{
|
||||
Title = "Wikipedia",
|
||||
ActionWord = "wiki",
|
||||
ActionKeyword = "wiki",
|
||||
IconPath = @"Images\websearch\wiki.png",
|
||||
Url = "http://en.wikipedia.org/wiki/{q}",
|
||||
Enabled = true
|
||||
@ -61,7 +61,7 @@ namespace Wox.Plugin.WebSearch
|
||||
WebSearch findIcon = new WebSearch()
|
||||
{
|
||||
Title = "FindIcon",
|
||||
ActionWord = "findicon",
|
||||
ActionKeyword = "findicon",
|
||||
IconPath = @"Images\websearch\pictures.png",
|
||||
Url = "http://findicons.com/search/{q}",
|
||||
Enabled = true
|
||||
|
@ -22,7 +22,7 @@
|
||||
<GridViewColumn Header="{DynamicResource wox_plugin_websearch_action_keyword}" Width="180">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding ActionWord}"/>
|
||||
<TextBlock Text="{Binding ActionKeyword}"/>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
@ -59,7 +59,7 @@
|
||||
<Compile Include="WebSearchesSetting.xaml.cs">
|
||||
<DependentUpon>WebSearchesSetting.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WebQueryPlugin.cs" />
|
||||
<Compile Include="WebSearchPlugin.cs" />
|
||||
<Compile Include="WebSearchSetting.xaml.cs">
|
||||
<DependentUpon>WebSearchSetting.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -135,5 +135,4 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
|
||||
</Project>
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"ID":"565B73353DBF4806919830B9202EE3BF",
|
||||
"ActionKeyword":"*",
|
||||
"ActionKeywords": ["g", "wiki", "findicon"],
|
||||
"Name":"Web Searches",
|
||||
"Description":"Provide the web search ability",
|
||||
"Author":"qianlifeng",
|
||||
|
@ -72,6 +72,10 @@ namespace Wox.Core.Plugin
|
||||
{
|
||||
metadata = JsonConvert.DeserializeObject<PluginMetadata>(File.ReadAllText(configPath));
|
||||
metadata.PluginDirectory = pluginDirectory;
|
||||
// for plugins which doesn't has ActionKeywords key
|
||||
metadata.ActionKeywords = metadata.ActionKeywords ?? new[] {metadata.ActionKeyword};
|
||||
// for plugin still use old ActionKeyword
|
||||
metadata.ActionKeyword = metadata.ActionKeywords?[0];
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
@ -112,9 +116,10 @@ namespace Wox.Core.Plugin
|
||||
|
||||
//replace action keyword if user customized it.
|
||||
var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == metadata.ID);
|
||||
if (customizedPluginConfig != null && !string.IsNullOrEmpty(customizedPluginConfig.Actionword))
|
||||
if (customizedPluginConfig?.ActionKeywords?.Length > 0)
|
||||
{
|
||||
metadata.ActionKeyword = customizedPluginConfig.Actionword;
|
||||
metadata.ActionKeywords = customizedPluginConfig.ActionKeywords;
|
||||
metadata.ActionKeyword = customizedPluginConfig.ActionKeywords[0]; //todo reenable
|
||||
}
|
||||
|
||||
return metadata;
|
||||
|
@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Windows.Documents;
|
||||
using Wox.Core.Exception;
|
||||
using Wox.Core.i18n;
|
||||
using Wox.Core.UI;
|
||||
@ -110,7 +108,6 @@ namespace Wox.Core.Plugin
|
||||
ThreadPool.QueueUserWorkItem(o =>
|
||||
{
|
||||
instantQueryPlugins = GetPlugins<IInstantQuery>();
|
||||
exclusiveSearchPlugins = GetPlugins<IExclusiveQuery>();
|
||||
contextMenuPlugins = GetPlugins<IContextMenu>();
|
||||
});
|
||||
}
|
||||
@ -123,8 +120,8 @@ namespace Wox.Core.Plugin
|
||||
public static Query QueryInit(string text) //todo is that possible to move it into type Query?
|
||||
{
|
||||
// replace multiple white spaces with one white space
|
||||
var terms = text.Split(new[] { Query.Seperater }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var rawQuery = string.Join(Query.Seperater, terms.ToArray());
|
||||
var terms = text.Split(new[] { Query.TermSeperater }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var rawQuery = string.Join(Query.TermSeperater, terms.ToArray());
|
||||
var actionKeyword = string.Empty;
|
||||
var search = rawQuery;
|
||||
IEnumerable<string> actionParameters = terms;
|
||||
@ -136,7 +133,7 @@ namespace Wox.Core.Plugin
|
||||
if (!string.IsNullOrEmpty(actionKeyword))
|
||||
{
|
||||
actionParameters = terms.Skip(1);
|
||||
search = string.Join(Query.Seperater, actionParameters.ToArray());
|
||||
search = string.Join(Query.TermSeperater, actionParameters.ToArray());
|
||||
}
|
||||
return new Query
|
||||
{
|
||||
@ -204,7 +201,7 @@ namespace Wox.Core.Plugin
|
||||
private static bool IsVailldActionKeyword(string actionKeyword)
|
||||
{
|
||||
if (string.IsNullOrEmpty(actionKeyword) || actionKeyword == Query.WildcardSign) return false;
|
||||
PluginPair pair = AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == actionKeyword);
|
||||
PluginPair pair = AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeywords.Contains(actionKeyword));
|
||||
if (pair == null) return false;
|
||||
var customizedPluginConfig = UserSettingStorage.Instance.
|
||||
CustomizedPluginConfigs.FirstOrDefault(o => o.ID == pair.Metadata.ID);
|
||||
@ -213,7 +210,7 @@ namespace Wox.Core.Plugin
|
||||
|
||||
public static bool IsSystemPlugin(PluginMetadata metadata)
|
||||
{
|
||||
return metadata.ActionKeyword == Query.WildcardSign;
|
||||
return metadata.ActionKeywords.Contains(Query.WildcardSign);
|
||||
}
|
||||
|
||||
private static bool IsInstantQueryPlugin(PluginPair plugin)
|
||||
@ -239,21 +236,11 @@ namespace Wox.Core.Plugin
|
||||
return AllPlugins.Where(p => p.Plugin is T);
|
||||
}
|
||||
|
||||
private static PluginPair GetExclusivePlugin(Query query)
|
||||
{
|
||||
return exclusiveSearchPlugins.FirstOrDefault(p => ((IExclusiveQuery)p.Plugin).IsExclusiveQuery(query));
|
||||
}
|
||||
|
||||
private static PluginPair GetActionKeywordPlugin(Query query)
|
||||
{
|
||||
//if a query doesn't contain a vaild action keyword, it should not be a action keword plugin query
|
||||
if (string.IsNullOrEmpty(query.ActionKeyword)) return null;
|
||||
return AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == query.ActionKeyword);
|
||||
}
|
||||
|
||||
private static PluginPair GetNonSystemPlugin(Query query)
|
||||
{
|
||||
return GetExclusivePlugin(query) ?? GetActionKeywordPlugin(query);
|
||||
//if a query doesn't contain a vaild action keyword, it should be a query for system plugin
|
||||
if (string.IsNullOrEmpty(query.ActionKeyword)) return null;
|
||||
return AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeywords.Contains(query.ActionKeyword));
|
||||
}
|
||||
|
||||
private static List<PluginPair> GetSystemPlugins()
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Wox.Core.UserSettings
|
||||
{
|
||||
@ -9,7 +10,7 @@ namespace Wox.Core.UserSettings
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Actionword { get; set; }
|
||||
public string[] ActionKeywords { get; set; }
|
||||
|
||||
public bool Disabled { get; set; }
|
||||
}
|
||||
|
@ -10,8 +10,10 @@ namespace Wox.Plugin
|
||||
List<Result> LoadContextMenus(Result selectedResult);
|
||||
}
|
||||
|
||||
[Obsolete("If a plugin has a action keyword, then it is exclusive. This interface will be remove in v1.3.0")]
|
||||
public interface IExclusiveQuery : IFeatures
|
||||
{
|
||||
[Obsolete("If a plugin has a action keyword, then it is exclusive. This method will be remove in v1.3.0")]
|
||||
bool IsExclusiveQuery(Query query);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
@ -23,8 +24,11 @@ namespace Wox.Plugin
|
||||
|
||||
public string PluginDirectory { get; set; }
|
||||
|
||||
[Obsolete("Use ActionKeywords instead, because Wox now support multiple action keywords. This will be remove in v1.3.0")]
|
||||
public string ActionKeyword { get; set; }
|
||||
|
||||
public string[] ActionKeywords { get; set; }
|
||||
|
||||
public string IcoPath { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
|
@ -25,14 +25,15 @@ namespace Wox.Plugin
|
||||
/// </summary>
|
||||
internal string[] Terms { private get; set; }
|
||||
|
||||
public const string Seperater = " ";
|
||||
public const string TermSeperater = " ";
|
||||
public const string ActionKeywordSeperater = ";";
|
||||
|
||||
/// <summary>
|
||||
/// * is used for System Plugin
|
||||
/// </summary>
|
||||
public const string WildcardSign = "*";
|
||||
|
||||
internal string ActionKeyword { get; set; }
|
||||
public string ActionKeyword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Return first search split by space if it has
|
||||
@ -46,8 +47,8 @@ namespace Wox.Plugin
|
||||
{
|
||||
get
|
||||
{
|
||||
var index = String.IsNullOrEmpty(ActionKeyword) ? 1 : 2;
|
||||
return String.Join(Seperater, Terms.Skip(index).ToArray());
|
||||
var index = string.IsNullOrEmpty(ActionKeyword) ? 1 : 2;
|
||||
return string.Join(TermSeperater, Terms.Skip(index).ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,18 +66,17 @@ namespace Wox.Plugin
|
||||
{
|
||||
try
|
||||
{
|
||||
return String.IsNullOrEmpty(ActionKeyword) ? Terms[index] : Terms[index + 1];
|
||||
return string.IsNullOrEmpty(ActionKeyword) ? Terms[index] : Terms[index + 1];
|
||||
}
|
||||
catch (IndexOutOfRangeException)
|
||||
{
|
||||
return String.Empty;
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString() => RawQuery;
|
||||
|
||||
[Obsolete("Use Search instead, A plugin developer shouldn't care about action name, as it may changed by users. " +
|
||||
"this property will be removed in v1.3.0")]
|
||||
[Obsolete("Use ActionKeyword, this property will be removed in v1.3.0")]
|
||||
public string ActionName { get; internal set; }
|
||||
|
||||
[Obsolete("Use Search instead, this property will be removed in v1.3.0")]
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Window x:Class="Wox.ActionKeyword"
|
||||
<Window x:Class="Wox.ActionKeywords"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="ActionKeyword"
|
||||
Title="ActionKeywords"
|
||||
Icon="Images\app.png"
|
||||
ResizeMode="NoResize"
|
||||
Loaded="ActionKeyword_OnLoaded"
|
||||
@ -19,7 +19,7 @@
|
||||
<ColumnDefinition></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Margin="10" FontSize="14" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Text="{DynamicResource oldActionKeyword}"></TextBlock>
|
||||
<TextBlock x:Name="tbOldActionKeyword" Margin="10" FontSize="14" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left">Old ActionKeyword:</TextBlock>
|
||||
<TextBlock x:Name="tbOldActionKeyword" Margin="10" FontSize="14" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left">Old ActionKeywords:</TextBlock>
|
||||
|
||||
<TextBlock Margin="10" FontSize="14" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Text="{DynamicResource newActionKeyword}"></TextBlock>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" Grid.Column="1" >
|
@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using Wox.Core.i18n;
|
||||
using Wox.Core.Plugin;
|
||||
@ -7,11 +8,11 @@ using Wox.Plugin;
|
||||
|
||||
namespace Wox
|
||||
{
|
||||
public partial class ActionKeyword : Window
|
||||
public partial class ActionKeywords : Window
|
||||
{
|
||||
private PluginMetadata pluginMetadata;
|
||||
|
||||
public ActionKeyword(string pluginId)
|
||||
public ActionKeywords(string pluginId)
|
||||
{
|
||||
InitializeComponent();
|
||||
PluginPair plugin = PluginManager.GetPlugin(pluginId);
|
||||
@ -27,7 +28,7 @@ namespace Wox
|
||||
|
||||
private void ActionKeyword_OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tbOldActionKeyword.Text = pluginMetadata.ActionKeyword;
|
||||
tbOldActionKeyword.Text = string.Join(Query.ActionKeywordSeperater, pluginMetadata.ActionKeywords);
|
||||
tbAction.Focus();
|
||||
}
|
||||
|
||||
@ -44,15 +45,18 @@ namespace Wox
|
||||
return;
|
||||
}
|
||||
|
||||
var actionKeywords = tbAction.Text.Trim().Split(new[] { Query.ActionKeywordSeperater }, StringSplitOptions.RemoveEmptyEntries).ToArray();
|
||||
//check new action keyword didn't used by other plugin
|
||||
if (tbAction.Text.Trim() != Query.WildcardSign && PluginManager.AllPlugins.Any(o => o.Metadata.ActionKeyword == tbAction.Text.Trim()))
|
||||
if (actionKeywords[0] != Query.WildcardSign && PluginManager.AllPlugins.
|
||||
SelectMany(p => p.Metadata.ActionKeywords).
|
||||
Any(k => actionKeywords.Contains(k)))
|
||||
{
|
||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("newActionKeywordHasBeenAssigned"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
pluginMetadata.ActionKeyword = tbAction.Text.Trim();
|
||||
pluginMetadata.ActionKeywords = actionKeywords;
|
||||
var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == pluginMetadata.ID);
|
||||
if (customizedPluginConfig == null)
|
||||
{
|
||||
@ -61,12 +65,12 @@ namespace Wox
|
||||
Disabled = false,
|
||||
ID = pluginMetadata.ID,
|
||||
Name = pluginMetadata.Name,
|
||||
Actionword = tbAction.Text.Trim()
|
||||
ActionKeywords = actionKeywords
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
customizedPluginConfig.Actionword = tbAction.Text.Trim();
|
||||
customizedPluginConfig.ActionKeywords = actionKeywords;
|
||||
}
|
||||
UserSettingStorage.Instance.Save();
|
||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("succeed"));
|
@ -6,7 +6,7 @@ using System.Windows;
|
||||
using Wox.CommandArgs;
|
||||
using Wox.Core.Plugin;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure;
|
||||
using Stopwatch = Wox.Infrastructure.Stopwatch;
|
||||
|
||||
namespace Wox
|
||||
{
|
||||
|
@ -77,13 +77,13 @@
|
||||
<system:String x:Key="about_activate_times">You have activated Wox {0} times</system:String>
|
||||
|
||||
<!--Action Keyword Setting Dialog-->
|
||||
<system:String x:Key="oldActionKeyword">Old Action Keyword</system:String>
|
||||
<system:String x:Key="newActionKeyword">New Action Keyword</system:String>
|
||||
<system:String x:Key="oldActionKeywords">Old Action Keyword</system:String>
|
||||
<system:String x:Key="newActionKeywords">New Action Keyword</system:String>
|
||||
<system:String x:Key="cancel">Cancel</system:String>
|
||||
<system:String x:Key="done">Done</system:String>
|
||||
<system:String x:Key="cannotFindSpecifiedPlugin">Can't find specified plugin</system:String>
|
||||
<system:String x:Key="newActionKeywordCannotBeEmpty">New Action Keyword can't be empty</system:String>
|
||||
<system:String x:Key="newActionKeywordHasBeenAssigned">New ActionKeyword has been assigned to other plugin, please assign another new action keyword</system:String>
|
||||
<system:String x:Key="newActionKeywordsCannotBeEmpty">New Action Keyword can't be empty</system:String>
|
||||
<system:String x:Key="newActionKeywordsHasBeenAssigned">New ActionKeywords has been assigned to other plugin, please assign another new action keyword</system:String>
|
||||
<system:String x:Key="succeed">Succeed</system:String>
|
||||
<system:String x:Key="actionkeyword_tips">Use * if you don't want to specify a action keyword</system:String>
|
||||
|
||||
|
@ -77,13 +77,13 @@
|
||||
<system:String x:Key="about_activate_times">Вы воспользовались Wox уже {0} раз</system:String>
|
||||
|
||||
<!--Action Keyword Setting Dialog-->
|
||||
<system:String x:Key="oldActionKeyword">Текущая горячая клавиша</system:String>
|
||||
<system:String x:Key="newActionKeyword">Новая горячая клавиша</system:String>
|
||||
<system:String x:Key="oldActionKeywords">Текущая горячая клавиша</system:String>
|
||||
<system:String x:Key="newActionKeywords">Новая горячая клавиша</system:String>
|
||||
<system:String x:Key="cancel">Отменить</system:String>
|
||||
<system:String x:Key="done">Подтвердить</system:String>
|
||||
<system:String x:Key="cannotFindSpecifiedPlugin">Не удалось найти заданный плагин</system:String>
|
||||
<system:String x:Key="newActionKeywordCannotBeEmpty">Новая горячая клавиша не может быть пустой</system:String>
|
||||
<system:String x:Key="newActionKeywordHasBeenAssigned">Новая горячая клавиша уже используется другим плагином. Пожалуйста, зайдайте новую</system:String>
|
||||
<system:String x:Key="newActionKeywordsCannotBeEmpty">Новая горячая клавиша не может быть пустой</system:String>
|
||||
<system:String x:Key="newActionKeywordsHasBeenAssigned">Новая горячая клавиша уже используется другим плагином. Пожалуйста, зайдайте новую</system:String>
|
||||
<system:String x:Key="succeed">Сохранено</system:String>
|
||||
<system:String x:Key="actionkeyword_tips">Используйте * в случае, если вы не хотите задавать конкретную горячую клавишу</system:String>
|
||||
|
||||
|
@ -77,13 +77,13 @@
|
||||
<system:String x:Key="about_activate_times">你已经激活了Wox {0} 次</system:String>
|
||||
|
||||
<!--Action Keyword 设置对话框-->
|
||||
<system:String x:Key="oldActionKeyword">旧触发关键字</system:String>
|
||||
<system:String x:Key="newActionKeyword">新触发关键字</system:String>
|
||||
<system:String x:Key="oldActionKeywords">旧触发关键字</system:String>
|
||||
<system:String x:Key="newActionKeywords">新触发关键字</system:String>
|
||||
<system:String x:Key="cancel">取消</system:String>
|
||||
<system:String x:Key="done">确定</system:String>
|
||||
<system:String x:Key="cannotFindSpecifiedPlugin">找不到指定的插件</system:String>
|
||||
<system:String x:Key="newActionKeywordCannotBeEmpty">新触发关键字不能为空</system:String>
|
||||
<system:String x:Key="newActionKeywordHasBeenAssigned">新触发关键字已经被指派给其他插件了,请重新选择一个关键字</system:String>
|
||||
<system:String x:Key="newActionKeywordsCannotBeEmpty">新触发关键字不能为空</system:String>
|
||||
<system:String x:Key="newActionKeywordsHasBeenAssigned">新触发关键字已经被指派给其他插件了,请重新选择一个关键字</system:String>
|
||||
<system:String x:Key="succeed">成功</system:String>
|
||||
<system:String x:Key="actionkeyword_tips">如果你不想设置触发关键字,可以使用*代替</system:String>
|
||||
|
||||
|
@ -77,13 +77,13 @@
|
||||
<system:String x:Key="about_activate_times">你已經激活了Wox {0} 次</system:String>
|
||||
|
||||
<!--Action Keyword 設置對話框-->
|
||||
<system:String x:Key="oldActionKeyword">舊觸發關鍵字</system:String>
|
||||
<system:String x:Key="newActionKeyword">新觸發關鍵字</system:String>
|
||||
<system:String x:Key="oldActionKeywords">舊觸發關鍵字</system:String>
|
||||
<system:String x:Key="newActionKeywords">新觸發關鍵字</system:String>
|
||||
<system:String x:Key="cancel">取消</system:String>
|
||||
<system:String x:Key="done">確定</system:String>
|
||||
<system:String x:Key="cannotFindSpecifiedPlugin">找不到指定的插件</system:String>
|
||||
<system:String x:Key="newActionKeywordCannotBeEmpty">新觸發關鍵字不能為空</system:String>
|
||||
<system:String x:Key="newActionKeywordHasBeenAssigned">新觸發關鍵字已經被指派給其他插件了,請重新選擇一個關鍵字</system:String>
|
||||
<system:String x:Key="newActionKeywordsCannotBeEmpty">新觸發關鍵字不能為空</system:String>
|
||||
<system:String x:Key="newActionKeywordsHasBeenAssigned">新觸發關鍵字已經被指派給其他插件了,請重新選擇一個關鍵字</system:String>
|
||||
<system:String x:Key="succeed">成功</system:String>
|
||||
<system:String x:Key="actionkeyword_tips">如果你不想設置觸發關鍵字,可以使用*代替</system:String>
|
||||
|
||||
|
@ -109,7 +109,7 @@
|
||||
<TextBlock x:Name="pluginActionKeywordTitle" Margin="20 0 0 0">
|
||||
<TextBlock Text="{DynamicResource actionKeyword}"></TextBlock>
|
||||
</TextBlock>
|
||||
<TextBlock Margin="5 0 0 0" ToolTip="Change Action Keyword" Cursor="Hand" MouseUp="PluginActionKeyword_OnMouseUp" Foreground="Blue" Text="key" x:Name="pluginActionKeyword"></TextBlock>
|
||||
<TextBlock Margin="5 0 0 0" ToolTip="Change Action Keyword" Cursor="Hand" MouseUp="PluginActionKeywords_OnMouseUp" Foreground="Blue" Text="key" x:Name="pluginActionKeywords"></TextBlock>
|
||||
<TextBlock Margin="10 0 0 0" Text="Init time: 0ms" x:Name="pluginInitTime"></TextBlock>
|
||||
<TextBlock Margin="10 0 0 0" Text="Query time: 0ms" x:Name="pluginQueryTime"></TextBlock>
|
||||
<TextBlock HorizontalAlignment="Right" Cursor="Hand" MouseUp="tbOpenPluginDirecoty_MouseUp" Foreground="Blue" Text="{DynamicResource pluginDirectory}" x:Name="tbOpenPluginDirecoty"></TextBlock>
|
||||
@ -234,7 +234,7 @@
|
||||
<GridViewColumn Header="{DynamicResource actionKeyword}" Width="500">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding ActionKeyword}"/>
|
||||
<TextBlock Text="{Binding ActionKeywords}"/>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
@ -527,7 +527,7 @@ namespace Wox
|
||||
{
|
||||
provider = pair.Plugin as ISettingProvider;
|
||||
pluginAuthor.Visibility = Visibility.Visible;
|
||||
pluginActionKeyword.Visibility = Visibility.Visible;
|
||||
pluginActionKeywords.Visibility = Visibility.Visible;
|
||||
pluginInitTime.Text =
|
||||
string.Format(InternationalizationManager.Instance.GetTranslation("plugin_init_time"), pair.InitTime);
|
||||
pluginQueryTime.Text =
|
||||
@ -536,7 +536,7 @@ namespace Wox
|
||||
tbOpenPluginDirecoty.Visibility = Visibility.Visible;
|
||||
pluginTitle.Text = pair.Metadata.Name;
|
||||
pluginTitle.Cursor = Cursors.Hand;
|
||||
pluginActionKeyword.Text = pair.Metadata.ActionKeyword;
|
||||
pluginActionKeywords.Text = string.Join(Query.ActionKeywordSeperater, pair.Metadata.ActionKeywords);
|
||||
pluginAuthor.Text = InternationalizationManager.Instance.GetTranslation("author") + ": " + pair.Metadata.Author;
|
||||
pluginSubTitle.Text = pair.Metadata.Description;
|
||||
pluginId = pair.Metadata.ID;
|
||||
@ -578,12 +578,13 @@ namespace Wox
|
||||
var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == id);
|
||||
if (customizedPluginConfig == null)
|
||||
{
|
||||
// todo when this part will be invoked
|
||||
UserSettingStorage.Instance.CustomizedPluginConfigs.Add(new CustomizedPluginConfig()
|
||||
{
|
||||
Disabled = cbDisabled.IsChecked ?? true,
|
||||
ID = id,
|
||||
Name = name,
|
||||
Actionword = string.Empty
|
||||
ActionKeywords = null
|
||||
});
|
||||
}
|
||||
else
|
||||
@ -593,7 +594,7 @@ namespace Wox
|
||||
UserSettingStorage.Instance.Save();
|
||||
}
|
||||
|
||||
private void PluginActionKeyword_OnMouseUp(object sender, MouseButtonEventArgs e)
|
||||
private void PluginActionKeywords_OnMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
{
|
||||
@ -602,10 +603,10 @@ namespace Wox
|
||||
{
|
||||
//third-party plugin
|
||||
string id = pair.Metadata.ID;
|
||||
ActionKeyword changeKeywordWindow = new ActionKeyword(id);
|
||||
changeKeywordWindow.ShowDialog();
|
||||
ActionKeywords changeKeywordsWindow = new ActionKeywords(id);
|
||||
changeKeywordsWindow.ShowDialog();
|
||||
PluginPair plugin = PluginManager.GetPlugin(id);
|
||||
if (plugin != null) pluginActionKeyword.Text = plugin.Metadata.ActionKeyword;
|
||||
if (plugin != null) pluginActionKeywords.Text = string.Join(Query.ActionKeywordSeperater, pair.Metadata.ActionKeywords);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -126,8 +126,8 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="ActionKeyword.xaml.cs">
|
||||
<DependentUpon>ActionKeyword.xaml</DependentUpon>
|
||||
<Compile Include="ActionKeywords.xaml.cs">
|
||||
<DependentUpon>ActionKeywords.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CommandArgs\CommandArgsFactory.cs" />
|
||||
<Compile Include="CommandArgs\HideStartCommandArg.cs" />
|
||||
@ -160,7 +160,7 @@
|
||||
<Compile Include="SettingWindow.xaml.cs">
|
||||
<DependentUpon>SettingWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="ActionKeyword.xaml">
|
||||
<Page Include="ActionKeywords.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
@ -374,5 +374,4 @@ cd "$(TargetDir)Plugins" & del /s /q WindowsInput.dll
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user