diff --git a/Ultron.Ngrok/Form/AboutBox.Designer.cs b/Ultron.Ngrok/Form/AboutBox.Designer.cs index 4f11056..7de65c4 100644 --- a/Ultron.Ngrok/Form/AboutBox.Designer.cs +++ b/Ultron.Ngrok/Form/AboutBox.Designer.cs @@ -69,7 +69,7 @@ // labelVersion // this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill; - this.labelVersion.Location = new System.Drawing.Point(6, 20); + this.labelVersion.Location = new System.Drawing.Point(6, 25); this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); this.labelVersion.MaximumSize = new System.Drawing.Size(0, 16); this.labelVersion.Name = "labelVersion"; @@ -81,7 +81,7 @@ // labelCopyright // this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill; - this.labelCopyright.Location = new System.Drawing.Point(6, 39); + this.labelCopyright.Location = new System.Drawing.Point(6, 50); this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 16); this.labelCopyright.Name = "labelCopyright"; @@ -94,9 +94,9 @@ // this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.okButton.Location = new System.Drawing.Point(145, 65); + this.okButton.Location = new System.Drawing.Point(145, 78); this.okButton.Name = "okButton"; - this.okButton.Size = new System.Drawing.Size(75, 25); + this.okButton.Size = new System.Drawing.Size(75, 19); this.okButton.TabIndex = 24; this.okButton.Text = "确定(&O)"; this.okButton.Click += new System.EventHandler(this.okButton_Click); diff --git a/Ultron.Ngrok/Form/SettingForm.Designer.cs b/Ultron.Ngrok/Form/SettingForm.Designer.cs index 6998991..20a34f2 100644 --- a/Ultron.Ngrok/Form/SettingForm.Designer.cs +++ b/Ultron.Ngrok/Form/SettingForm.Designer.cs @@ -28,71 +28,73 @@ /// private void InitializeComponent() { - this.TunnelConfigGroupBox = new System.Windows.Forms.GroupBox(); - this.enableCBX = new System.Windows.Forms.CheckBox(); - this.ipTB = new System.Windows.Forms.TextBox(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); this.delButton = new System.Windows.Forms.Button(); + this.enableCBX = new System.Windows.Forms.CheckBox(); this.addButton = new System.Windows.Forms.Button(); + this.tunnelListBox = new System.Windows.Forms.ListBox(); + this.ipTB = new System.Windows.Forms.TextBox(); + this.tunnelTypeLabelPort = new System.Windows.Forms.Label(); + this.tunnelTypeCMB = new System.Windows.Forms.ComboBox(); + this.tunnelTypeLabel = new System.Windows.Forms.Label(); this.portTB = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); this.tunnelNameTB = new System.Windows.Forms.TextBox(); + this.subdomainLBL = new System.Windows.Forms.Label(); this.subdomainTB = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.tunnelTypeLabelPort = new System.Windows.Forms.Label(); - this.subdomainLBL = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.tunnelTypeLabel = new System.Windows.Forms.Label(); - this.tunnelTypeCMB = new System.Windows.Forms.ComboBox(); - this.tunnelListBox = new System.Windows.Forms.ListBox(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.tpCheckBox = new System.Windows.Forms.CheckBox(); + this.notShowCB = new System.Windows.Forms.CheckBox(); + this.autoStartCheckBox = new System.Windows.Forms.CheckBox(); this.saveButton = new System.Windows.Forms.Button(); - this.TunnelConfigGroupBox.SuspendLayout(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage2.SuspendLayout(); this.SuspendLayout(); // - // TunnelConfigGroupBox + // tabControl1 // - this.TunnelConfigGroupBox.Controls.Add(this.enableCBX); - this.TunnelConfigGroupBox.Controls.Add(this.ipTB); - this.TunnelConfigGroupBox.Controls.Add(this.delButton); - this.TunnelConfigGroupBox.Controls.Add(this.addButton); - this.TunnelConfigGroupBox.Controls.Add(this.portTB); - this.TunnelConfigGroupBox.Controls.Add(this.tunnelNameTB); - this.TunnelConfigGroupBox.Controls.Add(this.subdomainTB); - this.TunnelConfigGroupBox.Controls.Add(this.label1); - this.TunnelConfigGroupBox.Controls.Add(this.label2); - this.TunnelConfigGroupBox.Controls.Add(this.label5); - this.TunnelConfigGroupBox.Controls.Add(this.tunnelTypeLabelPort); - this.TunnelConfigGroupBox.Controls.Add(this.subdomainLBL); - this.TunnelConfigGroupBox.Controls.Add(this.label3); - this.TunnelConfigGroupBox.Controls.Add(this.tunnelTypeLabel); - this.TunnelConfigGroupBox.Controls.Add(this.tunnelTypeCMB); - this.TunnelConfigGroupBox.Controls.Add(this.tunnelListBox); - this.TunnelConfigGroupBox.Location = new System.Drawing.Point(12, 12); - this.TunnelConfigGroupBox.Name = "TunnelConfigGroupBox"; - this.TunnelConfigGroupBox.Size = new System.Drawing.Size(291, 201); - this.TunnelConfigGroupBox.TabIndex = 8; - this.TunnelConfigGroupBox.TabStop = false; - this.TunnelConfigGroupBox.Text = "通道配置"; + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Location = new System.Drawing.Point(8, 2); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(327, 188); + this.tabControl1.TabIndex = 9; // - // enableCBX + // tabPage1 // - this.enableCBX.AutoSize = true; - this.enableCBX.Location = new System.Drawing.Point(193, 154); - this.enableCBX.Name = "enableCBX"; - this.enableCBX.Size = new System.Drawing.Size(15, 14); - this.enableCBX.TabIndex = 10; - this.enableCBX.UseVisualStyleBackColor = true; - // - // ipTB - // - this.ipTB.Location = new System.Drawing.Point(193, 100); - this.ipTB.Name = "ipTB"; - this.ipTB.Size = new System.Drawing.Size(92, 21); - this.ipTB.TabIndex = 9; + this.tabPage1.BackColor = System.Drawing.Color.White; + this.tabPage1.Controls.Add(this.delButton); + this.tabPage1.Controls.Add(this.enableCBX); + this.tabPage1.Controls.Add(this.addButton); + this.tabPage1.Controls.Add(this.tunnelListBox); + this.tabPage1.Controls.Add(this.ipTB); + this.tabPage1.Controls.Add(this.tunnelTypeLabelPort); + this.tabPage1.Controls.Add(this.tunnelTypeCMB); + this.tabPage1.Controls.Add(this.tunnelTypeLabel); + this.tabPage1.Controls.Add(this.portTB); + this.tabPage1.Controls.Add(this.label3); + this.tabPage1.Controls.Add(this.tunnelNameTB); + this.tabPage1.Controls.Add(this.subdomainLBL); + this.tabPage1.Controls.Add(this.subdomainTB); + this.tabPage1.Controls.Add(this.label5); + this.tabPage1.Controls.Add(this.label1); + this.tabPage1.Controls.Add(this.label2); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(319, 162); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "通道配置"; // // delButton // - this.delButton.Location = new System.Drawing.Point(76, 172); + this.delButton.Location = new System.Drawing.Point(76, 131); this.delButton.Name = "delButton"; this.delButton.Size = new System.Drawing.Size(50, 23); this.delButton.TabIndex = 1; @@ -100,9 +102,18 @@ this.delButton.UseVisualStyleBackColor = true; this.delButton.Click += new System.EventHandler(this.delButton_Click); // + // enableCBX + // + this.enableCBX.AutoSize = true; + this.enableCBX.Location = new System.Drawing.Point(195, 140); + this.enableCBX.Name = "enableCBX"; + this.enableCBX.Size = new System.Drawing.Size(15, 14); + this.enableCBX.TabIndex = 10; + this.enableCBX.UseVisualStyleBackColor = true; + // // addButton // - this.addButton.Location = new System.Drawing.Point(6, 172); + this.addButton.Location = new System.Drawing.Point(6, 131); this.addButton.Name = "addButton"; this.addButton.Size = new System.Drawing.Size(50, 23); this.addButton.TabIndex = 1; @@ -110,31 +121,110 @@ this.addButton.UseVisualStyleBackColor = true; this.addButton.Click += new System.EventHandler(this.addButton_Click); // + // tunnelListBox + // + this.tunnelListBox.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.tunnelListBox.FormattingEnabled = true; + this.tunnelListBox.ItemHeight = 14; + this.tunnelListBox.Location = new System.Drawing.Point(6, 6); + this.tunnelListBox.Name = "tunnelListBox"; + this.tunnelListBox.Size = new System.Drawing.Size(120, 116); + this.tunnelListBox.TabIndex = 5; + this.tunnelListBox.SelectedIndexChanged += new System.EventHandler(this.tunnelListBox_SelectedValueChanged); + // + // ipTB + // + this.ipTB.Location = new System.Drawing.Point(195, 86); + this.ipTB.Name = "ipTB"; + this.ipTB.Size = new System.Drawing.Size(92, 21); + this.ipTB.TabIndex = 9; + // + // tunnelTypeLabelPort + // + this.tunnelTypeLabelPort.AutoSize = true; + this.tunnelTypeLabelPort.Location = new System.Drawing.Point(136, 36); + this.tunnelTypeLabelPort.Name = "tunnelTypeLabelPort"; + this.tunnelTypeLabelPort.Size = new System.Drawing.Size(53, 12); + this.tunnelTypeLabelPort.TabIndex = 8; + this.tunnelTypeLabelPort.Text = "远程端口"; + this.tunnelTypeLabelPort.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.tunnelTypeLabelPort.Visible = false; + // + // tunnelTypeCMB + // + this.tunnelTypeCMB.FormattingEnabled = true; + this.tunnelTypeCMB.Items.AddRange(new object[] { + "TCP", + "HTTP"}); + this.tunnelTypeCMB.Location = new System.Drawing.Point(195, 60); + this.tunnelTypeCMB.Name = "tunnelTypeCMB"; + this.tunnelTypeCMB.Size = new System.Drawing.Size(92, 20); + this.tunnelTypeCMB.TabIndex = 6; + this.tunnelTypeCMB.SelectedIndexChanged += new System.EventHandler(this.tunnelTypeCMB_SelectedIndexChanged); + // + // tunnelTypeLabel + // + this.tunnelTypeLabel.AutoSize = true; + this.tunnelTypeLabel.Location = new System.Drawing.Point(136, 63); + this.tunnelTypeLabel.Name = "tunnelTypeLabel"; + this.tunnelTypeLabel.Size = new System.Drawing.Size(53, 12); + this.tunnelTypeLabel.TabIndex = 7; + this.tunnelTypeLabel.Text = "通道类型"; + // // portTB // - this.portTB.Location = new System.Drawing.Point(193, 127); + this.portTB.Location = new System.Drawing.Point(195, 113); this.portTB.Name = "portTB"; this.portTB.Size = new System.Drawing.Size(92, 21); this.portTB.TabIndex = 9; // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(148, 89); + this.label3.Name = "label3"; + this.label3.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.label3.Size = new System.Drawing.Size(41, 12); + this.label3.TabIndex = 7; + this.label3.Text = "IP地址"; + // // tunnelNameTB // - this.tunnelNameTB.Location = new System.Drawing.Point(193, 20); + this.tunnelNameTB.Location = new System.Drawing.Point(195, 6); this.tunnelNameTB.Name = "tunnelNameTB"; this.tunnelNameTB.Size = new System.Drawing.Size(92, 21); this.tunnelNameTB.TabIndex = 9; // + // subdomainLBL + // + this.subdomainLBL.AutoSize = true; + this.subdomainLBL.Location = new System.Drawing.Point(148, 36); + this.subdomainLBL.Name = "subdomainLBL"; + this.subdomainLBL.Size = new System.Drawing.Size(41, 12); + this.subdomainLBL.TabIndex = 8; + this.subdomainLBL.Text = "子域名"; + this.subdomainLBL.Visible = false; + // // subdomainTB // - this.subdomainTB.Location = new System.Drawing.Point(193, 47); + this.subdomainTB.Location = new System.Drawing.Point(195, 33); this.subdomainTB.Name = "subdomainTB"; this.subdomainTB.Size = new System.Drawing.Size(92, 21); this.subdomainTB.TabIndex = 9; // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(160, 10); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(29, 12); + this.label5.TabIndex = 8; + this.label5.Text = "名称"; + // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(158, 154); + this.label1.Location = new System.Drawing.Point(160, 140); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(29, 12); this.label1.TabIndex = 8; @@ -143,87 +233,58 @@ // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(158, 130); + this.label2.Location = new System.Drawing.Point(160, 116); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(29, 12); this.label2.TabIndex = 8; this.label2.Text = "端口"; // - // label5 + // tabPage2 // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(158, 24); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(29, 12); - this.label5.TabIndex = 8; - this.label5.Text = "名称"; + this.tabPage2.BackColor = System.Drawing.Color.White; + this.tabPage2.Controls.Add(this.tpCheckBox); + this.tabPage2.Controls.Add(this.notShowCB); + this.tabPage2.Controls.Add(this.autoStartCheckBox); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(319, 162); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "应用设置"; // - // tunnelTypeLabelPort + // tpCheckBox // - this.tunnelTypeLabelPort.AutoSize = true; - this.tunnelTypeLabelPort.Location = new System.Drawing.Point(134, 50); - this.tunnelTypeLabelPort.Name = "tunnelTypeLabelPort"; - this.tunnelTypeLabelPort.Size = new System.Drawing.Size(53, 12); - this.tunnelTypeLabelPort.TabIndex = 8; - this.tunnelTypeLabelPort.Text = "远程端口"; - this.tunnelTypeLabelPort.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.tunnelTypeLabelPort.Visible = false; + this.tpCheckBox.AutoSize = true; + this.tpCheckBox.Location = new System.Drawing.Point(17, 62); + this.tpCheckBox.Name = "tpCheckBox"; + this.tpCheckBox.Size = new System.Drawing.Size(108, 16); + this.tpCheckBox.TabIndex = 12; + this.tpCheckBox.Text = "退出隐藏到托盘"; + this.tpCheckBox.UseVisualStyleBackColor = true; // - // subdomainLBL + // notShowCB // - this.subdomainLBL.AutoSize = true; - this.subdomainLBL.Location = new System.Drawing.Point(146, 50); - this.subdomainLBL.Name = "subdomainLBL"; - this.subdomainLBL.Size = new System.Drawing.Size(41, 12); - this.subdomainLBL.TabIndex = 8; - this.subdomainLBL.Text = "子域名"; - this.subdomainLBL.Visible = false; + this.notShowCB.AutoSize = true; + this.notShowCB.Location = new System.Drawing.Point(17, 40); + this.notShowCB.Name = "notShowCB"; + this.notShowCB.Size = new System.Drawing.Size(108, 16); + this.notShowCB.TabIndex = 12; + this.notShowCB.Text = "不显示运行窗口"; + this.notShowCB.UseVisualStyleBackColor = true; // - // label3 + // autoStartCheckBox // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(146, 103); - this.label3.Name = "label3"; - this.label3.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.label3.Size = new System.Drawing.Size(41, 12); - this.label3.TabIndex = 7; - this.label3.Text = "IP地址"; - // - // tunnelTypeLabel - // - this.tunnelTypeLabel.AutoSize = true; - this.tunnelTypeLabel.Location = new System.Drawing.Point(134, 77); - this.tunnelTypeLabel.Name = "tunnelTypeLabel"; - this.tunnelTypeLabel.Size = new System.Drawing.Size(53, 12); - this.tunnelTypeLabel.TabIndex = 7; - this.tunnelTypeLabel.Text = "通道类型"; - // - // tunnelTypeCMB - // - this.tunnelTypeCMB.FormattingEnabled = true; - this.tunnelTypeCMB.Items.AddRange(new object[] { - "TCP", - "HTTP"}); - this.tunnelTypeCMB.Location = new System.Drawing.Point(193, 74); - this.tunnelTypeCMB.Name = "tunnelTypeCMB"; - this.tunnelTypeCMB.Size = new System.Drawing.Size(92, 20); - this.tunnelTypeCMB.TabIndex = 6; - this.tunnelTypeCMB.SelectedIndexChanged += new System.EventHandler(this.tunnelTypeCMB_SelectedIndexChanged); - // - // tunnelListBox - // - this.tunnelListBox.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.tunnelListBox.FormattingEnabled = true; - this.tunnelListBox.ItemHeight = 14; - this.tunnelListBox.Location = new System.Drawing.Point(6, 20); - this.tunnelListBox.Name = "tunnelListBox"; - this.tunnelListBox.Size = new System.Drawing.Size(120, 144); - this.tunnelListBox.TabIndex = 5; - this.tunnelListBox.SelectedIndexChanged += new System.EventHandler(this.tunnelListBox_SelectedValueChanged); + this.autoStartCheckBox.AutoSize = true; + this.autoStartCheckBox.Location = new System.Drawing.Point(17, 18); + this.autoStartCheckBox.Name = "autoStartCheckBox"; + this.autoStartCheckBox.Size = new System.Drawing.Size(72, 16); + this.autoStartCheckBox.TabIndex = 12; + this.autoStartCheckBox.Text = "自动启动"; + this.autoStartCheckBox.UseVisualStyleBackColor = true; // // saveButton // - this.saveButton.Location = new System.Drawing.Point(228, 219); + this.saveButton.Location = new System.Drawing.Point(256, 196); this.saveButton.Name = "saveButton"; this.saveButton.Size = new System.Drawing.Size(75, 23); this.saveButton.TabIndex = 1; @@ -235,8 +296,8 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(309, 247); - this.Controls.Add(this.TunnelConfigGroupBox); + this.ClientSize = new System.Drawing.Size(340, 225); + this.Controls.Add(this.tabControl1); this.Controls.Add(this.saveButton); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; @@ -246,15 +307,17 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "设置"; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.SettingForm_FormClosed); - this.TunnelConfigGroupBox.ResumeLayout(false); - this.TunnelConfigGroupBox.PerformLayout(); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage1.PerformLayout(); + this.tabPage2.ResumeLayout(false); + this.tabPage2.PerformLayout(); this.ResumeLayout(false); } #endregion - private System.Windows.Forms.GroupBox TunnelConfigGroupBox; private System.Windows.Forms.CheckBox enableCBX; private System.Windows.Forms.TextBox ipTB; private System.Windows.Forms.Button delButton; @@ -272,5 +335,11 @@ private System.Windows.Forms.ListBox tunnelListBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label tunnelTypeLabelPort; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.CheckBox autoStartCheckBox; + private System.Windows.Forms.CheckBox notShowCB; + private System.Windows.Forms.CheckBox tpCheckBox; } } \ No newline at end of file diff --git a/Ultron.Ngrok/Form/SettingForm.cs b/Ultron.Ngrok/Form/SettingForm.cs index c3a2e1b..f15e8dc 100644 --- a/Ultron.Ngrok/Form/SettingForm.cs +++ b/Ultron.Ngrok/Form/SettingForm.cs @@ -104,6 +104,9 @@ namespace Ultron.Ngrok ServerAddr = "ngrok.aaqbee.com:8083", TrustHostRootCerts = false, Version = AssemblyVersion, + AutoStart = false, + UseNotifyMenu = true, + HideWindow = false, Tunnels = new Dictionary() }; Tunnel httpTunnel = new Tunnel @@ -142,6 +145,9 @@ namespace Ultron.Ngrok if(ServerConfig.Version != AssemblyVersion) { ServerConfig.Version = AssemblyVersion; + ServerConfig.AutoStart = false; + ServerConfig.UseNotifyMenu = true; + ServerConfig.HideWindow = false; SaveConfig(); } } @@ -169,6 +175,10 @@ namespace Ultron.Ngrok tunnelName += " " + item.Key; } + autoStartCheckBox.Checked = ServerConfig.AutoStart; + notShowCB.Checked = ServerConfig.HideWindow; + tpCheckBox.Checked = ServerConfig.UseNotifyMenu; + ExecuteCommand = ExeFile + ".exe -config ngrok.cfg start" + tunnelName; } @@ -317,8 +327,16 @@ namespace Ultron.Ngrok tunl.TunnelName = tunnelNameTB.Text; tunl.Enable = enableCBX.Checked; - SaveConfig(); + ServerConfig.AutoStart = autoStartCheckBox.Checked; + ServerConfig.HideWindow = notShowCB.Checked; + ServerConfig.UseNotifyMenu = tpCheckBox.Checked; + SaveConfig(); + LoadConfig(); + } + else + { + SaveConfig(); LoadConfig(); } WriteLogToForm("保存成功"); @@ -340,6 +358,5 @@ namespace Ultron.Ngrok { ReLoadConfig(); } - } } diff --git a/Ultron.Ngrok/Form/SettingForm.resx b/Ultron.Ngrok/Form/SettingForm.resx index 61bc649..1af7de1 100644 --- a/Ultron.Ngrok/Form/SettingForm.resx +++ b/Ultron.Ngrok/Form/SettingForm.resx @@ -117,7 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - \ No newline at end of file diff --git a/Ultron.Ngrok/FormMain.Designer.cs b/Ultron.Ngrok/FormMain.Designer.cs index 35c4d57..d65783a 100644 --- a/Ultron.Ngrok/FormMain.Designer.cs +++ b/Ultron.Ngrok/FormMain.Designer.cs @@ -28,15 +28,21 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain)); this.cmdLogTextArea = new System.Windows.Forms.TextBox(); this.startBtn = new System.Windows.Forms.Button(); this.endBtn = new System.Windows.Forms.Button(); - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.topMenuStrip = new System.Windows.Forms.MenuStrip(); this.设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.帮助ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.关于ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.menuStrip1.SuspendLayout(); + this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components); + this.notifyMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.显示ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.topMenuStrip.SuspendLayout(); + this.notifyMenuStrip.SuspendLayout(); this.SuspendLayout(); // // cmdLogTextArea @@ -71,17 +77,18 @@ this.endBtn.UseVisualStyleBackColor = true; this.endBtn.Click += new System.EventHandler(this.endBtn_Click); // - // menuStrip1 + // topMenuStrip // - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.topMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.设置ToolStripMenuItem, this.帮助ToolStripMenuItem, this.关于ToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(362, 25); - this.menuStrip1.TabIndex = 4; - this.menuStrip1.Text = "menuStrip1"; + this.topMenuStrip.Location = new System.Drawing.Point(0, 0); + this.topMenuStrip.Name = "topMenuStrip"; + this.topMenuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; + this.topMenuStrip.Size = new System.Drawing.Size(362, 25); + this.topMenuStrip.TabIndex = 4; + this.topMenuStrip.Text = "menuStrip1"; // // 设置ToolStripMenuItem // @@ -104,6 +111,36 @@ this.关于ToolStripMenuItem.Text = "关于"; this.关于ToolStripMenuItem.Click += new System.EventHandler(this.关于ToolStripMenuItem_Click); // + // notifyIcon + // + this.notifyIcon.ContextMenuStrip = this.notifyMenuStrip; + this.notifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon"))); + this.notifyIcon.Text = "uNgrok"; + this.notifyIcon.Visible = true; + this.notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.NotifyIcon_MouseDoubleClick); + // + // notifyMenuStrip + // + this.notifyMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.显示ToolStripMenuItem, + this.退出ToolStripMenuItem}); + this.notifyMenuStrip.Name = "notifyMenuStrip"; + this.notifyMenuStrip.Size = new System.Drawing.Size(181, 70); + // + // 退出ToolStripMenuItem + // + this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem"; + this.退出ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.退出ToolStripMenuItem.Text = "退出"; + this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click); + // + // 显示ToolStripMenuItem + // + this.显示ToolStripMenuItem.Name = "显示ToolStripMenuItem"; + this.显示ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.显示ToolStripMenuItem.Text = "显示"; + this.显示ToolStripMenuItem.Click += new System.EventHandler(this.显示ToolStripMenuItem_Click); + // // FormMain // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -112,17 +149,20 @@ this.Controls.Add(this.endBtn); this.Controls.Add(this.startBtn); this.Controls.Add(this.cmdLogTextArea); - this.Controls.Add(this.menuStrip1); + this.Controls.Add(this.topMenuStrip); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MainMenuStrip = this.menuStrip1; + this.MainMenuStrip = this.topMenuStrip; this.MaximizeBox = false; this.Name = "FormMain"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "uNgrok"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormMain_FormClosing); this.Load += new System.EventHandler(this.FormMain_Load); - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); + this.SizeChanged += new System.EventHandler(this.FormMain_SizeChanged); + this.topMenuStrip.ResumeLayout(false); + this.topMenuStrip.PerformLayout(); + this.notifyMenuStrip.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -133,10 +173,14 @@ public System.Windows.Forms.TextBox cmdLogTextArea; private System.Windows.Forms.Button startBtn; private System.Windows.Forms.Button endBtn; - private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.MenuStrip topMenuStrip; private System.Windows.Forms.ToolStripMenuItem 帮助ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 关于ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 设置ToolStripMenuItem; + private System.Windows.Forms.NotifyIcon notifyIcon; + private System.Windows.Forms.ContextMenuStrip notifyMenuStrip; + private System.Windows.Forms.ToolStripMenuItem 退出ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 显示ToolStripMenuItem; } } diff --git a/Ultron.Ngrok/FormMain.cs b/Ultron.Ngrok/FormMain.cs index aa0b1fa..bfcf375 100644 --- a/Ultron.Ngrok/FormMain.cs +++ b/Ultron.Ngrok/FormMain.cs @@ -5,15 +5,17 @@ using System.Diagnostics; using System.Reflection; using System.Resources; using System.Threading; -using Ultron.Ngrok.Utils; using System.Net; using System.IO; +using Ultron.Ngrok.Utils; using Ultron.Ngrok.Properties; namespace Ultron.Ngrok { public partial class FormMain : Form { + public delegate void CmdInitAlready(); + #region 属性 /// @@ -82,22 +84,35 @@ namespace Ultron.Ngrok //进程检测 CheckProcessAndKill(setting.ExeFile); + CmdInitAlready callback = new CmdInitAlready(CmdCallBack); //初始化CMD - new Thread(new ThreadStart(InitCmd)).Start(); + Thread cmdThread = new Thread(InitCmd); + cmdThread.IsBackground = true; + cmdThread.Start(callback); //检查更新 - new Thread(new ThreadStart(CheckUpdateAsync)).Start(); + Thread updateThread = new Thread(new ThreadStart(CheckUpdateAsync)); + updateThread.IsBackground = true; + updateThread.Start(); + } + + public void CmdCallBack() + { + if(setting.ServerConfig.AutoStart) + { + startBtn_Click(null, null); + } } #endregion - + #region 事件 private void startBtn_Click(object sender, EventArgs e) { //网络检测 NetworkUtils.CheckServeStatus(this); - cmd.SendMsg(setting.ExecuteCommand); + cmd.SendMsg(setting.ExecuteCommand,setting.ServerConfig.HideWindow); startBtn.Enabled = false; endBtn.Enabled = true; @@ -119,7 +134,7 @@ namespace Ultron.Ngrok private void 帮助ToolStripMenuItem_Click(object sender, EventArgs e) { - Process.Start("explorer.exe", "http://git.iwangyu.cn/wixy/Ultron.Ngrok/wiki"); + Process.Start("explorer.exe", "https://git.wixy.cn/wixy/Ultron.Ngrok/wiki/帮助"); } private void 关于ToolStripMenuItem_Click(object sender, EventArgs e) @@ -128,6 +143,69 @@ namespace Ultron.Ngrok about.ShowDialog(); } + private void NotifyIcon_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (WindowState == FormWindowState.Minimized) + { + //还原窗体显示 + WindowState = FormWindowState.Normal; + //激活窗体并给予它焦点 + this.Activate(); + //任务栏区显示图标 + this.ShowInTaskbar = true; + //托盘区图标隐藏 + notifyIcon.Visible = false; + } + } + + private void FormMain_FormClosing(object sender, FormClosingEventArgs e) + { + if (setting.ServerConfig.UseNotifyMenu) + { + WindowState = FormWindowState.Minimized; + e.Cancel = true; + } + else + { + if (MessageBox.Show("是否确认退出程序?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) + { + // 关闭所有的线程 + this.Dispose(); + this.Close(); + } + else + { + e.Cancel = true; + } + } + } + + private void FormMain_SizeChanged(object sender, EventArgs e) + { + //判断是否选择的是最小化按钮 + if (WindowState == FormWindowState.Minimized) + { + //隐藏任务栏区图标 + this.ShowInTaskbar = false; + //图标显示在托盘区 + notifyIcon.Visible = true; + } + } + + private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (MessageBox.Show("是否确认退出程序?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) + { + this.Dispose(); + this.Close(); + } + } + + private void 显示ToolStripMenuItem_Click(object sender, EventArgs e) + { + WindowState = FormWindowState.Normal; + } + #endregion #region 方法 @@ -170,12 +248,14 @@ namespace Ultron.Ngrok setting.WriteLogToForm += WriteLog; } - public void InitCmd() + public void InitCmd(object obj) { //创建CMD cmd = new CmdUtils(); cmd.ProcessMessageEvent += DealMessage; cmd.ProcessKilled += cmd_Exited; + CmdInitAlready callback = obj as CmdInitAlready; + callback(); } /// @@ -284,5 +364,6 @@ namespace Ultron.Ngrok } #endregion + } } diff --git a/Ultron.Ngrok/FormMain.resx b/Ultron.Ngrok/FormMain.resx index dd8cdf7..f2b175e 100644 --- a/Ultron.Ngrok/FormMain.resx +++ b/Ultron.Ngrok/FormMain.resx @@ -117,10 +117,182 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 + + 151, 17 + + + 262, 17 + + + + AAABAAEAMDAAAAEAIACoJQAAFgAAACgAAAAwAAAAYAAAAAEAIAAAAAAAACQAAMMOAADDDgAAAAAAAAAA + AAA/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/ + P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/ + P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/ + P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/ + P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/ + P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/ + P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/ + P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/ + P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/ + P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//P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rok/Model/Config.cs b/Ultron.Ngrok/Model/Config.cs index 28942d2..31f45b4 100644 --- a/Ultron.Ngrok/Model/Config.cs +++ b/Ultron.Ngrok/Model/Config.cs @@ -24,6 +24,15 @@ namespace Ultron.Ngrok.Model [YamlMember(Alias = "version")] public string Version { get; set; } + [YamlMember(Alias = "auto_start")] + public bool AutoStart { get; set; } + + [YamlMember(Alias = "hide_window")] + public bool HideWindow { get; set; } + + [YamlMember(Alias = "use_notify_menu")] + public bool UseNotifyMenu { get; set; } + [YamlMember(Alias = "auth_token")] public string AuthToken { get; set; } diff --git a/Ultron.Ngrok/Properties/AssemblyInfo.cs b/Ultron.Ngrok/Properties/AssemblyInfo.cs index 54ac24a..583893b 100644 --- a/Ultron.Ngrok/Properties/AssemblyInfo.cs +++ b/Ultron.Ngrok/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")] diff --git a/Ultron.Ngrok/Utils/CmdUtils.cs b/Ultron.Ngrok/Utils/CmdUtils.cs index 8ff75a0..0266590 100644 --- a/Ultron.Ngrok/Utils/CmdUtils.cs +++ b/Ultron.Ngrok/Utils/CmdUtils.cs @@ -22,10 +22,9 @@ namespace Ultron.Ngrok.Utils public CmdUtils() { Control.CheckForIllegalCrossThreadCalls = false; - } - public void Init() + public void Init(bool hideWindow = false) { cmd = new Process();//创建进程对象 ProcessStartInfo startInfo = new ProcessStartInfo(); @@ -34,7 +33,7 @@ namespace Ultron.Ngrok.Utils startInfo.UseShellExecute = false;//不使用系统外壳程序启动 startInfo.RedirectStandardInput = true;//不重定向输入 startInfo.RedirectStandardOutput = true; //重定向输出 - startInfo.CreateNoWindow = false;//不创建窗口 + startInfo.CreateNoWindow = hideWindow;//不创建窗口 cmd.StartInfo = startInfo; @@ -61,7 +60,7 @@ namespace Ultron.Ngrok.Utils } } - public void SendMsg(string cmdStr) + public void SendMsg(string cmdStr,bool hideWindow = false) { ProcessMessageEvent(0, "开始运行..."); if (!IsInited || cmd.HasExited) @@ -73,7 +72,7 @@ namespace Ultron.Ngrok.Utils startInfo.UseShellExecute = false;//不使用系统外壳程序启动 startInfo.RedirectStandardInput = true;//不重定向输入 startInfo.RedirectStandardOutput = true; //重定向输出 - startInfo.CreateNoWindow = false;//不创建窗口 + startInfo.CreateNoWindow = hideWindow;//不创建窗口 cmd.StartInfo = startInfo;