Example #1
0
        private void Form3_KeyDown(object sender, KeyEventArgs e)
        {
            /**
             * form31:uav
             * form32:car
             */
            //大坝位移超标事件数据传输
            if (e.Modifiers == Keys.Control && e.KeyCode == Keys.E)
            {
                this.setType("uav");
                if (this.isRunning2())
                {
                    this.stopProcess2();
                }
                else
                {
                    this.startProcess2();
                }

                //调用数据传输程序
                Process m_Process = new Process();
                m_Process.StartInfo.FileName = @".\exe\ERSSky\bind\ERSSky.exe";
                m_Process.Start();

                //睡眠一段时间
                Thread.Sleep(10000);

                //关闭进程
                Process[] proc = Process.GetProcessesByName("ERSSky");
                for (int i = 0; i < proc.Length; i++)
                {
                    proc[i].Kill();  //逐个结束进程.
                }
            }
            //"Ctrl + I"显示或隐藏数据传输链路
            else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.I)
            {
                //绘制数据传输链路
                this.userControl11.DrawLink();
            }
            //大坝位移超标事件数据处理
            else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.F)
            {
                this.setType("uav");
                if (this.isRunning3())
                {
                    this.stopProcess3();
                }
                else
                {
                    this.startProcess3();
                }

                if (form8.getClosed())
                {
                    form8 = new Form8();
                    form8.setForm3(this);
                    if (!form8.Visible)
                    {
                        form8.Show();
                    }
                }
                else
                {
                    form8.setForm3(this);
                    if (!form8.Visible)
                    {
                        form8.Show();
                    }
                }
            }
            //水质污染超标事件数据传输
            else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.NumPad6)
            {
                this.setType("car");
                if (this.isRunning2())
                {
                    this.stopProcess2();
                }
                else
                {
                    this.startProcess2();
                }
            }
            //水质污染超标事件数据传输链路
            else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.NumPad3)
            {
                userControl11.AddSensorNetwork();
            }
            else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.NumPad7)
            {
                this.setType("car");
                //数据传输
                if (this.isRunning2())
                {
                    this.stopProcess2();
                }
                else
                {
                    this.startProcess2();
                }

                //数据处理
                if (this.isRunning3())
                {
                    this.stopProcess3();
                }
                else
                {
                    this.startProcess3();
                }

                if (form8.getClosed())
                {
                    form8 = new Form8();
                    form8.setForm3(this);
                    if (!form8.Visible)
                    {
                        form8.Show();
                    }
                }
                else
                {
                    form8.setForm3(this);
                    if (!form8.Visible)
                    {
                        form8.Show();
                    }
                }
            }
        }