mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Move some user settings to its own dll (cmd,folder plugin and etc)
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Wox.Core.UserSettings;
|
||||
using Wox.Infrastructure.Http;
|
||||
|
||||
namespace Wox.Plugin.WebSearch.SuggestionSources
|
||||
@@ -14,7 +15,7 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
|
||||
|
||||
public override List<string> GetSuggestions(string query)
|
||||
{
|
||||
var result = HttpRequest.Get("http://suggestion.baidu.com/su?json=1&wd=" + Uri.EscapeUriString(query), "GB2312");
|
||||
var result = HttpRequest.Get("http://suggestion.baidu.com/su?json=1&wd=" + Uri.EscapeUriString(query), HttpProxy.Instance, "GB2312");
|
||||
if (string.IsNullOrEmpty(result)) return new List<string>();
|
||||
|
||||
Match match = reg.Match(result);
|
||||
@@ -23,9 +24,9 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
|
||||
JContainer json = null;
|
||||
try
|
||||
{
|
||||
json =JsonConvert.DeserializeObject(match.Groups[1].Value) as JContainer;
|
||||
json = JsonConvert.DeserializeObject(match.Groups[1].Value) as JContainer;
|
||||
}
|
||||
catch{}
|
||||
catch { }
|
||||
|
||||
if (json != null)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Wox.Core.UserSettings;
|
||||
using Wox.Infrastructure.Http;
|
||||
|
||||
namespace Wox.Plugin.WebSearch.SuggestionSources
|
||||
@@ -11,7 +12,7 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
|
||||
{
|
||||
public override List<string> GetSuggestions(string query)
|
||||
{
|
||||
var result = HttpRequest.Get("https://www.google.com/complete/search?output=chrome&q=" + Uri.EscapeUriString(query));
|
||||
var result = HttpRequest.Get("https://www.google.com/complete/search?output=chrome&q=" + Uri.EscapeUriString(query),HttpProxy.Instance);
|
||||
if (string.IsNullOrEmpty(result)) return new List<string>();
|
||||
|
||||
try
|
||||
|
||||
@@ -2,7 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Wox.Infrastructure.Storage.UserSettings;
|
||||
using Wox.Core.UserSettings;
|
||||
using Wox.Plugin.WebSearch.SuggestionSources;
|
||||
|
||||
namespace Wox.Plugin.WebSearch
|
||||
@@ -15,7 +15,7 @@ namespace Wox.Plugin.WebSearch
|
||||
{
|
||||
List<Result> results = new List<Result>();
|
||||
|
||||
Infrastructure.Storage.UserSettings.WebSearch webSearch =
|
||||
Core.UserSettings.WebSearch webSearch =
|
||||
UserSettingStorage.Instance.WebSearches.FirstOrDefault(o => o.ActionWord == query.ActionName && o.Enabled);
|
||||
|
||||
if (webSearch != null)
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Microsoft.Win32;
|
||||
using Wox.Infrastructure.Storage.UserSettings;
|
||||
using Wox.Core.UserSettings;
|
||||
|
||||
namespace Wox.Plugin.WebSearch
|
||||
{
|
||||
@@ -14,7 +14,7 @@ namespace Wox.Plugin.WebSearch
|
||||
private string defaultWebSearchImageDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images\\websearch");
|
||||
private WebSearchesSetting settingWindow;
|
||||
private bool update;
|
||||
private Infrastructure.Storage.UserSettings.WebSearch updateWebSearch;
|
||||
private Core.UserSettings.WebSearch updateWebSearch;
|
||||
|
||||
public WebSearchSetting(WebSearchesSetting settingWidow)
|
||||
{
|
||||
@@ -22,7 +22,7 @@ namespace Wox.Plugin.WebSearch
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void UpdateItem(Infrastructure.Storage.UserSettings.WebSearch webSearch)
|
||||
public void UpdateItem(Core.UserSettings.WebSearch webSearch)
|
||||
{
|
||||
updateWebSearch = UserSettingStorage.Instance.WebSearches.FirstOrDefault(o => o == webSearch);
|
||||
if (updateWebSearch == null || string.IsNullOrEmpty(updateWebSearch.Url))
|
||||
@@ -89,7 +89,7 @@ namespace Wox.Plugin.WebSearch
|
||||
MessageBox.Show("ActionWord has existed, please input a new one.");
|
||||
return;
|
||||
}
|
||||
UserSettingStorage.Instance.WebSearches.Add(new Infrastructure.Storage.UserSettings.WebSearch()
|
||||
UserSettingStorage.Instance.WebSearches.Add(new Core.UserSettings.WebSearch()
|
||||
{
|
||||
ActionWord = action,
|
||||
Enabled = cbEnable.IsChecked ?? false,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Wox.Infrastructure.Storage.UserSettings;
|
||||
using Wox.Core.UserSettings;
|
||||
|
||||
namespace Wox.Plugin.WebSearch
|
||||
{
|
||||
@@ -54,7 +54,7 @@ namespace Wox.Plugin.WebSearch
|
||||
|
||||
private void btnDeleteWebSearch_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Infrastructure.Storage.UserSettings.WebSearch selectedWebSearch = webSearchView.SelectedItem as Infrastructure.Storage.UserSettings.WebSearch;
|
||||
Core.UserSettings.WebSearch selectedWebSearch = webSearchView.SelectedItem as Core.UserSettings.WebSearch;
|
||||
if (selectedWebSearch != null)
|
||||
{
|
||||
if (MessageBox.Show("Are your sure to delete " + selectedWebSearch.Title, "Delete WebSearch",
|
||||
@@ -72,7 +72,7 @@ namespace Wox.Plugin.WebSearch
|
||||
|
||||
private void btnEditWebSearch_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Infrastructure.Storage.UserSettings.WebSearch selectedWebSearch = webSearchView.SelectedItem as Infrastructure.Storage.UserSettings.WebSearch;
|
||||
Core.UserSettings.WebSearch selectedWebSearch = webSearchView.SelectedItem as Core.UserSettings.WebSearch;
|
||||
if (selectedWebSearch != null)
|
||||
{
|
||||
WebSearchSetting webSearch = new WebSearchSetting(this);
|
||||
|
||||
@@ -77,6 +77,10 @@
|
||||
<WCFMetadata Include="Service References\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Wox.Core\Wox.Core.csproj">
|
||||
<Project>{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}</Project>
|
||||
<Name>Wox.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
|
||||
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
|
||||
<Name>Wox.Infrastructure</Name>
|
||||
|
||||
Reference in New Issue
Block a user