Browse Source

feat: Add apply button for server configuration form.

tags/4.1.6
Kevin2Law 6 years ago
parent
commit
aea690d356
5 changed files with 55 additions and 13 deletions
  1. +1
    -0
      shadowsocks-csharp/Data/ja.txt
  2. +1
    -0
      shadowsocks-csharp/Data/zh_CN.txt
  3. +1
    -0
      shadowsocks-csharp/Data/zh_TW.txt
  4. +24
    -7
      shadowsocks-csharp/View/ConfigForm.Designer.cs
  5. +28
    -6
      shadowsocks-csharp/View/ConfigForm.cs

+ 1
- 0
shadowsocks-csharp/Data/ja.txt View File

@@ -61,6 +61,7 @@ Remarks=付記
Timeout(Sec)=タイムアウト (秒)
OK=OK
Cancel=キャンセル
Apply=適用
New server=新規サーバー
Move &Up=上に移動 (&U)
Move D&own=下に移動 (&O)


+ 1
- 0
shadowsocks-csharp/Data/zh_CN.txt View File

@@ -62,6 +62,7 @@ Remarks=备注
Timeout(Sec)=超时(秒)
OK=确定
Cancel=取消
Apply=应用
New server=未配置的服务器
Move &Up=上移(&U)
Move D&own=下移(&O)


+ 1
- 0
shadowsocks-csharp/Data/zh_TW.txt View File

@@ -61,6 +61,7 @@ Remarks=註解
Timeout(Sec)=逾時 (秒)
OK=確定
Cancel=取消
Apply=應用
New server=新伺服器
Move &Up=上移 (&U)
Move D&own=下移 (&O)


+ 24
- 7
shadowsocks-csharp/View/ConfigForm.Designer.cs View File

@@ -53,6 +53,7 @@
this.panel2 = new System.Windows.Forms.Panel();
this.OKButton = new System.Windows.Forms.Button();
this.MyCancelButton = new System.Windows.Forms.Button();
this.ApplyButton = new System.Windows.Forms.Button();
this.DeleteButton = new System.Windows.Forms.Button();
this.AddButton = new System.Windows.Forms.Button();
this.ServerGroupBox = new System.Windows.Forms.GroupBox();
@@ -230,7 +231,7 @@
//
// EncryptionSelect
//
this.EncryptionSelect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.EncryptionSelect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.EncryptionSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.EncryptionSelect.FormattingEnabled = true;
@@ -303,7 +304,7 @@
//
// ShowPasswdCheckBox
//
this.ShowPasswdCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.ShowPasswdCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.ShowPasswdCheckBox.AutoSize = true;
this.ShowPasswdCheckBox.Location = new System.Drawing.Point(113, 87);
@@ -386,7 +387,7 @@
this.MyCancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.MyCancelButton.Dock = System.Windows.Forms.DockStyle.Right;
this.MyCancelButton.Location = new System.Drawing.Point(84, 3);
this.MyCancelButton.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
this.MyCancelButton.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
this.MyCancelButton.Name = "MyCancelButton";
this.MyCancelButton.Size = new System.Drawing.Size(75, 23);
this.MyCancelButton.TabIndex = 18;
@@ -394,6 +395,19 @@
this.MyCancelButton.UseVisualStyleBackColor = true;
this.MyCancelButton.Click += new System.EventHandler(this.CancelButton_Click);
//
// ApplyButton
//
this.ApplyButton.Enabled = false;
this.ApplyButton.Dock = System.Windows.Forms.DockStyle.Right;
this.ApplyButton.Location = new System.Drawing.Point(165, 3);
this.ApplyButton.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
this.ApplyButton.Name = "ApplyButton";
this.ApplyButton.Size = new System.Drawing.Size(75, 23);
this.ApplyButton.TabIndex = 19;
this.ApplyButton.Text = "Apply";
this.ApplyButton.UseVisualStyleBackColor = true;
this.ApplyButton.Click += new System.EventHandler(this.ApplyButton_Click);
//
// DeleteButton
//
this.DeleteButton.Dock = System.Windows.Forms.DockStyle.Right;
@@ -510,7 +524,7 @@
//
// tableLayoutPanel5
//
this.tableLayoutPanel5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.tableLayoutPanel5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.tableLayoutPanel5.AutoSize = true;
this.tableLayoutPanel5.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
@@ -567,19 +581,21 @@
//
this.tableLayoutPanel3.AutoSize = true;
this.tableLayoutPanel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel3.ColumnCount = 2;
this.tableLayoutPanel3.ColumnCount = 3;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel3.Controls.Add(this.MyCancelButton, 1, 0);
this.tableLayoutPanel3.Controls.Add(this.OKButton, 0, 0);
this.tableLayoutPanel3.Controls.Add(this.ApplyButton, 2, 0);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Right;
this.tableLayoutPanel3.Location = new System.Drawing.Point(309, 397);
this.tableLayoutPanel3.Location = new System.Drawing.Point(309, 316);
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel3.Size = new System.Drawing.Size(159, 26);
this.tableLayoutPanel3.Size = new System.Drawing.Size(240, 26);
this.tableLayoutPanel3.TabIndex = 8;
//
// tableLayoutPanel4
@@ -664,6 +680,7 @@
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button OKButton;
private System.Windows.Forms.Button MyCancelButton;
private System.Windows.Forms.Button ApplyButton;
private System.Windows.Forms.Button DeleteButton;
private System.Windows.Forms.Button AddButton;
private System.Windows.Forms.GroupBox ServerGroupBox;


+ 28
- 6
shadowsocks-csharp/View/ConfigForm.cs View File

@@ -1,15 +1,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using Microsoft.Win32;
using Shadowsocks.Controller;
using Shadowsocks.Model;
using Shadowsocks.Properties;
using System.Threading.Tasks;
namespace Shadowsocks.View
{
@@ -32,6 +26,7 @@ namespace Shadowsocks.View
this.PerformLayout();
UpdateTexts();
SetupValueChangedListeners();
this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon());
this.controller = controller;
@@ -62,16 +57,37 @@ namespace Shadowsocks.View
ServerGroupBox.Text = I18N.GetString("Server");
OKButton.Text = I18N.GetString("OK");
MyCancelButton.Text = I18N.GetString("Cancel");
ApplyButton.Text = I18N.GetString("Apply");
MoveUpButton.Text = I18N.GetString("Move &Up");
MoveDownButton.Text = I18N.GetString("Move D&own");
this.Text = I18N.GetString("Edit Servers");
}
private void SetupValueChangedListeners()
{
IPTextBox.TextChanged += ConfigValueChanged;
ProxyPortTextBox.TextChanged += ConfigValueChanged;
PasswordTextBox.TextChanged += ConfigValueChanged;
EncryptionSelect.SelectedIndexChanged += ConfigValueChanged;
PluginTextBox.TextChanged += ConfigValueChanged;
PluginArgumentsTextBox.TextChanged += ConfigValueChanged;
PluginOptionsTextBox.TextChanged += ConfigValueChanged;
RemarksTextBox.TextChanged += ConfigValueChanged;
TimeoutTextBox.TextChanged += ConfigValueChanged;
PortableModeCheckBox.CheckedChanged += ConfigValueChanged;
ServerPortTextBox.TextChanged += ConfigValueChanged;
}
private void controller_ConfigChanged(object sender, EventArgs e)
{
LoadCurrentConfiguration();
}
private void ConfigValueChanged(object sender, EventArgs e)
{
ApplyButton.Enabled = true;
}
private bool ValidateAndSaveSelectedServerDetails()
{
try
@@ -186,6 +202,7 @@ namespace Shadowsocks.View
LoadSelectedServerDetails();
ProxyPortTextBox.Text = _modifiedConfiguration.localPort.ToString();
PortableModeCheckBox.Checked = _modifiedConfiguration.portableMode;
ApplyButton.Enabled = false;
}
private bool SaveValidConfiguration()
@@ -308,6 +325,11 @@ namespace Shadowsocks.View
this.Close();
}
private void ApplyButton_Click(object sender, EventArgs e)
{
SaveValidConfiguration();
}
private void ConfigForm_Shown(object sender, EventArgs e)
{
IPTextBox.Focus();


Loading…
Cancel
Save