Browse Source

auto focus IP textbox

tags/2.3
clowwindy 10 years ago
parent
commit
f0b2cb49a4
3 changed files with 19 additions and 10 deletions
  1. +1
    -0
      shadowsocks-csharp/Model/Configuration.cs
  2. +11
    -10
      shadowsocks-csharp/View/ConfigForm.Designer.cs
  3. +7
    -0
      shadowsocks-csharp/View/ConfigForm.cs

+ 1
- 0
shadowsocks-csharp/Model/Configuration.cs View File

@@ -57,6 +57,7 @@ namespace Shadowsocks.Model
return new Configuration return new Configuration
{ {
index = 0, index = 0,
isDefault = true,
configs = new List<Server>() configs = new List<Server>()
{ {
GetDefaultServer() GetDefaultServer()


+ 11
- 10
shadowsocks-csharp/View/ConfigForm.Designer.cs View File

@@ -123,7 +123,7 @@
this.ProxyPortTextBox.Location = new System.Drawing.Point(74, 113); this.ProxyPortTextBox.Location = new System.Drawing.Point(74, 113);
this.ProxyPortTextBox.Name = "ProxyPortTextBox"; this.ProxyPortTextBox.Name = "ProxyPortTextBox";
this.ProxyPortTextBox.Size = new System.Drawing.Size(160, 20); this.ProxyPortTextBox.Size = new System.Drawing.Size(160, 20);
this.ProxyPortTextBox.TabIndex = 9;
this.ProxyPortTextBox.TabIndex = 4;
this.ProxyPortTextBox.WordWrap = false; this.ProxyPortTextBox.WordWrap = false;
// //
// label4 // label4
@@ -152,7 +152,7 @@
this.IPTextBox.Location = new System.Drawing.Point(74, 8); this.IPTextBox.Location = new System.Drawing.Point(74, 8);
this.IPTextBox.Name = "IPTextBox"; this.IPTextBox.Name = "IPTextBox";
this.IPTextBox.Size = new System.Drawing.Size(160, 20); this.IPTextBox.Size = new System.Drawing.Size(160, 20);
this.IPTextBox.TabIndex = 5;
this.IPTextBox.TabIndex = 0;
this.IPTextBox.WordWrap = false; this.IPTextBox.WordWrap = false;
// //
// ServerPortTextBox // ServerPortTextBox
@@ -161,7 +161,7 @@
this.ServerPortTextBox.Location = new System.Drawing.Point(74, 34); this.ServerPortTextBox.Location = new System.Drawing.Point(74, 34);
this.ServerPortTextBox.Name = "ServerPortTextBox"; this.ServerPortTextBox.Name = "ServerPortTextBox";
this.ServerPortTextBox.Size = new System.Drawing.Size(160, 20); this.ServerPortTextBox.Size = new System.Drawing.Size(160, 20);
this.ServerPortTextBox.TabIndex = 6;
this.ServerPortTextBox.TabIndex = 1;
this.ServerPortTextBox.WordWrap = false; this.ServerPortTextBox.WordWrap = false;
// //
// PasswordTextBox // PasswordTextBox
@@ -171,7 +171,7 @@
this.PasswordTextBox.Name = "PasswordTextBox"; this.PasswordTextBox.Name = "PasswordTextBox";
this.PasswordTextBox.PasswordChar = '*'; this.PasswordTextBox.PasswordChar = '*';
this.PasswordTextBox.Size = new System.Drawing.Size(160, 20); this.PasswordTextBox.Size = new System.Drawing.Size(160, 20);
this.PasswordTextBox.TabIndex = 7;
this.PasswordTextBox.TabIndex = 2;
this.PasswordTextBox.WordWrap = false; this.PasswordTextBox.WordWrap = false;
// //
// label5 // label5
@@ -203,7 +203,7 @@
this.EncryptionSelect.Location = new System.Drawing.Point(74, 86); this.EncryptionSelect.Location = new System.Drawing.Point(74, 86);
this.EncryptionSelect.Name = "EncryptionSelect"; this.EncryptionSelect.Name = "EncryptionSelect";
this.EncryptionSelect.Size = new System.Drawing.Size(160, 21); this.EncryptionSelect.Size = new System.Drawing.Size(160, 21);
this.EncryptionSelect.TabIndex = 8;
this.EncryptionSelect.TabIndex = 3;
// //
// notifyIcon1 // notifyIcon1
// //
@@ -228,7 +228,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 = 0;
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);
@@ -239,7 +239,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 = 1;
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);
@@ -336,7 +336,7 @@
this.DeleteButton.Location = new System.Drawing.Point(86, 4); this.DeleteButton.Location = new System.Drawing.Point(86, 4);
this.DeleteButton.Name = "DeleteButton"; this.DeleteButton.Name = "DeleteButton";
this.DeleteButton.Size = new System.Drawing.Size(75, 23); this.DeleteButton.Size = new System.Drawing.Size(75, 23);
this.DeleteButton.TabIndex = 4;
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);
@@ -346,7 +346,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(75, 23); this.AddButton.Size = new System.Drawing.Size(75, 23);
this.AddButton.TabIndex = 3;
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);
@@ -367,7 +367,7 @@
this.ServersListBox.Location = new System.Drawing.Point(12, 12); this.ServersListBox.Location = new System.Drawing.Point(12, 12);
this.ServersListBox.Name = "ServersListBox"; this.ServersListBox.Name = "ServersListBox";
this.ServersListBox.Size = new System.Drawing.Size(164, 186); this.ServersListBox.Size = new System.Drawing.Size(164, 186);
this.ServersListBox.TabIndex = 2;
this.ServersListBox.TabIndex = 5;
this.ServersListBox.SelectedIndexChanged += new System.EventHandler(this.ServersListBox_SelectedIndexChanged); this.ServersListBox.SelectedIndexChanged += new System.EventHandler(this.ServersListBox_SelectedIndexChanged);
// //
// ConfigForm // ConfigForm
@@ -390,6 +390,7 @@
this.Text = "Shadowsocks"; this.Text = "Shadowsocks";
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.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout(); this.tableLayoutPanel1.PerformLayout();
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);


+ 7
- 0
shadowsocks-csharp/View/ConfigForm.cs View File

@@ -53,6 +53,7 @@ namespace Shadowsocks.View
{ {
this.Opacity = 1; this.Opacity = 1;
this.Show(); this.Show();
IPTextBox.Focus();
} }
private bool saveOldSelectedServer() private bool saveOldSelectedServer()
@@ -98,6 +99,7 @@ namespace Shadowsocks.View
ProxyPortTextBox.Text = server.local_port.ToString(); ProxyPortTextBox.Text = server.local_port.ToString();
EncryptionSelect.Text = server.method == null ? "aes-256-cfb" : server.method; EncryptionSelect.Text = server.method == null ? "aes-256-cfb" : server.method;
ServerGroupBox.Visible = true; ServerGroupBox.Visible = true;
IPTextBox.Focus();
} }
else else
{ {
@@ -275,5 +277,10 @@ namespace Shadowsocks.View
configuration.index = (int)item.Tag; configuration.index = (int)item.Tag;
controller.SaveConfig(configuration); controller.SaveConfig(configuration);
} }
private void ConfigForm_Shown(object sender, EventArgs e)
{
IPTextBox.Focus();
}
} }
} }

Loading…
Cancel
Save