Browse Source

Switch configuration enable button (#2460)

Fix shadowsocks/shadowsocks-windows/#2458
tags/4.1.7.1
Silence Tai celeron533 5 years ago
parent
commit
ecd59c8f57
1 changed files with 8 additions and 5 deletions
  1. +8
    -5
      shadowsocks-csharp/View/ConfigForm.cs

+ 8
- 5
shadowsocks-csharp/View/ConfigForm.cs View File

@@ -15,6 +15,8 @@ namespace Shadowsocks.View
private Configuration _modifiedConfiguration;
private int _lastSelectedIndex = -1;
private bool isChange = false;
public ConfigForm(ShadowsocksController controller)
{
Font = SystemFonts.MessageBoxFont;
@@ -85,6 +87,7 @@ namespace Shadowsocks.View
private void ConfigValueChanged(object sender, EventArgs e)
{
isChange = true;
ApplyButton.Enabled = true;
}
@@ -178,7 +181,7 @@ namespace Shadowsocks.View
if (result == DialogResult.OK)
return null;
}
else if (ApplyButton.Enabled && !isSave && !isCopy)
else if (isChange && !isSave && !isCopy)
{
var result = MessageBox.Show(I18N.GetString("Invalid server address, Cannot automatically save or discard changes"), I18N.GetString("Auto save failed"), MessageBoxButtons.OKCancel);
@@ -216,7 +219,7 @@ namespace Shadowsocks.View
if (result == DialogResult.OK)
return null;
}
else if (!isSave && !isCopy)
else if (isChange && !isSave && !isCopy)
{
var result = MessageBox.Show(I18N.GetString("Illegal port number format, Cannot automatically save or discard changes"), I18N.GetString("Auto save failed"), MessageBoxButtons.OKCancel);
@@ -255,7 +258,7 @@ namespace Shadowsocks.View
if (result == DialogResult.OK)
return null;
}
else if (ApplyButton.Enabled && !isSave && !isCopy)
else if (isChange && !isSave && !isCopy)
{
var result = MessageBox.Show(I18N.GetString("Password can not be blank, Cannot automatically save or discard changes"), I18N.GetString("Auto save failed"), MessageBoxButtons.OKCancel);
@@ -293,7 +296,7 @@ namespace Shadowsocks.View
if (result == DialogResult.OK)
return null;
}
else if (ApplyButton.Enabled && !isSave && !isCopy)
else if (isChange && !isSave && !isCopy)
{
var result = MessageBox.Show(I18N.GetString("Illegal timeout format, Cannot automatically save or discard changes"), I18N.GetString("Auto save failed"), MessageBoxButtons.OKCancel);
@@ -347,7 +350,7 @@ namespace Shadowsocks.View
RemarksTextBox.Text = server.remarks;
TimeoutTextBox.Text = server.timeout.ToString();
ApplyButton.Enabled = false;
isChange = false;
}
private void ShowHidePluginArgInput(bool show)


Loading…
Cancel
Save