mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Refactoring proxy, part 2
This commit is contained in:
@@ -14,8 +14,8 @@ using NHotkey.Wpf;
|
||||
using Wox.Core;
|
||||
using Wox.Core.Plugin;
|
||||
using Wox.Core.Resource;
|
||||
using Wox.Core.UserSettings;
|
||||
using Wox.Infrastructure.Hotkey;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
using Wox.Plugin;
|
||||
using Wox.ViewModel;
|
||||
|
||||
@@ -264,29 +264,27 @@ namespace Wox
|
||||
|
||||
private void OnTestProxyClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_settings.ProxyServer))
|
||||
if (string.IsNullOrEmpty(_settings.Proxy.Server))
|
||||
{
|
||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("serverCantBeEmpty"));
|
||||
return;
|
||||
}
|
||||
if (_settings.ProxyPort > 0)
|
||||
if (_settings.Proxy.Port <= 0)
|
||||
{
|
||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("portCantBeEmpty"));
|
||||
return;
|
||||
}
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Infrastructure.Constant.Github);
|
||||
request.Timeout = 1000 * 5;
|
||||
request.ReadWriteTimeout = 1000 * 5;
|
||||
if (string.IsNullOrEmpty(_settings.ProxyUserName) || string.IsNullOrEmpty(_settings.ProxyPassword))
|
||||
if (string.IsNullOrEmpty(_settings.Proxy.UserName) || string.IsNullOrEmpty(_settings.Proxy.Password))
|
||||
{
|
||||
request.Proxy = new WebProxy(_settings.ProxyServer, _settings.ProxyPort);
|
||||
request.Proxy = new WebProxy(_settings.Proxy.Server, _settings.Proxy.Port);
|
||||
}
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user