public void ConnectToProxy(ProxySettingDto proxy) { if (!string.IsNullOrEmpty(proxy.Script)) { _registry.SetValue("AutoConfigURL", proxy.Script); _registry.SetValue("ProxyEnable", 0); } else { _registry.SetValue("ProxyServer", $"{proxy.IpAddress}:{proxy.Port}"); _registry.SetValue("ProxyEnable", 1); } RefreshProxyChange(); }
private void Save_Click(object sender, EventArgs e) { var proxyToSave = new ProxySettingDto(); proxyToSave.Name = ProxyNameTxt.Text; proxyToSave.IpAddress = IpAddressTxt.Text; proxyToSave.Port = string.IsNullOrEmpty(PortTxt.Text) ? 0 : int.Parse(PortTxt.Text); proxyToSave.Script = ScriptTxt.Text; if (_proxyId.HasValue) { proxyToSave.ProxySettingId = _proxyId.Value; _proxySettingService.Update(proxyToSave); } else { _proxySettingService.Insert(proxyToSave); } Close(); }