mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
Move web search setting to its own project
This commit is contained in:
@@ -45,18 +45,18 @@ namespace Wox.Plugin.PluginIndicator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
results.AddRange(UserSettingStorage.Instance.WebSearches.Where(o => o.ActionWord.StartsWith(query.Search) && o.Enabled).Select(n => new Result()
|
//results.AddRange(UserSettingStorage.Instance.WebSearches.Where(o => o.ActionWord.StartsWith(query.Search) && o.Enabled).Select(n => new Result()
|
||||||
{
|
//{
|
||||||
Title = n.ActionWord,
|
// Title = n.ActionWord,
|
||||||
SubTitle = string.Format("Activate {0} web search", n.ActionWord),
|
// SubTitle = string.Format("Activate {0} web search", n.ActionWord),
|
||||||
Score = 100,
|
// Score = 100,
|
||||||
IcoPath = "Images/work.png",
|
// IcoPath = "Images/work.png",
|
||||||
Action = (c) =>
|
// Action = (c) =>
|
||||||
{
|
// {
|
||||||
context.API.ChangeQuery(n.ActionWord + " ");
|
// context.API.ChangeQuery(n.ActionWord + " ");
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}));
|
//}));
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Wox.Core.UserSettings
|
namespace Wox.Plugin.WebSearch
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class WebSearch
|
public class WebSearch
|
||||||
@@ -17,8 +17,8 @@ namespace Wox.Plugin.WebSearch
|
|||||||
{
|
{
|
||||||
List<Result> results = new List<Result>();
|
List<Result> results = new List<Result>();
|
||||||
|
|
||||||
Core.UserSettings.WebSearch webSearch =
|
WebSearch webSearch =
|
||||||
UserSettingStorage.Instance.WebSearches.FirstOrDefault(o => o.ActionWord == query.FirstSearch.Trim() && o.Enabled);
|
WebSearchStorage.Instance.WebSearches.FirstOrDefault(o => o.ActionWord == query.FirstSearch.Trim() && o.Enabled);
|
||||||
|
|
||||||
if (webSearch != null)
|
if (webSearch != null)
|
||||||
{
|
{
|
||||||
@@ -46,10 +46,10 @@ namespace Wox.Plugin.WebSearch
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (UserSettingStorage.Instance.EnableWebSearchSuggestion && !string.IsNullOrEmpty(keyword))
|
if (WebSearchStorage.Instance.EnableWebSearchSuggestion && !string.IsNullOrEmpty(keyword))
|
||||||
{
|
{
|
||||||
ISuggestionSource sugg = SuggestionSourceFactory.GetSuggestionSource(
|
ISuggestionSource sugg = SuggestionSourceFactory.GetSuggestionSource(
|
||||||
UserSettingStorage.Instance.WebSearchSuggestionSource);
|
WebSearchStorage.Instance.WebSearchSuggestionSource);
|
||||||
if (sugg != null)
|
if (sugg != null)
|
||||||
{
|
{
|
||||||
var result = sugg.GetSuggestions(keyword);
|
var result = sugg.GetSuggestions(keyword);
|
||||||
@@ -80,8 +80,8 @@ namespace Wox.Plugin.WebSearch
|
|||||||
{
|
{
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
|
||||||
if (UserSettingStorage.Instance.WebSearches == null)
|
if (WebSearchStorage.Instance.WebSearches == null)
|
||||||
UserSettingStorage.Instance.WebSearches = UserSettingStorage.Instance.LoadDefaultWebSearches();
|
WebSearchStorage.Instance.WebSearches = WebSearchStorage.Instance.LoadDefaultWebSearches();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region ISettingProvider Members
|
#region ISettingProvider Members
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
private string defaultWebSearchImageDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images\\websearch");
|
private string defaultWebSearchImageDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images\\websearch");
|
||||||
private WebSearchesSetting settingWindow;
|
private WebSearchesSetting settingWindow;
|
||||||
private bool update;
|
private bool update;
|
||||||
private Core.UserSettings.WebSearch updateWebSearch;
|
private WebSearch updateWebSearch;
|
||||||
private PluginInitContext context;
|
private PluginInitContext context;
|
||||||
|
|
||||||
public WebSearchSetting(WebSearchesSetting settingWidow,PluginInitContext context)
|
public WebSearchSetting(WebSearchesSetting settingWidow,PluginInitContext context)
|
||||||
@@ -24,9 +24,9 @@ namespace Wox.Plugin.WebSearch
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateItem(Core.UserSettings.WebSearch webSearch)
|
public void UpdateItem(WebSearch webSearch)
|
||||||
{
|
{
|
||||||
updateWebSearch = UserSettingStorage.Instance.WebSearches.FirstOrDefault(o => o == webSearch);
|
updateWebSearch = WebSearchStorage.Instance.WebSearches.FirstOrDefault(o => o == webSearch);
|
||||||
if (updateWebSearch == null || string.IsNullOrEmpty(updateWebSearch.Url))
|
if (updateWebSearch == null || string.IsNullOrEmpty(updateWebSearch.Url))
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -91,13 +91,13 @@ namespace Wox.Plugin.WebSearch
|
|||||||
|
|
||||||
if (!update)
|
if (!update)
|
||||||
{
|
{
|
||||||
if (UserSettingStorage.Instance.WebSearches.Exists(o => o.ActionWord == action))
|
if (WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionWord == action))
|
||||||
{
|
{
|
||||||
string warning = context.API.GetTranslation("wox_plugin_websearch_action_keyword_exist");
|
string warning = context.API.GetTranslation("wox_plugin_websearch_action_keyword_exist");
|
||||||
MessageBox.Show(warning);
|
MessageBox.Show(warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UserSettingStorage.Instance.WebSearches.Add(new Core.UserSettings.WebSearch()
|
WebSearchStorage.Instance.WebSearches.Add(new WebSearch()
|
||||||
{
|
{
|
||||||
ActionWord = action,
|
ActionWord = action,
|
||||||
Enabled = cbEnable.IsChecked ?? false,
|
Enabled = cbEnable.IsChecked ?? false,
|
||||||
@@ -110,7 +110,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (UserSettingStorage.Instance.WebSearches.Exists(o => o.ActionWord == action && o != updateWebSearch))
|
if (WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionWord == action && o != updateWebSearch))
|
||||||
{
|
{
|
||||||
string warning = context.API.GetTranslation("wox_plugin_websearch_action_keyword_exist");
|
string warning = context.API.GetTranslation("wox_plugin_websearch_action_keyword_exist");
|
||||||
MessageBox.Show(warning);
|
MessageBox.Show(warning);
|
||||||
|
|||||||
78
Plugins/Wox.Plugin.WebSearch/WebSearchStorage.cs
Normal file
78
Plugins/Wox.Plugin.WebSearch/WebSearchStorage.cs
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Wox.Core.UserSettings;
|
||||||
|
using Wox.Infrastructure.Storage;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.WebSearch
|
||||||
|
{
|
||||||
|
public class WebSearchStorage :JsonStrorage<WebSearchStorage>
|
||||||
|
{
|
||||||
|
[JsonProperty]
|
||||||
|
public List<WebSearch> WebSearches { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
|
public bool EnableWebSearchSuggestion { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
|
public string WebSearchSuggestionSource { get; set; }
|
||||||
|
|
||||||
|
protected override string ConfigFolder
|
||||||
|
{
|
||||||
|
get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string ConfigName
|
||||||
|
{
|
||||||
|
get { return "setting"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override WebSearchStorage LoadDefault()
|
||||||
|
{
|
||||||
|
WebSearches = LoadDefaultWebSearches();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<WebSearch> LoadDefaultWebSearches()
|
||||||
|
{
|
||||||
|
List<WebSearch> webSearches = new List<WebSearch>();
|
||||||
|
|
||||||
|
WebSearch googleWebSearch = new WebSearch()
|
||||||
|
{
|
||||||
|
Title = "Google",
|
||||||
|
ActionWord = "g",
|
||||||
|
IconPath = @"Images\websearch\google.png",
|
||||||
|
Url = "https://www.google.com/search?q={q}",
|
||||||
|
Enabled = true
|
||||||
|
};
|
||||||
|
webSearches.Add(googleWebSearch);
|
||||||
|
|
||||||
|
|
||||||
|
WebSearch wikiWebSearch = new WebSearch()
|
||||||
|
{
|
||||||
|
Title = "Wikipedia",
|
||||||
|
ActionWord = "wiki",
|
||||||
|
IconPath = @"Images\websearch\wiki.png",
|
||||||
|
Url = "http://en.wikipedia.org/wiki/{q}",
|
||||||
|
Enabled = true
|
||||||
|
};
|
||||||
|
webSearches.Add(wikiWebSearch);
|
||||||
|
|
||||||
|
WebSearch findIcon = new WebSearch()
|
||||||
|
{
|
||||||
|
Title = "FindIcon",
|
||||||
|
ActionWord = "findicon",
|
||||||
|
IconPath = @"Images\websearch\pictures.png",
|
||||||
|
Url = "http://findicons.com/search/{q}",
|
||||||
|
Enabled = true
|
||||||
|
};
|
||||||
|
webSearches.Add(findIcon);
|
||||||
|
|
||||||
|
return webSearches;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,9 +24,9 @@ namespace Wox.Plugin.WebSearch
|
|||||||
|
|
||||||
private void Setting_Loaded(object sender, RoutedEventArgs e)
|
private void Setting_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
webSearchView.ItemsSource = UserSettingStorage.Instance.WebSearches;
|
webSearchView.ItemsSource = WebSearchStorage.Instance.WebSearches;
|
||||||
cbEnableWebSearchSuggestion.IsChecked = UserSettingStorage.Instance.EnableWebSearchSuggestion;
|
cbEnableWebSearchSuggestion.IsChecked = WebSearchStorage.Instance.EnableWebSearchSuggestion;
|
||||||
comboBoxSuggestionSource.Visibility = UserSettingStorage.Instance.EnableWebSearchSuggestion
|
comboBoxSuggestionSource.Visibility = WebSearchStorage.Instance.EnableWebSearchSuggestion
|
||||||
? Visibility.Visible
|
? Visibility.Visible
|
||||||
: Visibility.Collapsed;
|
: Visibility.Collapsed;
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
new ComboBoxItem() {Content = "Google"},
|
new ComboBoxItem() {Content = "Google"},
|
||||||
new ComboBoxItem() {Content = "Baidu"},
|
new ComboBoxItem() {Content = "Baidu"},
|
||||||
};
|
};
|
||||||
ComboBoxItem selected = items.FirstOrDefault(o => o.Content.ToString() == UserSettingStorage.Instance.WebSearchSuggestionSource);
|
ComboBoxItem selected = items.FirstOrDefault(o => o.Content.ToString() == WebSearchStorage.Instance.WebSearchSuggestionSource);
|
||||||
if (selected == null)
|
if (selected == null)
|
||||||
{
|
{
|
||||||
selected = items[0];
|
selected = items[0];
|
||||||
@@ -58,14 +58,14 @@ namespace Wox.Plugin.WebSearch
|
|||||||
|
|
||||||
private void btnDeleteWebSearch_OnClick(object sender, RoutedEventArgs e)
|
private void btnDeleteWebSearch_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Core.UserSettings.WebSearch selectedWebSearch = webSearchView.SelectedItem as Core.UserSettings.WebSearch;
|
WebSearch selectedWebSearch = webSearchView.SelectedItem as WebSearch;
|
||||||
if (selectedWebSearch != null)
|
if (selectedWebSearch != null)
|
||||||
{
|
{
|
||||||
string msg = string.Format(context.API.GetTranslation("wox_plugin_websearch_delete_warning"),selectedWebSearch.Title);
|
string msg = string.Format(context.API.GetTranslation("wox_plugin_websearch_delete_warning"),selectedWebSearch.Title);
|
||||||
|
|
||||||
if (MessageBox.Show(msg,string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
if (MessageBox.Show(msg,string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||||
{
|
{
|
||||||
UserSettingStorage.Instance.WebSearches.Remove(selectedWebSearch);
|
WebSearchStorage.Instance.WebSearches.Remove(selectedWebSearch);
|
||||||
webSearchView.Items.Refresh();
|
webSearchView.Items.Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
|
|
||||||
private void btnEditWebSearch_OnClick(object sender, RoutedEventArgs e)
|
private void btnEditWebSearch_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Core.UserSettings.WebSearch selectedWebSearch = webSearchView.SelectedItem as Core.UserSettings.WebSearch;
|
WebSearch selectedWebSearch = webSearchView.SelectedItem as WebSearch;
|
||||||
if (selectedWebSearch != null)
|
if (selectedWebSearch != null)
|
||||||
{
|
{
|
||||||
WebSearchSetting webSearch = new WebSearchSetting(this,context);
|
WebSearchSetting webSearch = new WebSearchSetting(this,context);
|
||||||
@@ -95,23 +95,22 @@ namespace Wox.Plugin.WebSearch
|
|||||||
private void CbEnableWebSearchSuggestion_OnChecked(object sender, RoutedEventArgs e)
|
private void CbEnableWebSearchSuggestion_OnChecked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
comboBoxSuggestionSource.Visibility = Visibility.Visible;
|
comboBoxSuggestionSource.Visibility = Visibility.Visible;
|
||||||
UserSettingStorage.Instance.EnableWebSearchSuggestion = true;
|
WebSearchStorage.Instance.EnableWebSearchSuggestion = true;
|
||||||
UserSettingStorage.Instance.Save();
|
WebSearchStorage.Instance.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CbEnableWebSearchSuggestion_OnUnchecked(object sender, RoutedEventArgs e)
|
private void CbEnableWebSearchSuggestion_OnUnchecked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
comboBoxSuggestionSource.Visibility = Visibility.Collapsed;
|
comboBoxSuggestionSource.Visibility = Visibility.Collapsed;
|
||||||
UserSettingStorage.Instance.EnableWebSearchSuggestion = false;
|
WebSearchStorage.Instance.EnableWebSearchSuggestion = false;
|
||||||
UserSettingStorage.Instance.Save();
|
WebSearchStorage.Instance.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ComboBoxSuggestionSource_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void ComboBoxSuggestionSource_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.AddedItems.Count > 0)
|
if (e.AddedItems.Count > 0)
|
||||||
{
|
{
|
||||||
UserSettingStorage.Instance.WebSearchSuggestionSource =
|
WebSearchStorage.Instance.WebSearchSuggestionSource = ((ComboBoxItem) e.AddedItems[0]).Content.ToString();
|
||||||
((ComboBoxItem) e.AddedItems[0]).Content.ToString();
|
|
||||||
UserSettingStorage.Instance.Save();
|
UserSettingStorage.Instance.Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,145 +1,147 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{403B57F2-1856-4FC7-8A24-36AB346B763E}</ProjectGuid>
|
<ProjectGuid>{403B57F2-1856-4FC7-8A24-36AB346B763E}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Wox.Plugin.WebSearch</RootNamespace>
|
<RootNamespace>Wox.Plugin.WebSearch</RootNamespace>
|
||||||
<AssemblyName>Wox.Plugin.WebSearch</AssemblyName>
|
<AssemblyName>Wox.Plugin.WebSearch</AssemblyName>
|
||||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
||||||
<RestorePackages>true</RestorePackages>
|
<RestorePackages>true</RestorePackages>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.WebSearch\</OutputPath>
|
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.WebSearch\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.WebSearch\</OutputPath>
|
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.WebSearch\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xaml" />
|
<Reference Include="System.Xaml" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="SuggestionSources\Baidu.cs" />
|
<Compile Include="SuggestionSources\Baidu.cs" />
|
||||||
<Compile Include="SuggestionSources\Google.cs" />
|
<Compile Include="SuggestionSources\Google.cs" />
|
||||||
<Compile Include="SuggestionSources\ISuggestionSource.cs" />
|
<Compile Include="SuggestionSources\ISuggestionSource.cs" />
|
||||||
<Compile Include="SuggestionSources\SuggestionSourceFactory.cs" />
|
<Compile Include="SuggestionSources\SuggestionSourceFactory.cs" />
|
||||||
<Compile Include="WebSearchesSetting.xaml.cs">
|
<Compile Include="WebSearch.cs" />
|
||||||
<DependentUpon>WebSearchesSetting.xaml</DependentUpon>
|
<Compile Include="WebSearchesSetting.xaml.cs">
|
||||||
</Compile>
|
<DependentUpon>WebSearchesSetting.xaml</DependentUpon>
|
||||||
<Compile Include="WebSearchPlugin.cs" />
|
</Compile>
|
||||||
<Compile Include="WebSearchSetting.xaml.cs">
|
<Compile Include="WebSearchPlugin.cs" />
|
||||||
<DependentUpon>WebSearchSetting.xaml</DependentUpon>
|
<Compile Include="WebSearchSetting.xaml.cs">
|
||||||
</Compile>
|
<DependentUpon>WebSearchSetting.xaml</DependentUpon>
|
||||||
</ItemGroup>
|
</Compile>
|
||||||
<ItemGroup>
|
<Compile Include="WebSearchStorage.cs" />
|
||||||
<Content Include="Languages\en.xaml">
|
</ItemGroup>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<ItemGroup>
|
||||||
<SubType>Designer</SubType>
|
<Content Include="Languages\en.xaml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Content>
|
<SubType>Designer</SubType>
|
||||||
<None Include="Languages\zh-cn.xaml">
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
</Content>
|
||||||
<SubType>Designer</SubType>
|
<None Include="Languages\zh-cn.xaml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</None>
|
<SubType>Designer</SubType>
|
||||||
<None Include="Languages\zh-tw.xaml">
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
</None>
|
||||||
<SubType>Designer</SubType>
|
<None Include="Languages\zh-tw.xaml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</None>
|
<SubType>Designer</SubType>
|
||||||
<Page Include="WebSearchesSetting.xaml">
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
</None>
|
||||||
<SubType>Designer</SubType>
|
<Page Include="WebSearchesSetting.xaml">
|
||||||
</Page>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<Page Include="WebSearchSetting.xaml">
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
</Page>
|
||||||
<SubType>Designer</SubType>
|
<Page Include="WebSearchSetting.xaml">
|
||||||
</Page>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</ItemGroup>
|
<SubType>Designer</SubType>
|
||||||
<ItemGroup>
|
</Page>
|
||||||
<WCFMetadata Include="Service References\" />
|
</ItemGroup>
|
||||||
</ItemGroup>
|
<ItemGroup>
|
||||||
<ItemGroup>
|
<WCFMetadata Include="Service References\" />
|
||||||
<ProjectReference Include="..\..\Wox.Core\Wox.Core.csproj">
|
</ItemGroup>
|
||||||
<Project>{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}</Project>
|
<ItemGroup>
|
||||||
<Name>Wox.Core</Name>
|
<ProjectReference Include="..\..\Wox.Core\Wox.Core.csproj">
|
||||||
</ProjectReference>
|
<Project>{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}</Project>
|
||||||
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
|
<Name>Wox.Core</Name>
|
||||||
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
|
</ProjectReference>
|
||||||
<Name>Wox.Infrastructure</Name>
|
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
|
||||||
</ProjectReference>
|
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
|
||||||
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
|
<Name>Wox.Infrastructure</Name>
|
||||||
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
|
</ProjectReference>
|
||||||
<Name>Wox.Plugin</Name>
|
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
|
||||||
</ProjectReference>
|
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
|
||||||
</ItemGroup>
|
<Name>Wox.Plugin</Name>
|
||||||
<ItemGroup>
|
</ProjectReference>
|
||||||
<None Include="packages.config" />
|
</ItemGroup>
|
||||||
<None Include="plugin.json">
|
<ItemGroup>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<None Include="packages.config" />
|
||||||
</None>
|
<None Include="plugin.json">
|
||||||
</ItemGroup>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<ItemGroup>
|
</None>
|
||||||
<None Include="Images\web_search.png">
|
</ItemGroup>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<ItemGroup>
|
||||||
</None>
|
<None Include="Images\web_search.png">
|
||||||
</ItemGroup>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<ItemGroup>
|
</None>
|
||||||
<None Include="Images\websearch\google.png">
|
</ItemGroup>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<ItemGroup>
|
||||||
</None>
|
<None Include="Images\websearch\google.png">
|
||||||
</ItemGroup>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<ItemGroup>
|
</None>
|
||||||
<None Include="Images\websearch\wiki.png">
|
</ItemGroup>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<ItemGroup>
|
||||||
</None>
|
<None Include="Images\websearch\wiki.png">
|
||||||
</ItemGroup>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
</None>
|
||||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
</ItemGroup>
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||||
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
</PropertyGroup>
|
<PropertyGroup>
|
||||||
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
|
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||||
</Target>
|
</PropertyGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
</Target>
|
||||||
<Target Name="BeforeBuild">
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
</Target>
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="AfterBuild">
|
<Target Name="BeforeBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
</Project>
|
</Project>
|
||||||
@@ -121,13 +121,10 @@ namespace Wox.Core.Plugin
|
|||||||
public static bool IsUserPluginQuery(Query query)
|
public static bool IsUserPluginQuery(Query query)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(query.RawQuery)) return false;
|
if (string.IsNullOrEmpty(query.RawQuery)) return false;
|
||||||
|
|
||||||
var strings = query.RawQuery.Split(' ');
|
var strings = query.RawQuery.Split(' ');
|
||||||
var actionKeyword = string.Empty;
|
if(strings.Length == 1) return false;
|
||||||
if (strings.Length > 0)
|
|
||||||
{
|
var actionKeyword = strings[0].Trim();
|
||||||
actionKeyword = strings[0].Trim();
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(actionKeyword)) return false;
|
if (string.IsNullOrEmpty(actionKeyword)) return false;
|
||||||
|
|
||||||
return plugins.Any(o => o.Metadata.PluginType == PluginType.User && o.Metadata.ActionKeyword == actionKeyword);
|
return plugins.Any(o => o.Metadata.PluginType == PluginType.User && o.Metadata.ActionKeyword == actionKeyword);
|
||||||
|
|||||||
@@ -55,9 +55,6 @@ namespace Wox.Core.UserSettings
|
|||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public string ResultItemFontStretch { get; set; }
|
public string ResultItemFontStretch { get; set; }
|
||||||
|
|
||||||
[JsonProperty]
|
|
||||||
public List<WebSearch> WebSearches { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public double WindowLeft { get; set; }
|
public double WindowLeft { get; set; }
|
||||||
|
|
||||||
@@ -72,18 +69,14 @@ namespace Wox.Core.UserSettings
|
|||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public bool StartWoxOnSystemStartup { get; set; }
|
public bool StartWoxOnSystemStartup { get; set; }
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public double Opacity { get; set; }
|
public double Opacity { get; set; }
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public OpacityMode OpacityMode { get; set; }
|
public OpacityMode OpacityMode { get; set; }
|
||||||
|
|
||||||
[JsonProperty]
|
|
||||||
public bool EnableWebSearchSuggestion { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty]
|
|
||||||
public string WebSearchSuggestionSource { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public bool LeaveCmdOpen { get; set; }
|
public bool LeaveCmdOpen { get; set; }
|
||||||
|
|
||||||
@@ -105,44 +98,6 @@ namespace Wox.Core.UserSettings
|
|||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public string ProxyPassword { get; set; }
|
public string ProxyPassword { get; set; }
|
||||||
|
|
||||||
public List<WebSearch> LoadDefaultWebSearches()
|
|
||||||
{
|
|
||||||
List<WebSearch> webSearches = new List<WebSearch>();
|
|
||||||
|
|
||||||
WebSearch googleWebSearch = new WebSearch()
|
|
||||||
{
|
|
||||||
Title = "Google",
|
|
||||||
ActionWord = "g",
|
|
||||||
IconPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\websearch\google.png",
|
|
||||||
Url = "https://www.google.com/search?q={q}",
|
|
||||||
Enabled = true
|
|
||||||
};
|
|
||||||
webSearches.Add(googleWebSearch);
|
|
||||||
|
|
||||||
|
|
||||||
WebSearch wikiWebSearch = new WebSearch()
|
|
||||||
{
|
|
||||||
Title = "Wikipedia",
|
|
||||||
ActionWord = "wiki",
|
|
||||||
IconPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\websearch\wiki.png",
|
|
||||||
Url = "http://en.wikipedia.org/wiki/{q}",
|
|
||||||
Enabled = true
|
|
||||||
};
|
|
||||||
webSearches.Add(wikiWebSearch);
|
|
||||||
|
|
||||||
WebSearch findIcon = new WebSearch()
|
|
||||||
{
|
|
||||||
Title = "FindIcon",
|
|
||||||
ActionWord = "findicon",
|
|
||||||
IconPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\websearch\pictures.png",
|
|
||||||
Url = "http://findicons.com/search/{q}",
|
|
||||||
Enabled = true
|
|
||||||
};
|
|
||||||
webSearches.Add(findIcon);
|
|
||||||
|
|
||||||
return webSearches;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string ConfigFolder
|
protected override string ConfigFolder
|
||||||
{
|
{
|
||||||
get { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Config"); }
|
get { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Config"); }
|
||||||
@@ -167,7 +122,6 @@ namespace Wox.Core.UserSettings
|
|||||||
DontPromptUpdateMsg = false;
|
DontPromptUpdateMsg = false;
|
||||||
Theme = "Dark";
|
Theme = "Dark";
|
||||||
Language = "en";
|
Language = "en";
|
||||||
WebSearches = LoadDefaultWebSearches();
|
|
||||||
CustomizedPluginConfigs = new List<CustomizedPluginConfig>();
|
CustomizedPluginConfigs = new List<CustomizedPluginConfig>();
|
||||||
Hotkey = "Alt + Space";
|
Hotkey = "Alt + Space";
|
||||||
QueryBoxFont = FontFamily.GenericSansSerif.Name;
|
QueryBoxFont = FontFamily.GenericSansSerif.Name;
|
||||||
|
|||||||
@@ -99,7 +99,6 @@
|
|||||||
<Compile Include="UserSettings\CustomizedPluginConfig.cs" />
|
<Compile Include="UserSettings\CustomizedPluginConfig.cs" />
|
||||||
<Compile Include="UserSettings\PluginHotkey.cs" />
|
<Compile Include="UserSettings\PluginHotkey.cs" />
|
||||||
<Compile Include="UserSettings\UserSettingStorage.cs" />
|
<Compile Include="UserSettings\UserSettingStorage.cs" />
|
||||||
<Compile Include="UserSettings\WebSearch.cs" />
|
|
||||||
<Compile Include="Version\SemanticVersion.cs" />
|
<Compile Include="Version\SemanticVersion.cs" />
|
||||||
<Compile Include="Version\VersionManager.cs" />
|
<Compile Include="Version\VersionManager.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using Wox.Core.Plugin;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
|
||||||
namespace Wox.Test
|
namespace Wox.Test
|
||||||
|
|||||||
@@ -13,12 +13,11 @@
|
|||||||
AllowDrop="True"
|
AllowDrop="True"
|
||||||
ShowInTaskbar="False"
|
ShowInTaskbar="False"
|
||||||
Style="{DynamicResource WindowStyle}"
|
Style="{DynamicResource WindowStyle}"
|
||||||
Icon="Images\app.png"
|
Icon="Images\app.png">
|
||||||
>
|
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<ResourceDictionary Source="/PresentationFramework.Classic,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSIL;component/themes/Classic.xaml"/>
|
<ResourceDictionary Source="/PresentationFramework.Classic,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSIL;component/themes/Classic.xaml"/>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Border Style="{DynamicResource WindowBorderStyle}" MouseDown="Border_OnMouseDown" CornerRadius="0">
|
<Border Style="{DynamicResource WindowBorderStyle}" MouseDown="Border_OnMouseDown">
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<TextBox Style="{DynamicResource QueryBoxStyle}" PreviewDragOver="TbQuery_OnPreviewDragOver" AllowDrop="True"
|
<TextBox Style="{DynamicResource QueryBoxStyle}" PreviewDragOver="TbQuery_OnPreviewDragOver" AllowDrop="True"
|
||||||
x:Name="tbQuery" PreviewKeyDown="TbQuery_OnPreviewKeyDown" TextChanged="TextBoxBase_OnTextChanged" />
|
x:Name="tbQuery" PreviewKeyDown="TbQuery_OnPreviewKeyDown" TextChanged="TextBoxBase_OnTextChanged" />
|
||||||
|
|||||||
@@ -162,10 +162,6 @@ namespace Wox
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ThreadPool.SetMaxThreads(30, 10);
|
ThreadPool.SetMaxThreads(30, 10);
|
||||||
ThreadPool.SetMinThreads(10, 5);
|
ThreadPool.SetMinThreads(10, 5);
|
||||||
if (UserSettingStorage.Instance.OpacityMode == OpacityMode.LayeredWindow)
|
|
||||||
{
|
|
||||||
this.AllowsTransparency = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRequest.RegisterPrefix("data", new DataWebRequestFactory());
|
WebRequest.RegisterPrefix("data", new DataWebRequestFactory());
|
||||||
GlobalHotkey.Instance.hookedKeyboardCallback += KListener_hookedKeyboardCallback;
|
GlobalHotkey.Instance.hookedKeyboardCallback += KListener_hookedKeyboardCallback;
|
||||||
@@ -241,14 +237,6 @@ namespace Wox
|
|||||||
}
|
}
|
||||||
|
|
||||||
InitProgressbarAnimation();
|
InitProgressbarAnimation();
|
||||||
|
|
||||||
//only works for win7+
|
|
||||||
if (UserSettingStorage.Instance.OpacityMode == OpacityMode.DWM)
|
|
||||||
DwmDropShadow.DropShadowToWindow(this);
|
|
||||||
|
|
||||||
this.Background = Brushes.Transparent;
|
|
||||||
HwndSource.FromHwnd(new WindowInteropHelper(this).Handle).CompositionTarget.BackgroundColor = Color.FromArgb(0, 0, 0, 0);
|
|
||||||
|
|
||||||
WindowIntelopHelper.DisableControlBox(this);
|
WindowIntelopHelper.DisableControlBox(this);
|
||||||
UpdaterManager.Instance.CheckUpdate();
|
UpdaterManager.Instance.CheckUpdate();
|
||||||
}
|
}
|
||||||
@@ -354,7 +342,7 @@ namespace Wox
|
|||||||
Query(q);
|
Query(q);
|
||||||
Dispatcher.DelayInvoke("ShowProgressbar", originQuery =>
|
Dispatcher.DelayInvoke("ShowProgressbar", originQuery =>
|
||||||
{
|
{
|
||||||
if (!queryHasReturn && originQuery == lastQuery)
|
if (!queryHasReturn && originQuery == lastQuery && !string.IsNullOrEmpty(lastQuery))
|
||||||
{
|
{
|
||||||
StartProgress();
|
StartProgress();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user