Browse Source

submit code

zhouxianguang 6 years ago
parent
commit
8aaa6a97b1
2 changed files with 7 additions and 51 deletions
  1. 2 3
      WinBox/CloseForm.cs
  2. 5 48
      WinBox/MainForm.cs

+ 2 - 3
WinBox/CloseForm.cs

@@ -32,14 +32,13 @@ namespace WinBox
             this.Height = rect.Height;
             this.Width = rect.Width;
             this.Location = new Point(0, 0);
-
-
             //this.Owner.Hide();
         }
 
         private void button1_Click(object sender, EventArgs e)
         {
-            this.mainForm.Show();
+            this.Hide();
+            this.mainForm.ShowDialog();
         }
 
         private void button2_Click(object sender, EventArgs e)

+ 5 - 48
WinBox/MainForm.cs

@@ -29,7 +29,11 @@ namespace WinBox
         /// </summary>
         private void Form1_Load(object sender, EventArgs e)
         {
-            closeForm = new CloseForm();
+            if (this.closeForm == null)
+            {
+                closeForm = new CloseForm();
+            }
+          
             //设置IE版本
             SetIE(IeVersion.标准ie11);
             this.webBrowser1 = new System.Windows.Forms.WebBrowser();
@@ -50,53 +54,6 @@ namespace WinBox
           
         }
 
-        private void detectionPort()
-        {
-            string tcpPort = "9191";
-            try
-            {
-                if (tcpPort == "" || tcpPort == null)
-                {
-                    MessageBox.Show("请输入TCP端口号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
-                }
-                else
-                {
-                    Process process = new Process();
-                    process.StartInfo = new ProcessStartInfo("netstat", "/ano");
-                    process.StartInfo.CreateNoWindow = true;
-                    process.StartInfo.UseShellExecute = false;
-                    process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
-                    process.StartInfo.RedirectStandardOutput = true;
-                    process.Start();
-                    StreamReader reader = process.StandardOutput;
-                   
-                    while (!reader.EndOfStream)
-                    {
-                        string msg = reader.ReadLine().ToUpper();
-                        MessageBox.Show(msg);
-                        if (msg.IndexOf("TCP") > 0 && msg.IndexOf(":" + tcpPort) > 0)
-                        {
-                            string info = msg.Trim();
-                            //MessageBox.Show("TCP:" + tcpPort + "端口被占用!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
-                            break;
-                        }
-                        else
-                        {
-                            MessageBox.Show("有依赖项启动失败,请重新启动客户端或联系管理员!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
-                            break;
-                        }
-                    }
-
-                    reader.Close();
-                    process.Close();
-                }
-            }
-            catch (Exception ex)
-            {
-                MessageBox.Show("检测TCP端口:" + tcpPort + "失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
-            }
-        }
-
         private void Form1_Activated(object sender, System.EventArgs e)
         {
             // Label1.Text = "x: " + x + " y: " + y;