mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
Refactoring proxy, part 2
This commit is contained in:
@@ -113,7 +113,7 @@ namespace Wox.Plugin.PluginManagement
|
|||||||
string json;
|
string json;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
json = Http.Get(pluginSearchUrl + pluginName, context.Proxy).Result;
|
json = Http.Get(pluginSearchUrl + pluginName).Result;
|
||||||
}
|
}
|
||||||
catch (WebException e)
|
catch (WebException e)
|
||||||
{
|
{
|
||||||
@@ -156,7 +156,7 @@ namespace Wox.Plugin.PluginManagement
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Http.Download(pluginUrl, filePath, context.Proxy);
|
Http.Download(pluginUrl, filePath);
|
||||||
}
|
}
|
||||||
catch (WebException e)
|
catch (WebException e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
|
|
||||||
private async Task<IEnumerable<Result>> Suggestions(string keyword, string subtitle, WebSearch webSearch)
|
private async Task<IEnumerable<Result>> Suggestions(string keyword, string subtitle, WebSearch webSearch)
|
||||||
{
|
{
|
||||||
var source = SuggestionSource.GetSuggestionSource(_settings.WebSearchSuggestionSource, Context);
|
var source = SuggestionSource.GetSuggestionSource(_settings.WebSearchSuggestionSource);
|
||||||
if (source != null)
|
if (source != null)
|
||||||
{
|
{
|
||||||
var suggestions = await source.GetSuggestions(keyword);
|
var suggestions = await source.GetSuggestions(keyword);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
const string api = "http://suggestion.baidu.com/su?json=1&wd=";
|
const string api = "http://suggestion.baidu.com/su?json=1&wd=";
|
||||||
result = await Http.Get(api + Uri.EscapeUriString(query), Proxy, "GB2312");
|
result = await Http.Get(api + Uri.EscapeUriString(query), "GB2312");
|
||||||
}
|
}
|
||||||
catch (WebException e)
|
catch (WebException e)
|
||||||
{
|
{
|
||||||
@@ -61,9 +61,5 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
|
|||||||
|
|
||||||
return new List<string>();
|
return new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Baidu(IHttpProxy httpProxy) : base(httpProxy)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
const string api = "https://www.google.com/complete/search?output=chrome&q=";
|
const string api = "https://www.google.com/complete/search?output=chrome&q=";
|
||||||
result = await Http.Get(api + Uri.EscapeUriString(query), Proxy);
|
result = await Http.Get(api + Uri.EscapeUriString(query));
|
||||||
}
|
}
|
||||||
catch (WebException e)
|
catch (WebException e)
|
||||||
{
|
{
|
||||||
@@ -48,9 +48,5 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
|
|||||||
}
|
}
|
||||||
return new List<string>();
|
return new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Google(IHttpProxy httpProxy) : base(httpProxy)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,24 +6,18 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
|
|||||||
public abstract class SuggestionSource
|
public abstract class SuggestionSource
|
||||||
{
|
{
|
||||||
public virtual string Domain { get; set; }
|
public virtual string Domain { get; set; }
|
||||||
public IHttpProxy Proxy { get; set; }
|
|
||||||
|
|
||||||
public SuggestionSource(IHttpProxy httpProxy)
|
|
||||||
{
|
|
||||||
Proxy = httpProxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract Task<List<string>> GetSuggestions(string query);
|
public abstract Task<List<string>> GetSuggestions(string query);
|
||||||
|
|
||||||
public static SuggestionSource GetSuggestionSource(string name, PluginInitContext context)
|
public static SuggestionSource GetSuggestionSource(string name)
|
||||||
{
|
{
|
||||||
switch (name.ToLower())
|
switch (name.ToLower())
|
||||||
{
|
{
|
||||||
case "google":
|
case "google":
|
||||||
return new Google(context.Proxy);
|
return new Google();
|
||||||
|
|
||||||
case "baidu":
|
case "baidu":
|
||||||
return new Baidu(context.Proxy);
|
return new Baidu();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
|
||||||
namespace Wox.Core.Plugin
|
namespace Wox.Core.Plugin
|
||||||
@@ -28,7 +27,6 @@ namespace Wox.Core.Plugin
|
|||||||
{
|
{
|
||||||
Method = "query",
|
Method = "query",
|
||||||
Parameters = new object[] { query.Search },
|
Parameters = new object[] { query.Search },
|
||||||
HttpProxy = HttpProxy.Instance
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_startInfo.Arguments = $"\"{request}\"";
|
_startInfo.Arguments = $"\"{request}\"";
|
||||||
|
|||||||
@@ -100,18 +100,6 @@ namespace Wox.Core.Plugin
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class JsonRPCServerRequestModel : JsonRPCRequestModel
|
public class JsonRPCServerRequestModel : JsonRPCRequestModel
|
||||||
{
|
{
|
||||||
public IHttpProxy HttpProxy { get; set; }
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
string rpc = base.ToString();
|
|
||||||
if (HttpProxy != null)
|
|
||||||
{
|
|
||||||
rpc += string.Format(@",\""proxy\"":{{\""enabled\"":{0},\""server\"":\""{1}\"",\""port\"":{2},\""username\"":\""{3}\"",\""password\"":\""{4}\""}}",
|
|
||||||
HttpProxy.Enabled.ToString().ToLower(), HttpProxy.Server, HttpProxy.Port, HttpProxy.UserName, HttpProxy.Password);
|
|
||||||
}
|
|
||||||
return rpc + "}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ using System.Linq;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Wox.Core.Resource;
|
using Wox.Core.Resource;
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
using Wox.Infrastructure;
|
using Wox.Infrastructure;
|
||||||
using Wox.Infrastructure.Exception;
|
using Wox.Infrastructure.Exception;
|
||||||
using Wox.Infrastructure.Logger;
|
using Wox.Infrastructure.Logger;
|
||||||
using Wox.Infrastructure.Storage;
|
using Wox.Infrastructure.Storage;
|
||||||
|
using Wox.Infrastructure.UserSettings;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
|
||||||
namespace Wox.Core.Plugin
|
namespace Wox.Core.Plugin
|
||||||
@@ -83,7 +83,6 @@ namespace Wox.Core.Plugin
|
|||||||
pair.Plugin.Init(new PluginInitContext
|
pair.Plugin.Init(new PluginInitContext
|
||||||
{
|
{
|
||||||
CurrentPluginMetadata = pair.Metadata,
|
CurrentPluginMetadata = pair.Metadata,
|
||||||
Proxy = HttpProxy.Instance,
|
|
||||||
API = API
|
API = API
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
using Wox.Infrastructure.Exception;
|
using Wox.Infrastructure.Exception;
|
||||||
using Wox.Infrastructure.Logger;
|
using Wox.Infrastructure.Logger;
|
||||||
|
using Wox.Infrastructure.UserSettings;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
|
||||||
namespace Wox.Core.Plugin
|
namespace Wox.Core.Plugin
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
|
||||||
namespace Wox.Core.Plugin
|
namespace Wox.Core.Plugin
|
||||||
@@ -28,7 +27,6 @@ namespace Wox.Core.Plugin
|
|||||||
{
|
{
|
||||||
Method = "query",
|
Method = "query",
|
||||||
Parameters = new object[] { query.Search },
|
Parameters = new object[] { query.Search },
|
||||||
HttpProxy = HttpProxy.Instance
|
|
||||||
};
|
};
|
||||||
//Add -B flag to tell python don't write .py[co] files. Because .pyc contains location infos which will prevent python portable
|
//Add -B flag to tell python don't write .py[co] files. Because .pyc contains location infos which will prevent python portable
|
||||||
_startInfo.Arguments = $"-B \"{context.CurrentPluginMetadata.ExecuteFilePath}\" \"{request}\"";
|
_startInfo.Arguments = $"-B \"{context.CurrentPluginMetadata.ExecuteFilePath}\" \"{request}\"";
|
||||||
|
|||||||
@@ -5,13 +5,14 @@ using System.Linq;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Wox.Infrastructure.Exception;
|
using Wox.Infrastructure.Exception;
|
||||||
using Wox.Infrastructure.Logger;
|
using Wox.Infrastructure.Logger;
|
||||||
|
using Wox.Infrastructure.UserSettings;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
|
||||||
namespace Wox.Core.Resource
|
namespace Wox.Core.Resource
|
||||||
{
|
{
|
||||||
public class Internationalization : Resource
|
public class Internationalization : Resource
|
||||||
{
|
{
|
||||||
public UserSettings.Settings Settings { get; set; }
|
public Settings Settings { get; set; }
|
||||||
|
|
||||||
public Internationalization()
|
public Internationalization()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,15 +7,15 @@ using System.Windows;
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
using Wox.Infrastructure.Logger;
|
using Wox.Infrastructure.Logger;
|
||||||
|
using Wox.Infrastructure.UserSettings;
|
||||||
|
|
||||||
namespace Wox.Core.Resource
|
namespace Wox.Core.Resource
|
||||||
{
|
{
|
||||||
public class Theme : Resource
|
public class Theme : Resource
|
||||||
{
|
{
|
||||||
private static List<string> themeDirectories = new List<string>();
|
private static List<string> themeDirectories = new List<string>();
|
||||||
public UserSettings.Settings Settings { get; set; }
|
public Settings Settings { get; set; }
|
||||||
|
|
||||||
public Theme()
|
public Theme()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using System.Threading.Tasks;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Squirrel;
|
using Squirrel;
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
using Wox.Infrastructure.Http;
|
using Wox.Infrastructure.Http;
|
||||||
using Wox.Infrastructure.Logger;
|
using Wox.Infrastructure.Logger;
|
||||||
|
|
||||||
@@ -19,7 +18,7 @@ namespace Wox.Core
|
|||||||
public static async void UpdateApp()
|
public static async void UpdateApp()
|
||||||
{
|
{
|
||||||
|
|
||||||
var client = new WebClient {Proxy = Http.WebProxy(HttpProxy.Instance)};
|
var client = new WebClient {Proxy = Http.WebProxy()};
|
||||||
var downloader = new FileDownloader(client);
|
var downloader = new FileDownloader(client);
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -67,7 +66,7 @@ namespace Wox.Core
|
|||||||
string response;
|
string response;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
response = await Http.Get(githubAPI, HttpProxy.Instance);
|
response = await Http.Get(githubAPI);
|
||||||
}
|
}
|
||||||
catch (WebException e)
|
catch (WebException e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -110,7 +110,6 @@
|
|||||||
<Compile Include="Plugin\ExecutablePlugin.cs" />
|
<Compile Include="Plugin\ExecutablePlugin.cs" />
|
||||||
<Compile Include="Plugin\PluginsLoader.cs" />
|
<Compile Include="Plugin\PluginsLoader.cs" />
|
||||||
<Compile Include="Updater.cs" />
|
<Compile Include="Updater.cs" />
|
||||||
<Compile Include="UserSettings\HttpProxy.cs" />
|
|
||||||
<Compile Include="Resource\AvailableLanguages.cs" />
|
<Compile Include="Resource\AvailableLanguages.cs" />
|
||||||
<Compile Include="Resource\Internationalization.cs" />
|
<Compile Include="Resource\Internationalization.cs" />
|
||||||
<Compile Include="Resource\InternationalizationManager.cs" />
|
<Compile Include="Resource\InternationalizationManager.cs" />
|
||||||
@@ -127,9 +126,6 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Resource\FontHelper.cs" />
|
<Compile Include="Resource\FontHelper.cs" />
|
||||||
<Compile Include="Resource\Theme.cs" />
|
<Compile Include="Resource\Theme.cs" />
|
||||||
<Compile Include="UserSettings\PluginSettings.cs" />
|
|
||||||
<Compile Include="UserSettings\PluginHotkey.cs" />
|
|
||||||
<Compile Include="UserSettings\Settings.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
|
|||||||
@@ -3,26 +3,27 @@ using System.Net;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Wox.Plugin;
|
using Wox.Infrastructure.UserSettings;
|
||||||
|
|
||||||
namespace Wox.Infrastructure.Http
|
namespace Wox.Infrastructure.Http
|
||||||
{
|
{
|
||||||
public static class Http
|
public static class Http
|
||||||
{
|
{
|
||||||
public static IWebProxy WebProxy(IHttpProxy proxy)
|
public static HttpProxy Proxy { private get; set; }
|
||||||
|
public static IWebProxy WebProxy()
|
||||||
{
|
{
|
||||||
if (proxy != null && proxy.Enabled && !string.IsNullOrEmpty(proxy.Server))
|
if (Proxy != null && Proxy.Enabled && !string.IsNullOrEmpty(Proxy.Server))
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(proxy.UserName) || string.IsNullOrEmpty(proxy.Password))
|
if (string.IsNullOrEmpty(Proxy.UserName) || string.IsNullOrEmpty(Proxy.Password))
|
||||||
{
|
{
|
||||||
var webProxy = new WebProxy(proxy.Server, proxy.Port);
|
var webProxy = new WebProxy(Proxy.Server, Proxy.Port);
|
||||||
return webProxy;
|
return webProxy;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var webProxy = new WebProxy(proxy.Server, proxy.Port)
|
var webProxy = new WebProxy(Proxy.Server, Proxy.Port)
|
||||||
{
|
{
|
||||||
Credentials = new NetworkCredential(proxy.UserName, proxy.Password)
|
Credentials = new NetworkCredential(Proxy.UserName, Proxy.Password)
|
||||||
};
|
};
|
||||||
return webProxy;
|
return webProxy;
|
||||||
}
|
}
|
||||||
@@ -34,20 +35,20 @@ namespace Wox.Infrastructure.Http
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <exception cref="WebException">Can't download file </exception>
|
/// <exception cref="WebException">Can't download file </exception>
|
||||||
public static void Download([NotNull] string url, [NotNull] string filePath, IHttpProxy proxy)
|
public static void Download([NotNull] string url, [NotNull] string filePath)
|
||||||
{
|
{
|
||||||
var client = new WebClient { Proxy = WebProxy(proxy) };
|
var client = new WebClient { Proxy = WebProxy() };
|
||||||
client.DownloadFile(url, filePath);
|
client.DownloadFile(url, filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <exception cref="WebException">Can't get response from http get </exception>
|
/// <exception cref="WebException">Can't get response from http get </exception>
|
||||||
public static async Task<string> Get([NotNull] string url, IHttpProxy proxy, string encoding = "UTF-8")
|
public static async Task<string> Get([NotNull] string url, string encoding = "UTF-8")
|
||||||
{
|
{
|
||||||
|
|
||||||
HttpWebRequest request = WebRequest.CreateHttp(url);
|
HttpWebRequest request = WebRequest.CreateHttp(url);
|
||||||
request.Method = "GET";
|
request.Method = "GET";
|
||||||
request.Timeout = 10 * 1000;
|
request.Timeout = 10 * 1000;
|
||||||
request.Proxy = WebProxy(proxy);
|
request.Proxy = WebProxy();
|
||||||
request.UserAgent = @"Mozilla/5.0 (Trident/7.0; rv:11.0) like Gecko";
|
request.UserAgent = @"Mozilla/5.0 (Trident/7.0; rv:11.0) like Gecko";
|
||||||
var response = await request.GetResponseAsync() as HttpWebResponse;
|
var response = await request.GetResponseAsync() as HttpWebResponse;
|
||||||
if (response != null)
|
if (response != null)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
|
||||||
namespace Wox.Core.UserSettings
|
namespace Wox.Infrastructure.UserSettings
|
||||||
{
|
{
|
||||||
public class CustomPluginHotkey : BaseModel
|
public class CustomPluginHotkey : BaseModel
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
|
||||||
namespace Wox.Core.UserSettings
|
namespace Wox.Infrastructure.UserSettings
|
||||||
{
|
{
|
||||||
public class PluginsSettings : BaseModel
|
public class PluginsSettings : BaseModel
|
||||||
{
|
{
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
|
||||||
namespace Wox.Core.UserSettings
|
namespace Wox.Infrastructure.UserSettings
|
||||||
{
|
{
|
||||||
public class Settings : BaseModel
|
public class Settings : BaseModel
|
||||||
{
|
{
|
||||||
@@ -49,12 +48,7 @@ namespace Wox.Core.UserSettings
|
|||||||
public bool RememberLastLaunchLocation { get; set; }
|
public bool RememberLastLaunchLocation { get; set; }
|
||||||
public bool IgnoreHotkeysOnFullscreen { get; set; }
|
public bool IgnoreHotkeysOnFullscreen { get; set; }
|
||||||
|
|
||||||
public string ProxyServer { get; set; }
|
public HttpProxy Proxy { get; set; } = new HttpProxy();
|
||||||
public bool ProxyEnabled { get; set; }
|
|
||||||
public int ProxyPort { get; set; }
|
|
||||||
public string ProxyUserName { get; set; }
|
|
||||||
public string ProxyPassword { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
@@ -92,6 +92,10 @@
|
|||||||
<Compile Include="Hotkey\HotkeyModel.cs" />
|
<Compile Include="Hotkey\HotkeyModel.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Alphabet.cs" />
|
<Compile Include="Alphabet.cs" />
|
||||||
|
<Compile Include="UserSettings\HttpProxy.cs" />
|
||||||
|
<Compile Include="UserSettings\PluginHotkey.cs" />
|
||||||
|
<Compile Include="UserSettings\PluginSettings.cs" />
|
||||||
|
<Compile Include="UserSettings\Settings.cs" />
|
||||||
<Compile Include="Wox.cs" />
|
<Compile Include="Wox.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
namespace Wox.Plugin
|
|
||||||
{
|
|
||||||
public interface IHttpProxy
|
|
||||||
{
|
|
||||||
bool Enabled { get; }
|
|
||||||
string Server { get; }
|
|
||||||
int Port { get; }
|
|
||||||
string UserName { get; }
|
|
||||||
string Password { get; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace Wox.Plugin
|
using System;
|
||||||
|
|
||||||
|
namespace Wox.Plugin
|
||||||
{
|
{
|
||||||
public class PluginInitContext
|
public class PluginInitContext
|
||||||
{
|
{
|
||||||
@@ -8,7 +10,5 @@
|
|||||||
/// Public APIs for plugin invocation
|
/// Public APIs for plugin invocation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IPublicAPI API { get; set; }
|
public IPublicAPI API { get; set; }
|
||||||
|
|
||||||
public IHttpProxy Proxy { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,6 @@
|
|||||||
<Compile Include="Features\IContextMenu.cs" />
|
<Compile Include="Features\IContextMenu.cs" />
|
||||||
<Compile Include="Features\IExclusiveQuery.cs" />
|
<Compile Include="Features\IExclusiveQuery.cs" />
|
||||||
<Compile Include="Features\IInstantQuery.cs" />
|
<Compile Include="Features\IInstantQuery.cs" />
|
||||||
<Compile Include="IHttpProxy.cs" />
|
|
||||||
<Compile Include="IPlugin.cs" />
|
<Compile Include="IPlugin.cs" />
|
||||||
<Compile Include="IPublicAPI.cs" />
|
<Compile Include="IPublicAPI.cs" />
|
||||||
<Compile Include="ISettingProvider.cs" />
|
<Compile Include="ISettingProvider.cs" />
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Wox.Core.Plugin;
|
using Wox.Core.Plugin;
|
||||||
using Wox.Core.Resource;
|
using Wox.Core.Resource;
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
using Wox.Infrastructure.Exception;
|
using Wox.Infrastructure.Exception;
|
||||||
|
using Wox.Infrastructure.UserSettings;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
|
||||||
namespace Wox
|
namespace Wox
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ using System.Timers;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Wox.Core;
|
using Wox.Core;
|
||||||
using Wox.Core.Plugin;
|
using Wox.Core.Plugin;
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
using Wox.Helper;
|
using Wox.Helper;
|
||||||
using Wox.Infrastructure.Image;
|
using Wox.Infrastructure.Image;
|
||||||
using Wox.Infrastructure.Logger;
|
using Wox.Infrastructure.Logger;
|
||||||
|
using Wox.Infrastructure.UserSettings;
|
||||||
using Wox.ViewModel;
|
using Wox.ViewModel;
|
||||||
using Stopwatch = Wox.Infrastructure.Stopwatch;
|
using Stopwatch = Wox.Infrastructure.Stopwatch;
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ using System.Windows;
|
|||||||
using NHotkey;
|
using NHotkey;
|
||||||
using NHotkey.Wpf;
|
using NHotkey.Wpf;
|
||||||
using Wox.Core.Resource;
|
using Wox.Core.Resource;
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
using Wox.Infrastructure.Hotkey;
|
using Wox.Infrastructure.Hotkey;
|
||||||
|
using Wox.Infrastructure.UserSettings;
|
||||||
|
|
||||||
namespace Wox
|
namespace Wox
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,9 +59,9 @@
|
|||||||
<system:String x:Key="deleteCustomHotkeyWarning">Wollen Sie die {0} Plugin Tastenkombination wirklich löschen?</system:String>
|
<system:String x:Key="deleteCustomHotkeyWarning">Wollen Sie die {0} Plugin Tastenkombination wirklich löschen?</system:String>
|
||||||
|
|
||||||
<!--Setting Proxy-->
|
<!--Setting Proxy-->
|
||||||
<system:String x:Key="proxy">Proxy</system:String>
|
<system:String x:Key="proxy">HTTP Proxy</system:String>
|
||||||
<system:String x:Key="enableProxy">Aktiviere Proxy</system:String>
|
<system:String x:Key="enableProxy">Aktiviere HTTP Proxy</system:String>
|
||||||
<system:String x:Key="server">Server</system:String>
|
<system:String x:Key="server">HTTP Server</system:String>
|
||||||
<system:String x:Key="port">Port</system:String>
|
<system:String x:Key="port">Port</system:String>
|
||||||
<system:String x:Key="userName">Benutzername</system:String>
|
<system:String x:Key="userName">Benutzername</system:String>
|
||||||
<system:String x:Key="password">Passwort</system:String>
|
<system:String x:Key="password">Passwort</system:String>
|
||||||
|
|||||||
@@ -59,9 +59,9 @@
|
|||||||
<system:String x:Key="deleteCustomHotkeyWarning">Are you sure you want to delete {0} plugin hotkey?</system:String>
|
<system:String x:Key="deleteCustomHotkeyWarning">Are you sure you want to delete {0} plugin hotkey?</system:String>
|
||||||
|
|
||||||
<!--Setting Proxy-->
|
<!--Setting Proxy-->
|
||||||
<system:String x:Key="proxy">Proxy</system:String>
|
<system:String x:Key="proxy">HTTP Proxy</system:String>
|
||||||
<system:String x:Key="enableProxy">Enable Proxy</system:String>
|
<system:String x:Key="enableProxy">Enable HTTP Proxy</system:String>
|
||||||
<system:String x:Key="server">Server</system:String>
|
<system:String x:Key="server">HTTP Server</system:String>
|
||||||
<system:String x:Key="port">Port</system:String>
|
<system:String x:Key="port">Port</system:String>
|
||||||
<system:String x:Key="userName">User Name</system:String>
|
<system:String x:Key="userName">User Name</system:String>
|
||||||
<system:String x:Key="password">Password</system:String>
|
<system:String x:Key="password">Password</system:String>
|
||||||
|
|||||||
@@ -59,9 +59,9 @@
|
|||||||
<system:String x:Key="deleteCustomHotkeyWarning">Voulez-vous vraiment supprimer {0} raccourci(s) ?</system:String>
|
<system:String x:Key="deleteCustomHotkeyWarning">Voulez-vous vraiment supprimer {0} raccourci(s) ?</system:String>
|
||||||
|
|
||||||
<!--Setting Proxy-->
|
<!--Setting Proxy-->
|
||||||
<system:String x:Key="proxy">Proxy</system:String>
|
<system:String x:Key="proxy">HTTP Proxy</system:String>
|
||||||
<system:String x:Key="enableProxy">Activer le proxy</system:String>
|
<system:String x:Key="enableProxy">Activer le HTTP proxy</system:String>
|
||||||
<system:String x:Key="server">Serveur</system:String>
|
<system:String x:Key="server">HTTP Serveur</system:String>
|
||||||
<system:String x:Key="port">Port</system:String>
|
<system:String x:Key="port">Port</system:String>
|
||||||
<system:String x:Key="userName">Utilisateur</system:String>
|
<system:String x:Key="userName">Utilisateur</system:String>
|
||||||
<system:String x:Key="password">Mot de passe</system:String>
|
<system:String x:Key="password">Mot de passe</system:String>
|
||||||
|
|||||||
@@ -59,9 +59,9 @@
|
|||||||
<system:String x:Key="deleteCustomHotkeyWarning">{0} プラグインのホットキーを本当に削除しますか?</system:String>
|
<system:String x:Key="deleteCustomHotkeyWarning">{0} プラグインのホットキーを本当に削除しますか?</system:String>
|
||||||
|
|
||||||
<!--Setting Proxy-->
|
<!--Setting Proxy-->
|
||||||
<system:String x:Key="proxy">プロキシ</system:String>
|
<system:String x:Key="proxy">HTTP プロキシ</system:String>
|
||||||
<system:String x:Key="enableProxy">プロキシを有効化</system:String>
|
<system:String x:Key="enableProxy">HTTP プロキシを有効化</system:String>
|
||||||
<system:String x:Key="server">サーバ</system:String>
|
<system:String x:Key="server">HTTP サーバ</system:String>
|
||||||
<system:String x:Key="port">ポート</system:String>
|
<system:String x:Key="port">ポート</system:String>
|
||||||
<system:String x:Key="userName">ユーザ名</system:String>
|
<system:String x:Key="userName">ユーザ名</system:String>
|
||||||
<system:String x:Key="password">パスワード</system:String>
|
<system:String x:Key="password">パスワード</system:String>
|
||||||
|
|||||||
@@ -59,9 +59,9 @@
|
|||||||
<system:String x:Key="deleteCustomHotkeyWarning">Weet u zeker dat je {0} plugin sneltoets wilt verwijderen?</system:String>
|
<system:String x:Key="deleteCustomHotkeyWarning">Weet u zeker dat je {0} plugin sneltoets wilt verwijderen?</system:String>
|
||||||
|
|
||||||
<!--Setting Proxy-->
|
<!--Setting Proxy-->
|
||||||
<system:String x:Key="proxy">Proxy</system:String>
|
<system:String x:Key="proxy">HTTP Proxy</system:String>
|
||||||
<system:String x:Key="enableProxy">Enable Proxy</system:String>
|
<system:String x:Key="enableProxy">Enable HTTP Proxy</system:String>
|
||||||
<system:String x:Key="server">Server</system:String>
|
<system:String x:Key="server">HTTP Server</system:String>
|
||||||
<system:String x:Key="port">Poort</system:String>
|
<system:String x:Key="port">Poort</system:String>
|
||||||
<system:String x:Key="userName">Gebruikersnaam</system:String>
|
<system:String x:Key="userName">Gebruikersnaam</system:String>
|
||||||
<system:String x:Key="password">Wachtwoord</system:String>
|
<system:String x:Key="password">Wachtwoord</system:String>
|
||||||
|
|||||||
@@ -59,9 +59,9 @@
|
|||||||
<system:String x:Key="deleteCustomHotkeyWarning">Czy jesteś pewien że chcesz usunąć skrót klawiszowy {0} wtyczki?</system:String>
|
<system:String x:Key="deleteCustomHotkeyWarning">Czy jesteś pewien że chcesz usunąć skrót klawiszowy {0} wtyczki?</system:String>
|
||||||
|
|
||||||
<!--Setting Proxy-->
|
<!--Setting Proxy-->
|
||||||
<system:String x:Key="proxy">Serwer proxy</system:String>
|
<system:String x:Key="proxy">Serwer proxy HTTP</system:String>
|
||||||
<system:String x:Key="enableProxy">Używaj proxy</system:String>
|
<system:String x:Key="enableProxy">Używaj HTTP proxy</system:String>
|
||||||
<system:String x:Key="server">Serwer</system:String>
|
<system:String x:Key="server">HTTP Serwer</system:String>
|
||||||
<system:String x:Key="port">Port</system:String>
|
<system:String x:Key="port">Port</system:String>
|
||||||
<system:String x:Key="userName">Nazwa użytkownika</system:String>
|
<system:String x:Key="userName">Nazwa użytkownika</system:String>
|
||||||
<system:String x:Key="password">Hasło</system:String>
|
<system:String x:Key="password">Hasło</system:String>
|
||||||
|
|||||||
@@ -59,9 +59,9 @@
|
|||||||
<system:String x:Key="deleteCustomHotkeyWarning">Вы уверены что хотите удалить горячую клавишу для плагина {0}?</system:String>
|
<system:String x:Key="deleteCustomHotkeyWarning">Вы уверены что хотите удалить горячую клавишу для плагина {0}?</system:String>
|
||||||
|
|
||||||
<!--Setting Proxy-->
|
<!--Setting Proxy-->
|
||||||
<system:String x:Key="proxy">Прокси</system:String>
|
<system:String x:Key="proxy">HTTP Прокси</system:String>
|
||||||
<system:String x:Key="enableProxy">Включить прокси</system:String>
|
<system:String x:Key="enableProxy">Включить HTTP прокси</system:String>
|
||||||
<system:String x:Key="server">Сервер</system:String>
|
<system:String x:Key="server">HTTP Сервер</system:String>
|
||||||
<system:String x:Key="port">Порт</system:String>
|
<system:String x:Key="port">Порт</system:String>
|
||||||
<system:String x:Key="userName">Логин</system:String>
|
<system:String x:Key="userName">Логин</system:String>
|
||||||
<system:String x:Key="password">Пароль</system:String>
|
<system:String x:Key="password">Пароль</system:String>
|
||||||
|
|||||||
@@ -59,9 +59,9 @@
|
|||||||
<system:String x:Key="deleteCustomHotkeyWarning">你确定要删除插件 {0} 的热键吗?</system:String>
|
<system:String x:Key="deleteCustomHotkeyWarning">你确定要删除插件 {0} 的热键吗?</system:String>
|
||||||
|
|
||||||
<!--设置,代理-->
|
<!--设置,代理-->
|
||||||
<system:String x:Key="proxy">代理</system:String>
|
<system:String x:Key="proxy">HTTP 代理</system:String>
|
||||||
<system:String x:Key="enableProxy">启用代理</system:String>
|
<system:String x:Key="enableProxy">启用 HTTP 代理</system:String>
|
||||||
<system:String x:Key="server">服务器</system:String>
|
<system:String x:Key="server">HTTP 服务器</system:String>
|
||||||
<system:String x:Key="port">端口</system:String>
|
<system:String x:Key="port">端口</system:String>
|
||||||
<system:String x:Key="userName">用户名</system:String>
|
<system:String x:Key="userName">用户名</system:String>
|
||||||
<system:String x:Key="password">密码</system:String>
|
<system:String x:Key="password">密码</system:String>
|
||||||
|
|||||||
@@ -59,9 +59,9 @@
|
|||||||
<system:String x:Key="deleteCustomHotkeyWarning">確定要刪除外掛 {0} 的熱鍵嗎?</system:String>
|
<system:String x:Key="deleteCustomHotkeyWarning">確定要刪除外掛 {0} 的熱鍵嗎?</system:String>
|
||||||
|
|
||||||
<!--設置,代理-->
|
<!--設置,代理-->
|
||||||
<system:String x:Key="proxy">代理</system:String>
|
<system:String x:Key="proxy">HTTP 代理</system:String>
|
||||||
<system:String x:Key="enableProxy">啟用代理</system:String>
|
<system:String x:Key="enableProxy">啟用 HTTP 代理</system:String>
|
||||||
<system:String x:Key="server">伺服器</system:String>
|
<system:String x:Key="server">HTTP 伺服器</system:String>
|
||||||
<system:String x:Key="Port">Port</system:String>
|
<system:String x:Key="Port">Port</system:String>
|
||||||
<system:String x:Key="userName">使用者</system:String>
|
<system:String x:Key="userName">使用者</system:String>
|
||||||
<system:String x:Key="password">密碼</system:String>
|
<system:String x:Key="password">密碼</system:String>
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ using System.Windows.Media.Animation;
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using Wox.Core.Plugin;
|
using Wox.Core.Plugin;
|
||||||
using Wox.Core.Resource;
|
using Wox.Core.Resource;
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
using Wox.Helper;
|
using Wox.Helper;
|
||||||
|
using Wox.Infrastructure.UserSettings;
|
||||||
using Wox.ViewModel;
|
using Wox.ViewModel;
|
||||||
using Screen = System.Windows.Forms.Screen;
|
using Screen = System.Windows.Forms.Screen;
|
||||||
using ContextMenu = System.Windows.Forms.ContextMenu;
|
using ContextMenu = System.Windows.Forms.ContextMenu;
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:wox="clr-namespace:Wox"
|
xmlns:wox="clr-namespace:Wox"
|
||||||
xmlns:s="clr-namespace:Wox.Core.UserSettings;assembly=Wox.Core"
|
|
||||||
xmlns:vm="clr-namespace:Wox.ViewModel"
|
xmlns:vm="clr-namespace:Wox.ViewModel"
|
||||||
|
xmlns:userSettings="clr-namespace:Wox.Infrastructure.UserSettings;assembly=Wox.Infrastructure"
|
||||||
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
x:Class="Wox.SettingWindow"
|
x:Class="Wox.SettingWindow"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Icon="Images\app.png"
|
Icon="Images\app.png"
|
||||||
@@ -276,14 +277,14 @@
|
|||||||
<GridView>
|
<GridView>
|
||||||
<GridViewColumn Header="{DynamicResource hotkey}" Width="180">
|
<GridViewColumn Header="{DynamicResource hotkey}" Width="180">
|
||||||
<GridViewColumn.CellTemplate>
|
<GridViewColumn.CellTemplate>
|
||||||
<DataTemplate DataType="s:CustomPluginHotkey">
|
<DataTemplate DataType="userSettings:CustomPluginHotkey">
|
||||||
<TextBlock Text="{Binding Hotkey}" />
|
<TextBlock Text="{Binding Hotkey}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</GridViewColumn.CellTemplate>
|
</GridViewColumn.CellTemplate>
|
||||||
</GridViewColumn>
|
</GridViewColumn>
|
||||||
<GridViewColumn Header="{DynamicResource actionKeywords}" Width="500">
|
<GridViewColumn Header="{DynamicResource actionKeywords}" Width="500">
|
||||||
<GridViewColumn.CellTemplate>
|
<GridViewColumn.CellTemplate>
|
||||||
<DataTemplate DataType="s:CustomPluginHotkey">
|
<DataTemplate DataType="userSettings:CustomPluginHotkey">
|
||||||
<TextBlock Text="{Binding ActionKeyword}" />
|
<TextBlock Text="{Binding ActionKeyword}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</GridViewColumn.CellTemplate>
|
</GridViewColumn.CellTemplate>
|
||||||
@@ -304,10 +305,10 @@
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="{DynamicResource proxy}">
|
<TabItem Header="{DynamicResource proxy}">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<CheckBox Margin="10" IsChecked="{Binding Settings.ProxyEnabled}">
|
<CheckBox Margin="10" IsChecked="{Binding Settings.Proxy.Enabled}">
|
||||||
<TextBlock Text="{DynamicResource enableProxy}" />
|
<TextBlock Text="{DynamicResource enableProxy}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
<Grid Margin="10" IsEnabled="{Binding Settings.ProxyEnabled}">
|
<Grid Margin="10" IsEnabled="{Binding Settings.Proxy.Enabled}">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
@@ -319,15 +320,15 @@
|
|||||||
<ColumnDefinition Width="200" />
|
<ColumnDefinition Width="200" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Text="{DynamicResource server}" Grid.Row="0" Grid.Column="0" Padding="5" />
|
<TextBlock Text="{DynamicResource server}" Grid.Row="0" Grid.Column="0" Padding="5" />
|
||||||
<TextBox Text="{Binding Settings.ProxyServer}" Grid.Row="0" Grid.Column="1" Padding="5" />
|
<TextBox Text="{Binding Settings.Proxy.Server}" Grid.Row="0" Grid.Column="1" Padding="5" />
|
||||||
<TextBlock Text="{DynamicResource port}" Grid.Row="0" Grid.Column="2" Padding="5" />
|
<TextBlock Text="{DynamicResource port}" Grid.Row="0" Grid.Column="2" Padding="5" />
|
||||||
<TextBox Text="{Binding Settings.ProxyPort}" Grid.Row="0" Grid.Column="3" Padding="5" />
|
<TextBox Text="{Binding Settings.Proxy.Port, TargetNullValue={x:Static sys:String.Empty} }" Grid.Row="0" Grid.Column="3" Padding="5" />
|
||||||
<TextBlock Text="{DynamicResource userName}" Grid.Row="1" Grid.Column="0" Padding="5" />
|
<TextBlock Text="{DynamicResource userName}" Grid.Row="1" Grid.Column="0" Padding="5" />
|
||||||
<TextBox Text="{Binding Settings.ProxyUserName}" Grid.Row="1" Grid.Column="1" Padding="5" />
|
<TextBox Text="{Binding Settings.Proxy.UserName}" Grid.Row="1" Grid.Column="1" Padding="5" />
|
||||||
<TextBlock Text="{DynamicResource password}" Grid.Row="1" Grid.Column="2" Padding="5" />
|
<TextBlock Text="{DynamicResource password}" Grid.Row="1" Grid.Column="2" Padding="5" />
|
||||||
<TextBox Text="{Binding Settings.ProxyPassword}" Grid.Row="1" Grid.Column="3" Padding="5" />
|
<TextBox Text="{Binding Settings.Proxy.Password}" Grid.Row="1" Grid.Column="3" Padding="5" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Button Content="{DynamicResource testProxy}" IsEnabled="{Binding Settings.ProxyEnabled}"
|
<Button Content="{DynamicResource testProxy}" IsEnabled="{Binding Settings.Proxy.Enabled}"
|
||||||
Width="80" HorizontalAlignment="Left" Margin="10" Click="OnTestProxyClick" />
|
Width="80" HorizontalAlignment="Left" Margin="10" Click="OnTestProxyClick" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ using NHotkey.Wpf;
|
|||||||
using Wox.Core;
|
using Wox.Core;
|
||||||
using Wox.Core.Plugin;
|
using Wox.Core.Plugin;
|
||||||
using Wox.Core.Resource;
|
using Wox.Core.Resource;
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
using Wox.Infrastructure.Hotkey;
|
using Wox.Infrastructure.Hotkey;
|
||||||
|
using Wox.Infrastructure.UserSettings;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
using Wox.ViewModel;
|
using Wox.ViewModel;
|
||||||
|
|
||||||
@@ -264,29 +264,27 @@ namespace Wox
|
|||||||
|
|
||||||
private void OnTestProxyClick(object sender, RoutedEventArgs e)
|
private void OnTestProxyClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(_settings.ProxyServer))
|
if (string.IsNullOrEmpty(_settings.Proxy.Server))
|
||||||
{
|
{
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("serverCantBeEmpty"));
|
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("serverCantBeEmpty"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_settings.ProxyPort > 0)
|
if (_settings.Proxy.Port <= 0)
|
||||||
{
|
{
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("portCantBeEmpty"));
|
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("portCantBeEmpty"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Infrastructure.Constant.Github);
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Infrastructure.Constant.Github);
|
||||||
request.Timeout = 1000 * 5;
|
if (string.IsNullOrEmpty(_settings.Proxy.UserName) || string.IsNullOrEmpty(_settings.Proxy.Password))
|
||||||
request.ReadWriteTimeout = 1000 * 5;
|
|
||||||
if (string.IsNullOrEmpty(_settings.ProxyUserName) || string.IsNullOrEmpty(_settings.ProxyPassword))
|
|
||||||
{
|
{
|
||||||
request.Proxy = new WebProxy(_settings.ProxyServer, _settings.ProxyPort);
|
request.Proxy = new WebProxy(_settings.Proxy.Server, _settings.Proxy.Port);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
request.Proxy = new WebProxy(_settings.ProxyServer, _settings.ProxyPort)
|
request.Proxy = new WebProxy(_settings.Proxy.Server, _settings.Proxy.Port)
|
||||||
{
|
{
|
||||||
Credentials = new NetworkCredential(_settings.ProxyUserName, _settings.ProxyPassword)
|
Credentials = new NetworkCredential(_settings.Proxy.UserName, _settings.Proxy.Password)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ using NHotkey;
|
|||||||
using NHotkey.Wpf;
|
using NHotkey.Wpf;
|
||||||
using Wox.Core.Plugin;
|
using Wox.Core.Plugin;
|
||||||
using Wox.Core.Resource;
|
using Wox.Core.Resource;
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
using Wox.Helper;
|
using Wox.Helper;
|
||||||
using Wox.Infrastructure;
|
using Wox.Infrastructure;
|
||||||
using Wox.Infrastructure.Hotkey;
|
using Wox.Infrastructure.Hotkey;
|
||||||
using Wox.Infrastructure.Image;
|
using Wox.Infrastructure.Image;
|
||||||
using Wox.Infrastructure.Storage;
|
using Wox.Infrastructure.Storage;
|
||||||
|
using Wox.Infrastructure.UserSettings;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
using Wox.Storage;
|
using Wox.Storage;
|
||||||
|
|
||||||
@@ -57,12 +57,6 @@ namespace Wox.ViewModel
|
|||||||
|
|
||||||
_settings = settings;
|
_settings = settings;
|
||||||
|
|
||||||
// happlebao todo temp fix for instance code logic
|
|
||||||
HttpProxy.Instance.Settings = _settings;
|
|
||||||
InternationalizationManager.Instance.Settings = _settings;
|
|
||||||
InternationalizationManager.Instance.ChangeLanguage(_settings.Language);
|
|
||||||
ThemeManager.Instance.Settings = _settings;
|
|
||||||
|
|
||||||
_queryHistoryStorage = new JsonStrorage<QueryHistory>();
|
_queryHistoryStorage = new JsonStrorage<QueryHistory>();
|
||||||
_userSelectedRecordStorage = new JsonStrorage<UserSelectedRecord>();
|
_userSelectedRecordStorage = new JsonStrorage<UserSelectedRecord>();
|
||||||
_topMostRecordStorage = new JsonStrorage<TopMostRecord>();
|
_topMostRecordStorage = new JsonStrorage<TopMostRecord>();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using Wox.Core.UserSettings;
|
using Wox.Infrastructure.UserSettings;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
|
||||||
namespace Wox.ViewModel
|
namespace Wox.ViewModel
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ using System.Windows.Media;
|
|||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using Wox.Core.Plugin;
|
using Wox.Core.Plugin;
|
||||||
using Wox.Core.Resource;
|
using Wox.Core.Resource;
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
using Wox.Helper;
|
using Wox.Helper;
|
||||||
using Wox.Infrastructure;
|
using Wox.Infrastructure;
|
||||||
|
using Wox.Infrastructure.Http;
|
||||||
using Wox.Infrastructure.Storage;
|
using Wox.Infrastructure.Storage;
|
||||||
|
using Wox.Infrastructure.UserSettings;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
|
||||||
namespace Wox.ViewModel
|
namespace Wox.ViewModel
|
||||||
@@ -31,6 +32,12 @@ namespace Wox.ViewModel
|
|||||||
OnPropertyChanged(nameof(ActivatedTimes));
|
OnPropertyChanged(nameof(ActivatedTimes));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// happlebao todo temp fix for instance code logic
|
||||||
|
InternationalizationManager.Instance.Settings = Settings;
|
||||||
|
InternationalizationManager.Instance.ChangeLanguage(Settings.Language);
|
||||||
|
ThemeManager.Instance.Settings = Settings;
|
||||||
|
Http.Proxy = Settings.Proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Settings Settings { get; set; }
|
public Settings Settings { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user