private void btnProxySettings_Click(object sender, EventArgs e) { if (Session.showDialog <proxySettingsDialog>(this) == DialogResult.OK) { _cachedProxySettings = (proxySettings)Session.dialogResultCache[typeof(proxySettingsDialog)]; } }
private void btnSaveSettings_Click(object sender, System.EventArgs e) { var newProxySettings = new proxySettings { Server = txtServer.Text, Port = int.Parse(txtPort.Text), Username = txtUsername.Text, Password = txtPassword.Text, proxyMode = rbSystemProxy.Checked ? proxyModes.useSystemDefaults : proxyModes.useCustomSettings }; if (rbNoAuth.Checked) { newProxySettings.Authentication = proxyAuthentication.None; } else if (rbWinAuth.Checked) { newProxySettings.Authentication = proxyAuthentication.NetworkCredentials; } else if (rbCustomAuth.Checked) { newProxySettings.Authentication = proxyAuthentication.Custom; } Result = newProxySettings; DialogResult = DialogResult.OK; Close(); }