diff --git a/shadowsocks-csharp/Data/cn.txt b/shadowsocks-csharp/Data/cn.txt index 43cffdf2..90a2b2c0 100644 --- a/shadowsocks-csharp/Data/cn.txt +++ b/shadowsocks-csharp/Data/cn.txt @@ -45,7 +45,7 @@ QRCode=二维码 Local PAC=使用本地 PAC Online PAC=使用在线 PAC Update Online PAC URL=更新在线 PAC 网址 -PAC Url=PAC 网址 +Please input PAC Url=请输入 PAC 网址 # Messages diff --git a/shadowsocks-csharp/View/MenuViewController.cs b/shadowsocks-csharp/View/MenuViewController.cs index f60be124..53284975 100755 --- a/shadowsocks-csharp/View/MenuViewController.cs +++ b/shadowsocks-csharp/View/MenuViewController.cs @@ -38,7 +38,6 @@ namespace Shadowsocks.View private MenuItem localPACItem; private MenuItem onlinePACItem; private ConfigForm configForm; - private PACUrlForm pacUrlForm; private string _urlToOpen; public MenuViewController(ShadowsocksController controller) @@ -513,30 +512,17 @@ namespace Shadowsocks.View } } - private void showPACUrlForm() + private void UpdateOnlinePACURLItem_Click(object sender, EventArgs e) { - if (pacUrlForm != null) - { - pacUrlForm.Activate(); - } - else + string origPacUrl = controller.GetConfiguration().pacUrl; + string pacUrl = Microsoft.VisualBasic.Interaction.InputBox( + I18N.GetString("Please input PAC Url"), + I18N.GetString("Update Online PAC URL"), + origPacUrl, -1, -1); + if (!string.IsNullOrEmpty(pacUrl) && pacUrl != origPacUrl) { - pacUrlForm = new PACUrlForm(controller); - pacUrlForm.Show(); - pacUrlForm.FormClosed += pacUrlForm_FormClosed; + controller.SavePACUrl(pacUrl); } } - - private void pacUrlForm_FormClosed(object sender, FormClosedEventArgs e) - { - pacUrlForm = null; - Util.Utils.ReleaseMemory(); - ShowFirstTimeBalloon(); - } - - private void UpdateOnlinePACURLItem_Click(object sender, EventArgs e) - { - showPACUrlForm(); - } } } diff --git a/shadowsocks-csharp/View/PACUrlForm.Designer.cs b/shadowsocks-csharp/View/PACUrlForm.Designer.cs deleted file mode 100644 index f2c48632..00000000 --- a/shadowsocks-csharp/View/PACUrlForm.Designer.cs +++ /dev/null @@ -1,151 +0,0 @@ -namespace Shadowsocks.View -{ - partial class PACUrlForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.PACUrlTextBox = new System.Windows.Forms.TextBox(); - this.PACUrlLabel = new System.Windows.Forms.Label(); - this.OkButton = new System.Windows.Forms.Button(); - this.MyCancelButton = new System.Windows.Forms.Button(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); - this.tableLayoutPanel1.SuspendLayout(); - this.tableLayoutPanel2.SuspendLayout(); - this.SuspendLayout(); - // - // PACUrlTextBox - // - this.PACUrlTextBox.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.PACUrlTextBox.Location = new System.Drawing.Point(53, 3); - this.PACUrlTextBox.MaxLength = 256; - this.PACUrlTextBox.Name = "PACUrlTextBox"; - this.PACUrlTextBox.Size = new System.Drawing.Size(245, 20); - this.PACUrlTextBox.TabIndex = 4; - this.PACUrlTextBox.WordWrap = false; - // - // PACUrlLabel - // - this.PACUrlLabel.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.PACUrlLabel.AutoSize = true; - this.PACUrlLabel.Location = new System.Drawing.Point(3, 6); - this.PACUrlLabel.Margin = new System.Windows.Forms.Padding(3); - this.PACUrlLabel.Name = "PACUrlLabel"; - this.PACUrlLabel.Size = new System.Drawing.Size(44, 13); - this.PACUrlLabel.TabIndex = 3; - this.PACUrlLabel.Text = "PAC Url"; - this.PACUrlLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // OkButton - // - this.OkButton.Location = new System.Drawing.Point(3, 3); - this.OkButton.Name = "OkButton"; - this.OkButton.Size = new System.Drawing.Size(75, 23); - this.OkButton.TabIndex = 5; - this.OkButton.Text = "OK"; - this.OkButton.UseVisualStyleBackColor = true; - this.OkButton.Click += new System.EventHandler(this.OkButton_Click); - // - // MyCancelButton - // - this.MyCancelButton.Location = new System.Drawing.Point(84, 3); - this.MyCancelButton.Name = "MyCancelButton"; - this.MyCancelButton.Size = new System.Drawing.Size(75, 23); - this.MyCancelButton.TabIndex = 6; - this.MyCancelButton.Text = "Cancel"; - this.MyCancelButton.UseVisualStyleBackColor = true; - this.MyCancelButton.Click += new System.EventHandler(this.MyCancelButton_Click); - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.AutoSize = true; - this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.Controls.Add(this.PACUrlLabel, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.PACUrlTextBox, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 1, 1); - this.tableLayoutPanel1.Location = new System.Drawing.Point(9, 9); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 2; - 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(301, 61); - this.tableLayoutPanel1.TabIndex = 7; - // - // tableLayoutPanel2 - // - this.tableLayoutPanel2.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.tableLayoutPanel2.AutoSize = true; - this.tableLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.tableLayoutPanel2.ColumnCount = 2; - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel2.Controls.Add(this.OkButton, 0, 0); - this.tableLayoutPanel2.Controls.Add(this.MyCancelButton, 1, 0); - this.tableLayoutPanel2.Location = new System.Drawing.Point(136, 29); - this.tableLayoutPanel2.Name = "tableLayoutPanel2"; - this.tableLayoutPanel2.RowCount = 1; - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel2.Size = new System.Drawing.Size(162, 29); - this.tableLayoutPanel2.TabIndex = 5; - // - // PACUrlForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoSize = true; - this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.ClientSize = new System.Drawing.Size(351, 101); - this.Controls.Add(this.tableLayoutPanel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "PACUrlForm"; - this.Padding = new System.Windows.Forms.Padding(3); - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Update Online PAC URL"; - this.Load += new System.EventHandler(this.PACUrlForm_Load); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.tableLayoutPanel2.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TextBox PACUrlTextBox; - private System.Windows.Forms.Label PACUrlLabel; - private System.Windows.Forms.Button OkButton; - private System.Windows.Forms.Button MyCancelButton; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; - } -} \ No newline at end of file diff --git a/shadowsocks-csharp/View/PACUrlForm.cs b/shadowsocks-csharp/View/PACUrlForm.cs deleted file mode 100644 index b2e93d48..00000000 --- a/shadowsocks-csharp/View/PACUrlForm.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using Shadowsocks.Controller; -using Shadowsocks.Model; -using Shadowsocks.Properties; - -namespace Shadowsocks.View -{ - public partial class PACUrlForm : Form - { - private ShadowsocksController controller; - private string orig_pacUrl; - - public PACUrlForm(ShadowsocksController controller) - { - this.Font = System.Drawing.SystemFonts.MessageBoxFont; - InitializeComponent(); - - UpdateTexts(); - this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon()); - - this.controller = controller; - controller.ConfigChanged += controller_ConfigChanged; - } - - private void UpdateTexts() - { - OkButton.Text = I18N.GetString("OK"); - MyCancelButton.Text = I18N.GetString("Cancel"); - PACUrlLabel.Text = I18N.GetString("PAC Url"); - this.Text = I18N.GetString("Update Online PAC URL"); - } - - private void controller_ConfigChanged(object sender, EventArgs e) - { - orig_pacUrl = PACUrlTextBox.Text = controller.GetConfiguration().pacUrl; - } - - private void PACUrlForm_Load(object sender, EventArgs e) - { - PACUrlTextBox.Text = controller.GetConfiguration().pacUrl; - } - - private void OkButton_Click(object sender, EventArgs e) - { - string pacUrl = PACUrlTextBox.Text.Trim(); - if (string.IsNullOrEmpty(pacUrl)) - { - MessageBox.Show(I18N.GetString("PAC Url can not be blank")); - return; - } - if (pacUrl != this.orig_pacUrl) - { - controller.SavePACUrl(pacUrl); - } - this.Close(); - } - - private void MyCancelButton_Click(object sender, EventArgs e) - { - this.Close(); - } - } -} diff --git a/shadowsocks-csharp/View/PACUrlForm.resx b/shadowsocks-csharp/View/PACUrlForm.resx deleted file mode 100644 index 7080a7d1..00000000 --- a/shadowsocks-csharp/View/PACUrlForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/shadowsocks-csharp/shadowsocks-csharp.csproj b/shadowsocks-csharp/shadowsocks-csharp.csproj index 273b9f52..aa2c9000 100755 --- a/shadowsocks-csharp/shadowsocks-csharp.csproj +++ b/shadowsocks-csharp/shadowsocks-csharp.csproj @@ -63,6 +63,7 @@ app.manifest + @@ -162,12 +163,6 @@ - - Form - - - PACUrlForm.cs - Form @@ -186,9 +181,6 @@ Designer Resources.Designer.cs - - PACUrlForm.cs - QRCodeForm.cs