1
0
mirror of https://github.com/Ylianst/MeshCentralRouter synced 2025-12-06 00:13:33 +00:00
Files
MeshCentralRouter/ProxySettings.cs
jbfuzier cdb04cf032 Proxy related changes
Removed some duplicate proxy related code
Added manual http proxy settings with basic auth support
2021-10-19 18:43:00 +02:00

70 lines
2.4 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MeshCentralRouter
{
public partial class ProxySettings : Form
{
public ProxySettings()
{
InitializeComponent();
useManualProxySettings.Checked = Settings.GetRegValue("Use_Manual_Http_proxy", false);
manualHttpProxyHost.Text = Settings.GetRegValue("Manual_Http_proxy_host", "");
manualHttpProxyPort.Text = Settings.GetRegValue("Manual_Http_proxy_port", "");
manualHttpProxyUsername.Text = Settings.GetRegValue("Manual_Http_proxy_username", "");
manualHttpProxyPassword.Text = Settings.GetRegValue("Manual_Http_proxy_password", "");
checkbox_refresh_form();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void SaveProxyConfig_Click(object sender, EventArgs e)
{
Settings.SetRegValue("Use_Manual_Http_proxy", useManualProxySettings.Checked);
Settings.SetRegValue("Manual_Http_proxy_host", manualHttpProxyHost.Text);
Settings.SetRegValue("Manual_Http_proxy_port", manualHttpProxyPort.Text);
Settings.SetRegValue("Manual_Http_proxy_username", manualHttpProxyUsername.Text);
Settings.SetRegValue("Manual_Http_proxy_password", manualHttpProxyPassword.Text);
DialogResult = DialogResult.OK;
}
private void checkbox_refresh_form()
{
if (useManualProxySettings.Checked)
{
manualHttpProxyHost.ReadOnly = false;
manualHttpProxyPort.ReadOnly = false;
manualHttpProxyUsername.ReadOnly = false;
manualHttpProxyPassword.ReadOnly = false;
}
else
{
manualHttpProxyHost.ReadOnly = true;
manualHttpProxyPort.ReadOnly = true;
manualHttpProxyUsername.ReadOnly = true;
manualHttpProxyPassword.ReadOnly = true;
}
}
private void useManualProxySettings_CheckedChanged(object sender, EventArgs e)
{
checkbox_refresh_form();
}
private void cancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
}
}