Browse Source

revert

tags/2.3
wzxjohn 10 years ago
parent
commit
b5eac341b3
3 changed files with 81 additions and 152 deletions
  1. +10
    -12
      shadowsocks-csharp/Model/Configuration.cs
  2. +9
    -38
      shadowsocks-csharp/View/ConfigForm.Designer.cs
  3. +62
    -102
      shadowsocks-csharp/View/ConfigForm.cs

+ 10
- 12
shadowsocks-csharp/Model/Configuration.cs View File

@@ -16,8 +16,6 @@ namespace Shadowsocks.Model
public int index; public int index;
public bool enabled; public bool enabled;
public bool isDefault; public bool isDefault;
public bool lockStatus;
public bool enableLog;
private static string CONFIG_FILE = "gui-config.json"; private static string CONFIG_FILE = "gui-config.json";
@@ -35,11 +33,11 @@ namespace Shadowsocks.Model
public static void CheckServer(Server server) public static void CheckServer(Server server)
{ {
CheckPort(server.local_port);
CheckPort(server.server_port);
CheckPassword(server.password);
CheckServer(server.server);
CheckRemark(server.remarks);
checkPort(server.local_port);
checkPort(server.server_port);
checkPassword(server.password);
checkServer(server.server);
checkRemark(server.remarks);
} }
public static Configuration Load() public static Configuration Load()
@@ -108,7 +106,7 @@ namespace Shadowsocks.Model
}; };
} }
private static void Assert(bool condition)
private static void assert(bool condition)
{ {
if (!condition) if (!condition)
{ {
@@ -116,7 +114,7 @@ namespace Shadowsocks.Model
} }
} }
private static void CheckPort(int port)
private static void checkPort(int port)
{ {
if (port <= 0 || port > 65535) if (port <= 0 || port > 65535)
{ {
@@ -124,7 +122,7 @@ namespace Shadowsocks.Model
} }
} }
private static void CheckPassword(string password)
private static void checkPassword(string password)
{ {
if (string.IsNullOrEmpty(password)) if (string.IsNullOrEmpty(password))
{ {
@@ -132,7 +130,7 @@ namespace Shadowsocks.Model
} }
} }
private static void CheckServer(string server)
private static void checkServer(string server)
{ {
if (string.IsNullOrEmpty(server)) if (string.IsNullOrEmpty(server))
{ {
@@ -140,7 +138,7 @@ namespace Shadowsocks.Model
} }
} }
private static void CheckRemark(string remark)
private static void checkRemark(string remark)
{ {
//remark is optional //remark is optional
} }


+ 9
- 38
shadowsocks-csharp/View/ConfigForm.Designer.cs View File

@@ -55,7 +55,6 @@
this.ConfigItem = new System.Windows.Forms.MenuItem(); this.ConfigItem = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem(); this.menuItem4 = new System.Windows.Forms.MenuItem();
this.editPACFileItem = new System.Windows.Forms.MenuItem(); this.editPACFileItem = new System.Windows.Forms.MenuItem();
this.QRCodeItem = new System.Windows.Forms.MenuItem();
this.aboutItem = new System.Windows.Forms.MenuItem(); this.aboutItem = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem(); this.menuItem3 = new System.Windows.Forms.MenuItem();
this.quitItem = new System.Windows.Forms.MenuItem(); this.quitItem = new System.Windows.Forms.MenuItem();
@@ -64,13 +63,11 @@
this.AddButton = new System.Windows.Forms.Button(); this.AddButton = new System.Windows.Forms.Button();
this.ServerGroupBox = new System.Windows.Forms.GroupBox(); this.ServerGroupBox = new System.Windows.Forms.GroupBox();
this.ServersListBox = new System.Windows.Forms.ListBox(); this.ServersListBox = new System.Windows.Forms.ListBox();
this.LockButton = new System.Windows.Forms.Button();
this.panel4 = new System.Windows.Forms.Panel();
this.QRCodeItem = new System.Windows.Forms.MenuItem();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.panel3.SuspendLayout(); this.panel3.SuspendLayout();
this.ServerGroupBox.SuspendLayout(); this.ServerGroupBox.SuspendLayout();
this.panel4.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// tableLayoutPanel1 // tableLayoutPanel1
@@ -256,7 +253,7 @@
this.OKButton.Location = new System.Drawing.Point(4, 4); this.OKButton.Location = new System.Drawing.Point(4, 4);
this.OKButton.Name = "OKButton"; this.OKButton.Name = "OKButton";
this.OKButton.Size = new System.Drawing.Size(75, 23); this.OKButton.Size = new System.Drawing.Size(75, 23);
this.OKButton.TabIndex = 6;
this.OKButton.TabIndex = 8;
this.OKButton.Text = "OK"; this.OKButton.Text = "OK";
this.OKButton.UseVisualStyleBackColor = true; this.OKButton.UseVisualStyleBackColor = true;
this.OKButton.Click += new System.EventHandler(this.OKButton_Click); this.OKButton.Click += new System.EventHandler(this.OKButton_Click);
@@ -267,7 +264,7 @@
this.MyCancelButton.Location = new System.Drawing.Point(86, 4); this.MyCancelButton.Location = new System.Drawing.Point(86, 4);
this.MyCancelButton.Name = "MyCancelButton"; this.MyCancelButton.Name = "MyCancelButton";
this.MyCancelButton.Size = new System.Drawing.Size(75, 23); this.MyCancelButton.Size = new System.Drawing.Size(75, 23);
this.MyCancelButton.TabIndex = 7;
this.MyCancelButton.TabIndex = 9;
this.MyCancelButton.Text = "Cancel"; this.MyCancelButton.Text = "Cancel";
this.MyCancelButton.UseVisualStyleBackColor = true; this.MyCancelButton.UseVisualStyleBackColor = true;
this.MyCancelButton.Click += new System.EventHandler(this.CancelButton_Click); this.MyCancelButton.Click += new System.EventHandler(this.CancelButton_Click);
@@ -332,12 +329,6 @@
this.editPACFileItem.Text = "Edit &PAC File..."; this.editPACFileItem.Text = "Edit &PAC File...";
this.editPACFileItem.Click += new System.EventHandler(this.EditPACFileItem_Click); this.editPACFileItem.Click += new System.EventHandler(this.EditPACFileItem_Click);
// //
// QRCodeItem
//
this.QRCodeItem.Index = 4;
this.QRCodeItem.Text = "Show &QRCode...";
this.QRCodeItem.Click += new System.EventHandler(this.QRCodeItem_Click);
//
// aboutItem // aboutItem
// //
this.aboutItem.Index = 5; this.aboutItem.Index = 5;
@@ -371,7 +362,7 @@
this.DeleteButton.Location = new System.Drawing.Point(100, 4); this.DeleteButton.Location = new System.Drawing.Point(100, 4);
this.DeleteButton.Name = "DeleteButton"; this.DeleteButton.Name = "DeleteButton";
this.DeleteButton.Size = new System.Drawing.Size(89, 23); this.DeleteButton.Size = new System.Drawing.Size(89, 23);
this.DeleteButton.TabIndex = 9;
this.DeleteButton.TabIndex = 7;
this.DeleteButton.Text = "&Delete"; this.DeleteButton.Text = "&Delete";
this.DeleteButton.UseVisualStyleBackColor = true; this.DeleteButton.UseVisualStyleBackColor = true;
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click); this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
@@ -381,7 +372,7 @@
this.AddButton.Location = new System.Drawing.Point(4, 4); this.AddButton.Location = new System.Drawing.Point(4, 4);
this.AddButton.Name = "AddButton"; this.AddButton.Name = "AddButton";
this.AddButton.Size = new System.Drawing.Size(89, 23); this.AddButton.Size = new System.Drawing.Size(89, 23);
this.AddButton.TabIndex = 8;
this.AddButton.TabIndex = 6;
this.AddButton.Text = "&Add"; this.AddButton.Text = "&Add";
this.AddButton.UseVisualStyleBackColor = true; this.AddButton.UseVisualStyleBackColor = true;
this.AddButton.Click += new System.EventHandler(this.AddButton_Click); this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
@@ -405,25 +396,11 @@
this.ServersListBox.TabIndex = 5; this.ServersListBox.TabIndex = 5;
this.ServersListBox.SelectedIndexChanged += new System.EventHandler(this.ServersListBox_SelectedIndexChanged); this.ServersListBox.SelectedIndexChanged += new System.EventHandler(this.ServersListBox_SelectedIndexChanged);
// //
// LockButton
//
this.LockButton.Location = new System.Drawing.Point(4, 4);
this.LockButton.Name = "LockButton";
this.LockButton.Size = new System.Drawing.Size(89, 23);
this.LockButton.TabIndex = 10;
this.LockButton.Text = "&Lock";
this.LockButton.UseVisualStyleBackColor = true;
this.LockButton.Click += new System.EventHandler(this.LockButton_Click);
//
// panel4
// QRCodeItem
// //
this.panel4.AutoSize = true;
this.panel4.Controls.Add(this.LockButton);
this.panel4.Location = new System.Drawing.Point(12, 251);
this.panel4.Margin = new System.Windows.Forms.Padding(0);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(192, 30);
this.panel4.TabIndex = 7;
this.QRCodeItem.Index = 4;
this.QRCodeItem.Text = "Show &QRCode...";
this.QRCodeItem.Click += new System.EventHandler(this.QRCodeItem_Click);
// //
// ConfigForm // ConfigForm
// //
@@ -431,9 +408,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoSize = true; this.AutoSize = true;
this.CancelButton = this.MyCancelButton;
this.ClientSize = new System.Drawing.Size(489, 286); this.ClientSize = new System.Drawing.Size(489, 286);
this.Controls.Add(this.panel4);
this.Controls.Add(this.ServersListBox); this.Controls.Add(this.ServersListBox);
this.Controls.Add(this.ServerGroupBox); this.Controls.Add(this.ServerGroupBox);
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
@@ -445,7 +420,6 @@
this.Name = "ConfigForm"; this.Name = "ConfigForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Shadowsocks"; this.Text = "Shadowsocks";
this.TopMost = true;
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ConfigForm_FormClosed); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ConfigForm_FormClosed);
this.Load += new System.EventHandler(this.ConfigForm_Load); this.Load += new System.EventHandler(this.ConfigForm_Load);
this.Shown += new System.EventHandler(this.ConfigForm_Shown); this.Shown += new System.EventHandler(this.ConfigForm_Shown);
@@ -455,7 +429,6 @@
this.panel3.ResumeLayout(false); this.panel3.ResumeLayout(false);
this.ServerGroupBox.ResumeLayout(false); this.ServerGroupBox.ResumeLayout(false);
this.ServerGroupBox.PerformLayout(); this.ServerGroupBox.PerformLayout();
this.panel4.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -497,8 +470,6 @@
private System.Windows.Forms.TextBox RemarksTextBox; private System.Windows.Forms.TextBox RemarksTextBox;
private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label6;
private System.Windows.Forms.MenuItem QRCodeItem; private System.Windows.Forms.MenuItem QRCodeItem;
private System.Windows.Forms.Button LockButton;
private System.Windows.Forms.Panel panel4;
} }
} }

+ 62
- 102
shadowsocks-csharp/View/ConfigForm.cs View File

@@ -2,7 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Diagnostics; using System.Diagnostics;
@@ -16,10 +15,9 @@ namespace Shadowsocks.View
private ShadowsocksController controller; private ShadowsocksController controller;
// this is a copy of configuration that we are working on // this is a copy of configuration that we are working on
private Configuration _modifiedConfiguration;
private int _oldSelectedIndex = -1;
private bool _isFirstRun;
private bool _lockStatus;
private Configuration modifiedConfiguration;
private int oldSelectedIndex = -1;
private bool isFirstRun;
public ConfigForm(ShadowsocksController controller) public ConfigForm(ShadowsocksController controller)
{ {
@@ -31,12 +29,12 @@ namespace Shadowsocks.View
controller.ConfigChanged += controller_ConfigChanged; controller.ConfigChanged += controller_ConfigChanged;
controller.PACFileReadyToOpen += controller_PACFileReadyToOpen; controller.PACFileReadyToOpen += controller_PACFileReadyToOpen;
LoadCurrentConfiguration();
loadCurrentConfiguration();
} }
private void controller_ConfigChanged(object sender, EventArgs e) private void controller_ConfigChanged(object sender, EventArgs e)
{ {
LoadCurrentConfiguration();
loadCurrentConfiguration();
} }
private void controller_EnableStatusChanged(object sender, EventArgs e) private void controller_EnableStatusChanged(object sender, EventArgs e)
@@ -52,31 +50,18 @@ namespace Shadowsocks.View
} }
private void ShowWindow()
private void showWindow()
{ {
this.Opacity = 1; this.Opacity = 1;
this.Show(); this.Show();
IPTextBox.Focus(); IPTextBox.Focus();
if (_lockStatus)
{
IPTextBox.Enabled = false;
ServerPortTextBox.Enabled = false;
PasswordTextBox.Enabled = false;
EncryptionSelect.Enabled = false;
ProxyPortTextBox.Enabled = false;
RemarksTextBox.Enabled = false;
AddButton.Enabled = false;
DeleteButton.Enabled = false;
_lockStatus = true;
LockButton.Text = "&Unlock Settings";
}
} }
private bool SaveOldSelectedServer()
private bool saveOldSelectedServer()
{ {
try try
{ {
if (_oldSelectedIndex == -1 || _oldSelectedIndex >= _modifiedConfiguration.configs.Count)
if (oldSelectedIndex == -1 || oldSelectedIndex >= modifiedConfiguration.configs.Count)
{ {
return true; return true;
} }
@@ -90,7 +75,7 @@ namespace Shadowsocks.View
remarks = RemarksTextBox.Text remarks = RemarksTextBox.Text
}; };
Configuration.CheckServer(server); Configuration.CheckServer(server);
_modifiedConfiguration.configs[_oldSelectedIndex] = server;
modifiedConfiguration.configs[oldSelectedIndex] = server;
return true; return true;
} }
catch (FormatException) catch (FormatException)
@@ -104,17 +89,17 @@ namespace Shadowsocks.View
return false; return false;
} }
private void LoadSelectedServer()
private void loadSelectedServer()
{ {
if (ServersListBox.SelectedIndex >= 0 && ServersListBox.SelectedIndex < _modifiedConfiguration.configs.Count)
if (ServersListBox.SelectedIndex >= 0 && ServersListBox.SelectedIndex < modifiedConfiguration.configs.Count)
{ {
Server server = _modifiedConfiguration.configs[ServersListBox.SelectedIndex];
Server server = modifiedConfiguration.configs[ServersListBox.SelectedIndex];
IPTextBox.Text = server.server; IPTextBox.Text = server.server;
ServerPortTextBox.Text = server.server_port.ToString(); ServerPortTextBox.Text = server.server_port.ToString();
PasswordTextBox.Text = server.password; PasswordTextBox.Text = server.password;
ProxyPortTextBox.Text = server.local_port.ToString(); ProxyPortTextBox.Text = server.local_port.ToString();
EncryptionSelect.Text = server.method ?? "aes-256-cfb";
EncryptionSelect.Text = server.method == null ? "aes-256-cfb" : server.method;
RemarksTextBox.Text = server.remarks; RemarksTextBox.Text = server.remarks;
ServerGroupBox.Visible = true; ServerGroupBox.Visible = true;
//IPTextBox.Focus(); //IPTextBox.Focus();
@@ -125,29 +110,28 @@ namespace Shadowsocks.View
} }
} }
private void LoadConfiguration(Configuration configuration)
private void loadConfiguration(Configuration configuration)
{ {
ServersListBox.Items.Clear(); ServersListBox.Items.Clear();
foreach (Server server in _modifiedConfiguration.configs)
foreach (Server server in modifiedConfiguration.configs)
{ {
ServersListBox.Items.Add(string.IsNullOrEmpty(server.server) ? "New server" : string.IsNullOrEmpty(server.remarks)? server.server + ":" + server.server_port : server.server + ":" + server.server_port + " (" + server.remarks + ")"); ServersListBox.Items.Add(string.IsNullOrEmpty(server.server) ? "New server" : string.IsNullOrEmpty(server.remarks)? server.server + ":" + server.server_port : server.server + ":" + server.server_port + " (" + server.remarks + ")");
} }
} }
private void LoadCurrentConfiguration()
private void loadCurrentConfiguration()
{ {
_modifiedConfiguration = controller.GetConfiguration();
LoadConfiguration(_modifiedConfiguration);
_oldSelectedIndex = _modifiedConfiguration.index;
_lockStatus = _modifiedConfiguration.lockStatus;
ServersListBox.SelectedIndex = _modifiedConfiguration.index;
LoadSelectedServer();
UpdateServersMenu();
enableItem.Checked = _modifiedConfiguration.enabled;
modifiedConfiguration = controller.GetConfiguration();
loadConfiguration(modifiedConfiguration);
oldSelectedIndex = modifiedConfiguration.index;
ServersListBox.SelectedIndex = modifiedConfiguration.index;
loadSelectedServer();
updateServersMenu();
enableItem.Checked = modifiedConfiguration.enabled;
} }
private void UpdateServersMenu()
private void updateServersMenu()
{ {
var items = ServersItem.MenuItems; var items = ServersItem.MenuItems;
@@ -173,68 +157,71 @@ namespace Shadowsocks.View
private void ConfigForm_Load(object sender, EventArgs e) private void ConfigForm_Load(object sender, EventArgs e)
{ {
if (controller == null || controller.GetConfiguration().isDefault)
if (!controller.GetConfiguration().isDefault)
{ {
_isFirstRun = true;
this.Opacity = 0;
BeginInvoke(new MethodInvoker(delegate
{
this.Hide();
}));
} }
else else
{ {
this.Opacity = 0;
BeginInvoke(new MethodInvoker(delegate { this.Hide(); }));
isFirstRun = true;
} }
} }
private void ServersListBox_SelectedIndexChanged(object sender, EventArgs e) private void ServersListBox_SelectedIndexChanged(object sender, EventArgs e)
{ {
if (_oldSelectedIndex == ServersListBox.SelectedIndex)
if (oldSelectedIndex == ServersListBox.SelectedIndex)
{ {
// we are moving back to oldSelectedIndex or doing a force move // we are moving back to oldSelectedIndex or doing a force move
return; return;
} }
if (!SaveOldSelectedServer())
if (!saveOldSelectedServer())
{ {
// why this won't cause stack overflow? // why this won't cause stack overflow?
ServersListBox.SelectedIndex = _oldSelectedIndex;
ServersListBox.SelectedIndex = oldSelectedIndex;
return; return;
} }
LoadSelectedServer();
_oldSelectedIndex = ServersListBox.SelectedIndex;
loadSelectedServer();
oldSelectedIndex = ServersListBox.SelectedIndex;
} }
private void AddButton_Click(object sender, EventArgs e) private void AddButton_Click(object sender, EventArgs e)
{ {
if (!SaveOldSelectedServer())
if (!saveOldSelectedServer())
{ {
return; return;
} }
Server server = Configuration.GetDefaultServer(); Server server = Configuration.GetDefaultServer();
_modifiedConfiguration.configs.Add(server);
LoadConfiguration(_modifiedConfiguration);
ServersListBox.SelectedIndex = _modifiedConfiguration.configs.Count - 1;
_oldSelectedIndex = ServersListBox.SelectedIndex;
modifiedConfiguration.configs.Add(server);
loadConfiguration(modifiedConfiguration);
ServersListBox.SelectedIndex = modifiedConfiguration.configs.Count - 1;
oldSelectedIndex = ServersListBox.SelectedIndex;
} }
private void DeleteButton_Click(object sender, EventArgs e) private void DeleteButton_Click(object sender, EventArgs e)
{ {
_oldSelectedIndex = ServersListBox.SelectedIndex;
if (_oldSelectedIndex >= 0 && _oldSelectedIndex < _modifiedConfiguration.configs.Count)
oldSelectedIndex = ServersListBox.SelectedIndex;
if (oldSelectedIndex >= 0 && oldSelectedIndex < modifiedConfiguration.configs.Count)
{ {
_modifiedConfiguration.configs.RemoveAt(_oldSelectedIndex);
modifiedConfiguration.configs.RemoveAt(oldSelectedIndex);
} }
if (_oldSelectedIndex >= _modifiedConfiguration.configs.Count)
if (oldSelectedIndex >= modifiedConfiguration.configs.Count)
{ {
// can be -1 // can be -1
_oldSelectedIndex = _modifiedConfiguration.configs.Count - 1;
oldSelectedIndex = modifiedConfiguration.configs.Count - 1;
} }
ServersListBox.SelectedIndex = _oldSelectedIndex;
LoadConfiguration(_modifiedConfiguration);
ServersListBox.SelectedIndex = _oldSelectedIndex;
LoadSelectedServer();
ServersListBox.SelectedIndex = oldSelectedIndex;
loadConfiguration(modifiedConfiguration);
ServersListBox.SelectedIndex = oldSelectedIndex;
loadSelectedServer();
} }
private void Config_Click(object sender, EventArgs e) private void Config_Click(object sender, EventArgs e)
{ {
ShowWindow();
showWindow();
} }
private void Quit_Click(object sender, EventArgs e) private void Quit_Click(object sender, EventArgs e)
@@ -242,39 +229,38 @@ namespace Shadowsocks.View
this.Close(); this.Close();
} }
private void ShowFirstTimeBalloon()
private void showFirstTimeBalloon()
{ {
if (_isFirstRun)
if (isFirstRun)
{ {
notifyIcon1.BalloonTipTitle = "Shadowsocks is here"; notifyIcon1.BalloonTipTitle = "Shadowsocks is here";
notifyIcon1.BalloonTipText = "You can turn on/off Shadowsocks in the context menu"; notifyIcon1.BalloonTipText = "You can turn on/off Shadowsocks in the context menu";
notifyIcon1.ShowBalloonTip(0); notifyIcon1.ShowBalloonTip(0);
_isFirstRun = false;
isFirstRun = false;
} }
} }
private void OKButton_Click(object sender, EventArgs e) private void OKButton_Click(object sender, EventArgs e)
{ {
if (!SaveOldSelectedServer())
if (!saveOldSelectedServer())
{ {
return; return;
} }
if (_modifiedConfiguration.configs.Count == 0)
if (modifiedConfiguration.configs.Count == 0)
{ {
MessageBox.Show("Please add at least one server"); MessageBox.Show("Please add at least one server");
return; return;
} }
_modifiedConfiguration.lockStatus = _lockStatus;
controller.SaveConfig(_modifiedConfiguration);
controller.SaveConfig(modifiedConfiguration);
this.Hide(); this.Hide();
ShowFirstTimeBalloon();
showFirstTimeBalloon();
} }
private void CancelButton_Click(object sender, EventArgs e) private void CancelButton_Click(object sender, EventArgs e)
{ {
this.Hide(); this.Hide();
LoadCurrentConfiguration();
ShowFirstTimeBalloon();
loadCurrentConfiguration();
showFirstTimeBalloon();
} }
private void ConfigForm_FormClosed(object sender, FormClosedEventArgs e) private void ConfigForm_FormClosed(object sender, FormClosedEventArgs e)
@@ -289,7 +275,7 @@ namespace Shadowsocks.View
private void notifyIcon1_DoubleClick(object sender, EventArgs e) private void notifyIcon1_DoubleClick(object sender, EventArgs e)
{ {
ShowWindow();
showWindow();
} }
@@ -321,31 +307,5 @@ namespace Shadowsocks.View
{ {
new QRCodeForm(controller.GetQRCodeForCurrentServer()).Show(); new QRCodeForm(controller.GetQRCodeForCurrentServer()).Show();
} }
private void ChangeLockStatus(bool lockStatus)
{
IPTextBox.Enabled = lockStatus;
ServerPortTextBox.Enabled = lockStatus;
PasswordTextBox.Enabled = lockStatus;
EncryptionSelect.Enabled = lockStatus;
ProxyPortTextBox.Enabled = lockStatus;
RemarksTextBox.Enabled = lockStatus;
AddButton.Enabled = lockStatus;
DeleteButton.Enabled = lockStatus;
_lockStatus = !lockStatus;
if (lockStatus)
{
LockButton.Text = "&Lock";
}
else
{
LockButton.Text = "&Unlock";
}
}
private void LockButton_Click(object sender, EventArgs e)
{
ChangeLockStatus(_lockStatus);
}
} }
} }

Loading…
Cancel
Save