Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qutrits committed Sep 19, 2024
1 parent 77a446c commit 3242871
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Views/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,12 @@ private void btnTestProxyConnection_Click(object sender, EventArgs e) {
return;
}
((MetroButton)sender).Enabled = false;
this.chkUseProxy.Enabled = false;
this.txtProxyAddress.Enabled = false;
this.txtProxyPort.Enabled = false;
this.chkUseProxyLoginRequired.Enabled = false;
this.txtProxyUsername.Enabled = false;
this.txtProxyPassword.Enabled = false;

WebProxy webproxy = new WebProxy($"{this.txtProxyAddress.Text}:{(!string.IsNullOrEmpty(this.txtProxyPort.Text) ? this.txtProxyPort.Text : "80")}", false) {
BypassProxyOnLocal = false
Expand All @@ -883,6 +889,12 @@ private void btnTestProxyConnection_Click(object sender, EventArgs e) {
if (this.chkUseProxyLoginRequired.Checked) {
if (string.IsNullOrEmpty(this.txtProxyUsername.Text) || string.IsNullOrEmpty(this.txtProxyPassword.Text)) {
((MetroButton)sender).Enabled = true;
this.chkUseProxy.Enabled = true;
this.txtProxyAddress.Enabled = this.chkUseProxy.Checked;
this.txtProxyPort.Enabled = this.chkUseProxy.Checked;
this.chkUseProxyLoginRequired.Enabled = this.chkUseProxy.Checked;
this.txtProxyUsername.Enabled = this.chkUseProxyLoginRequired.Checked;
this.txtProxyPassword.Enabled = this.chkUseProxyLoginRequired.Checked;
return;
}
webproxy.Credentials = new NetworkCredential(this.txtProxyUsername.Text, this.txtProxyPassword.Text);
Expand All @@ -903,6 +915,12 @@ private void btnTestProxyConnection_Click(object sender, EventArgs e) {
this.picProxyTextResult.Image = isOk ? Properties.Resources.checkmark_icon : Properties.Resources.uncheckmark_icon;
this.picProxyTextResult.Visible = true;
((MetroButton)sender).Enabled = true;
this.chkUseProxy.Enabled = true;
this.txtProxyAddress.Enabled = this.chkUseProxy.Checked;
this.txtProxyPort.Enabled = this.chkUseProxy.Checked;
this.chkUseProxyLoginRequired.Enabled = this.chkUseProxy.Checked;
this.txtProxyUsername.Enabled = this.chkUseProxyLoginRequired.Checked;
this.txtProxyPassword.Enabled = this.chkUseProxyLoginRequired.Checked;
});
}
} catch {
Expand All @@ -912,6 +930,12 @@ private void btnTestProxyConnection_Click(object sender, EventArgs e) {
this.picProxyTextResult.Image = Properties.Resources.uncheckmark_icon;
this.picProxyTextResult.Visible = true;
((MetroButton)sender).Enabled = true;
this.chkUseProxy.Enabled = true;
this.txtProxyAddress.Enabled = this.chkUseProxy.Checked;
this.txtProxyPort.Enabled = this.chkUseProxy.Checked;
this.chkUseProxyLoginRequired.Enabled = this.chkUseProxy.Checked;
this.txtProxyUsername.Enabled = this.chkUseProxyLoginRequired.Checked;
this.txtProxyPassword.Enabled = this.chkUseProxyLoginRequired.Checked;
});
}
});
Expand Down

0 comments on commit 3242871

Please sign in to comment.