Browse Source

update form

tags/2.3
clowwindy 10 years ago
parent
commit
22f2a43281
3 changed files with 176 additions and 123 deletions
  1. +0
    -7
      shadowsocks-csharp/Controller/ShadowsocksController.cs
  2. +161
    -101
      shadowsocks-csharp/View/ConfigForm.Designer.cs
  3. +15
    -15
      shadowsocks-csharp/View/ConfigForm.cs

+ 0
- 7
shadowsocks-csharp/Controller/ShadowsocksController.cs View File

@@ -23,15 +23,8 @@ namespace shadowsocks_csharp.Controller
public string Path; public string Path;
} }
public class ErrorEventArgs : EventArgs
{
public string Error;
}
public event EventHandler ConfigChanged; public event EventHandler ConfigChanged;
public event EventHandler EnableStatusChanged; public event EventHandler EnableStatusChanged;
public event EventHandler<ErrorEventArgs> LocalFailToStart;
// when user clicked Edit PAC, and PAC file has already created // when user clicked Edit PAC, and PAC file has already created
public event EventHandler<PathEventArgs> PACFileReadyToOpen; public event EventHandler<PathEventArgs> PACFileReadyToOpen;


+ 161
- 101
shadowsocks-csharp/View/ConfigForm.Designer.cs View File

@@ -34,27 +34,32 @@
this.label5 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.EncryptionSelect = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.IPTextBox = new System.Windows.Forms.TextBox();
this.ServerPortTextBox = new System.Windows.Forms.TextBox();
this.PasswordTextBox = new System.Windows.Forms.TextBox();
this.ProxyPortTextBox = new System.Windows.Forms.TextBox();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.panel2 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.OKButton = new System.Windows.Forms.Button();
this.MyCancelButton = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.contextMenu1 = new System.Windows.Forms.ContextMenu(); this.contextMenu1 = new System.Windows.Forms.ContextMenu();
this.enableItem = new System.Windows.Forms.MenuItem(); this.enableItem = new System.Windows.Forms.MenuItem();
this.configItem = new System.Windows.Forms.MenuItem(); this.configItem = new System.Windows.Forms.MenuItem();
this.editPACFileItem = 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();
this.editPACFileItem = new System.Windows.Forms.MenuItem();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.listView1 = new System.Windows.Forms.ListView();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// tableLayoutPanel1 // tableLayoutPanel1
@@ -69,14 +74,14 @@
this.tableLayoutPanel1.Controls.Add(this.label5, 0, 4); this.tableLayoutPanel1.Controls.Add(this.label5, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1); this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.comboBox1, 1, 4);
this.tableLayoutPanel1.Controls.Add(this.EncryptionSelect, 1, 4);
this.tableLayoutPanel1.Controls.Add(this.label3, 0, 2); this.tableLayoutPanel1.Controls.Add(this.label3, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.label4, 0, 3); this.tableLayoutPanel1.Controls.Add(this.label4, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.textBox1, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.textBox2, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.textBox3, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.textBox4, 1, 3);
this.tableLayoutPanel1.Location = new System.Drawing.Point(19, 19);
this.tableLayoutPanel1.Controls.Add(this.IPTextBox, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.ServerPortTextBox, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.PasswordTextBox, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.ProxyPortTextBox, 1, 3);
this.tableLayoutPanel1.Location = new System.Drawing.Point(246, 10);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(10); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(10);
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(5); this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(5);
@@ -86,18 +91,18 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(206, 141);
this.tableLayoutPanel1.Size = new System.Drawing.Size(216, 141);
this.tableLayoutPanel1.TabIndex = 0; this.tableLayoutPanel1.TabIndex = 0;
// //
// label5 // label5
// //
this.label5.Anchor = System.Windows.Forms.AnchorStyles.Right; this.label5.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label5.AutoSize = true; this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(16, 116);
this.label5.Location = new System.Drawing.Point(11, 116);
this.label5.Name = "label5"; this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(52, 13);
this.label5.Size = new System.Drawing.Size(57, 13);
this.label5.TabIndex = 8; this.label5.TabIndex = 8;
this.label5.Text = "Encryptor";
this.label5.Text = "Encryption";
// //
// label1 // label1
// //
@@ -119,13 +124,15 @@
this.label2.TabIndex = 1; this.label2.TabIndex = 1;
this.label2.Text = "Server Port"; this.label2.Text = "Server Port";
// //
// comboBox1
// EncryptionSelect
// //
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.comboBox1.ItemHeight = 13;
this.comboBox1.Items.AddRange(new object[] {
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;
this.EncryptionSelect.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.EncryptionSelect.ItemHeight = 13;
this.EncryptionSelect.Items.AddRange(new object[] {
"table", "table",
"rc4-md5", "rc4-md5",
"aes-256-cfb", "aes-256-cfb",
@@ -133,10 +140,10 @@
"aes-128-cfb", "aes-128-cfb",
"bf-cfb", "bf-cfb",
"rc4"}); "rc4"});
this.comboBox1.Location = new System.Drawing.Point(74, 112);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(124, 21);
this.comboBox1.TabIndex = 9;
this.EncryptionSelect.Location = new System.Drawing.Point(74, 112);
this.EncryptionSelect.Name = "EncryptionSelect";
this.EncryptionSelect.Size = new System.Drawing.Size(134, 21);
this.EncryptionSelect.TabIndex = 9;
// //
// label3 // label3
// //
@@ -158,41 +165,41 @@
this.label4.TabIndex = 3; this.label4.TabIndex = 3;
this.label4.Text = "Proxy Port"; this.label4.Text = "Proxy Port";
// //
// textBox1
// IPTextBox
// //
this.textBox1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.textBox1.Location = new System.Drawing.Point(74, 8);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(124, 20);
this.textBox1.TabIndex = 4;
this.textBox1.WordWrap = false;
this.IPTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.IPTextBox.Location = new System.Drawing.Point(74, 8);
this.IPTextBox.Name = "IPTextBox";
this.IPTextBox.Size = new System.Drawing.Size(134, 20);
this.IPTextBox.TabIndex = 4;
this.IPTextBox.WordWrap = false;
// //
// textBox2
// ServerPortTextBox
// //
this.textBox2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.textBox2.Location = new System.Drawing.Point(74, 34);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(124, 20);
this.textBox2.TabIndex = 5;
this.textBox2.WordWrap = false;
this.ServerPortTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.ServerPortTextBox.Location = new System.Drawing.Point(74, 34);
this.ServerPortTextBox.Name = "ServerPortTextBox";
this.ServerPortTextBox.Size = new System.Drawing.Size(134, 20);
this.ServerPortTextBox.TabIndex = 5;
this.ServerPortTextBox.WordWrap = false;
// //
// textBox3
// PasswordTextBox
// //
this.textBox3.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.textBox3.Location = new System.Drawing.Point(74, 60);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(124, 20);
this.textBox3.TabIndex = 6;
this.textBox3.WordWrap = false;
this.PasswordTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.PasswordTextBox.Location = new System.Drawing.Point(74, 60);
this.PasswordTextBox.Name = "PasswordTextBox";
this.PasswordTextBox.Size = new System.Drawing.Size(134, 20);
this.PasswordTextBox.TabIndex = 6;
this.PasswordTextBox.WordWrap = false;
// //
// textBox4
// ProxyPortTextBox
// //
this.textBox4.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.textBox4.Location = new System.Drawing.Point(74, 86);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(124, 20);
this.textBox4.TabIndex = 7;
this.textBox4.WordWrap = false;
this.ProxyPortTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.ProxyPortTextBox.Location = new System.Drawing.Point(74, 86);
this.ProxyPortTextBox.Name = "ProxyPortTextBox";
this.ProxyPortTextBox.Size = new System.Drawing.Size(134, 20);
this.ProxyPortTextBox.TabIndex = 7;
this.ProxyPortTextBox.WordWrap = false;
// //
// notifyIcon1 // notifyIcon1
// //
@@ -206,43 +213,44 @@
this.panel2.Anchor = System.Windows.Forms.AnchorStyles.Top; this.panel2.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.panel2.AutoSize = true; this.panel2.AutoSize = true;
this.panel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.panel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel2.Location = new System.Drawing.Point(45, 175);
this.panel2.Location = new System.Drawing.Point(171, 175);
this.panel2.Name = "panel2"; this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(0, 0); this.panel2.Size = new System.Drawing.Size(0, 0);
this.panel2.TabIndex = 1; this.panel2.TabIndex = 1;
// //
// button1
// OKButton
// //
this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button1.Location = new System.Drawing.Point(4, 4);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "OK";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.OKButton_Click);
this.OKButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.OKButton.Location = new System.Drawing.Point(4, 4);
this.OKButton.Name = "OKButton";
this.OKButton.Size = new System.Drawing.Size(75, 23);
this.OKButton.TabIndex = 0;
this.OKButton.Text = "OK";
this.OKButton.UseVisualStyleBackColor = true;
this.OKButton.Click += new System.EventHandler(this.OKButton_Click);
// //
// button2
// MyCancelButton
// //
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button2.Location = new System.Drawing.Point(86, 4);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1;
this.button2.Text = "Cancel";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.cancelButton_Click);
this.MyCancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.MyCancelButton.Location = new System.Drawing.Point(86, 4);
this.MyCancelButton.Name = "MyCancelButton";
this.MyCancelButton.Size = new System.Drawing.Size(75, 23);
this.MyCancelButton.TabIndex = 1;
this.MyCancelButton.Text = "Cancel";
this.MyCancelButton.UseVisualStyleBackColor = true;
this.MyCancelButton.Click += new System.EventHandler(this.CancelButton_Click);
// //
// panel1 // panel1
// //
this.panel1.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.AutoSize = true; this.panel1.AutoSize = true;
this.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel1.Controls.Add(this.button2);
this.panel1.Controls.Add(this.button1);
this.panel1.Location = new System.Drawing.Point(61, 173);
this.panel1.Controls.Add(this.MyCancelButton);
this.panel1.Controls.Add(this.OKButton);
this.panel1.Location = new System.Drawing.Point(311, 205);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(164, 30);
this.panel1.Size = new System.Drawing.Size(164, 40);
this.panel1.TabIndex = 1; this.panel1.TabIndex = 1;
// //
// contextMenu1 // contextMenu1
@@ -267,11 +275,17 @@
this.configItem.Text = "Options..."; this.configItem.Text = "Options...";
this.configItem.Click += new System.EventHandler(this.Config_Click); this.configItem.Click += new System.EventHandler(this.Config_Click);
// //
// editPACFileItem
//
this.editPACFileItem.Index = 2;
this.editPACFileItem.Text = "Edit PAC File...";
this.editPACFileItem.Click += new System.EventHandler(this.EditPACFileItem_Click);
//
// aboutItem // aboutItem
// //
this.aboutItem.Index = 3; this.aboutItem.Index = 3;
this.aboutItem.Text = "About"; this.aboutItem.Text = "About";
this.aboutItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
this.aboutItem.Click += new System.EventHandler(this.AboutItem_Click);
// //
// menuItem3 // menuItem3
// //
@@ -284,33 +298,76 @@
this.quitItem.Text = "Quit"; this.quitItem.Text = "Quit";
this.quitItem.Click += new System.EventHandler(this.Quit_Click); this.quitItem.Click += new System.EventHandler(this.Quit_Click);
// //
// editPACFileItem
// tableLayoutPanel2
// //
this.editPACFileItem.Index = 2;
this.editPACFileItem.Text = "Edit PAC File...";
this.editPACFileItem.Click += new System.EventHandler(this.editPACFileItem_Click);
this.tableLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel2.ColumnCount = 2;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Controls.Add(this.listView1, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel1, 1, 0);
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(472, 196);
this.tableLayoutPanel2.TabIndex = 2;
//
// listView1
//
this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listView1.Location = new System.Drawing.Point(3, 3);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(230, 190);
this.listView1.TabIndex = 4;
this.listView1.UseCompatibleStateImageBehavior = false;
//
// tableLayoutPanel3
//
this.tableLayoutPanel3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel3.ColumnCount = 1;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel3.Controls.Add(this.tableLayoutPanel2, 0, 0);
this.tableLayoutPanel3.Controls.Add(this.panel1, 0, 1);
this.tableLayoutPanel3.Location = new System.Drawing.Point(12, 12);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 2;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 81.4978F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 18.5022F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(478, 248);
this.tableLayoutPanel3.TabIndex = 3;
// //
// ConfigForm // ConfigForm
// //
this.AcceptButton = this.button1;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AcceptButton = this.OKButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoSize = true; this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.CancelButton = this.button2;
this.ClientSize = new System.Drawing.Size(250, 221);
this.ClientSize = new System.Drawing.Size(502, 272);
this.Controls.Add(this.tableLayoutPanel3);
this.Controls.Add(this.panel2); this.Controls.Add(this.panel2);
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.panel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
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.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
this.Load += new System.EventHandler(this.Form1_Load);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ConfigForm_FormClosed);
this.Load += new System.EventHandler(this.CinfigForm_Load);
this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout(); this.tableLayoutPanel1.PerformLayout();
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
this.tableLayoutPanel3.ResumeLayout(false);
this.tableLayoutPanel3.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -323,16 +380,16 @@
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox IPTextBox;
private System.Windows.Forms.TextBox ServerPortTextBox;
private System.Windows.Forms.TextBox PasswordTextBox;
private System.Windows.Forms.TextBox ProxyPortTextBox;
private System.Windows.Forms.NotifyIcon notifyIcon1; private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label5;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.ComboBox EncryptionSelect;
private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button OKButton;
private System.Windows.Forms.Button MyCancelButton;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.ContextMenu contextMenu1; private System.Windows.Forms.ContextMenu contextMenu1;
private System.Windows.Forms.MenuItem enableItem; private System.Windows.Forms.MenuItem enableItem;
@@ -341,6 +398,9 @@
private System.Windows.Forms.MenuItem quitItem; private System.Windows.Forms.MenuItem quitItem;
private System.Windows.Forms.MenuItem configItem; private System.Windows.Forms.MenuItem configItem;
private System.Windows.Forms.MenuItem editPACFileItem; private System.Windows.Forms.MenuItem editPACFileItem;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
} }
} }

+ 15
- 15
shadowsocks-csharp/View/ConfigForm.cs View File

@@ -55,16 +55,16 @@ namespace shadowsocks_csharp.View
{ {
Server server = controller.GetCurrentServer(); Server server = controller.GetCurrentServer();
textBox1.Text = server.server;
textBox2.Text = server.server_port.ToString();
textBox3.Text = server.password;
textBox4.Text = server.local_port.ToString();
comboBox1.Text = server.method == null ? "aes-256-cfb" : server.method;
IPTextBox.Text = server.server;
ServerPortTextBox.Text = server.server_port.ToString();
PasswordTextBox.Text = server.password;
ProxyPortTextBox.Text = server.local_port.ToString();
EncryptionSelect.Text = server.method == null ? "aes-256-cfb" : server.method;
enableItem.Checked = controller.GetConfiguration().enabled; enableItem.Checked = controller.GetConfiguration().enabled;
} }
private void Form1_Load(object sender, EventArgs e)
private void CinfigForm_Load(object sender, EventArgs e)
{ {
if (!controller.GetConfiguration().isDefault) if (!controller.GetConfiguration().isDefault)
{ {
@@ -92,11 +92,11 @@ namespace shadowsocks_csharp.View
{ {
Server server = new Server Server server = new Server
{ {
server = textBox1.Text,
server_port = int.Parse(textBox2.Text),
password = textBox3.Text,
local_port = int.Parse(textBox4.Text),
method = comboBox1.Text
server = IPTextBox.Text,
server_port = int.Parse(ServerPortTextBox.Text),
password = PasswordTextBox.Text,
local_port = int.Parse(ProxyPortTextBox.Text),
method = EncryptionSelect.Text
}; };
Configuration config = controller.GetConfiguration(); Configuration config = controller.GetConfiguration();
config.configs.Clear(); config.configs.Clear();
@@ -115,18 +115,18 @@ namespace shadowsocks_csharp.View
} }
} }
private void cancelButton_Click(object sender, EventArgs e)
private void CancelButton_Click(object sender, EventArgs e)
{ {
this.Hide(); this.Hide();
updateUI(); updateUI();
} }
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
private void ConfigForm_FormClosed(object sender, FormClosedEventArgs e)
{ {
controller.Stop(); controller.Stop();
} }
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
private void AboutItem_Click(object sender, EventArgs e)
{ {
Process.Start("https://github.com/clowwindy/shadowsocks-csharp"); Process.Start("https://github.com/clowwindy/shadowsocks-csharp");
} }
@@ -143,7 +143,7 @@ namespace shadowsocks_csharp.View
controller.ToggleEnable(enableItem.Checked); controller.ToggleEnable(enableItem.Checked);
} }
private void editPACFileItem_Click(object sender, EventArgs e)
private void EditPACFileItem_Click(object sender, EventArgs e)
{ {
controller.TouchPACFile(); controller.TouchPACFile();
} }


Loading…
Cancel
Save