private void saveBtn_Click(object sender, EventArgs e)
        {
            var newHost = this.proxyUrlTxt.Text;
            var newPort = this.proxyPortTxt.Text;

            ProxyEntry entry;

            if (!string.IsNullOrWhiteSpace(newHost))
            {
                if (!string.IsNullOrWhiteSpace(newPort))
                {
                    int testVal = 0;
                    if (int.TryParse(newPort, out testVal))
                    {
                        entry = new ProxyEntry(newHost, testVal);
                    }
                    else
                    {
                        entry = new ProxyEntry(newHost);
                    }
                }
                else
                {
                    entry = new ProxyEntry(newHost);
                }

                ProxyControl.SetProxy(entry);
            }

            this.Close();
        }
Beispiel #2
0
 public static void SetProxy(ProxyEntry proxy)
 {
     Registry.SetValue(keyName, "ProxyServer", proxy.ToString());
     ensureRefresh();
 }