Esempio n. 1
0
        //发送雷达
        private void btnLD_Click(object sender, EventArgs e)
        {
            Capm c = new Capm();

            c.ModelType = cboModel.SelectedIndex; //型号
            c.MsgType   = 3;                      //消息类型

            string data = TcpManager.Client(txtIP.Text, Convert.ToInt32(txtPort.Text), getJson(c));

            ExecuteResponse(data);
        }
Esempio n. 2
0
        /// <summary>
        /// PMW端口测试
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSend_Click(object sender, EventArgs e)
        {
            Capm c = new Capm();

            c.ModelType = cboModel.SelectedIndex; //型号
            c.MsgType   = 2;                      //消息类型
            c.Ids       = new int[] { Convert.ToInt32(txtPMWid.Value) };
            c.Vals      = new int[] { Convert.ToInt32(txtPMWVal.Value) };

            string data = TcpManager.Client(txtIP.Text, Convert.ToInt32(txtPort.Text), getJson(c));

            ExecuteResponse(data);
        }
Esempio n. 3
0
        /// <summary>
        /// 执行动作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDJ1_Click(object sender, EventArgs e)
        {
            int num = Convert.ToInt32(((Button)sender).Tag);//机号位

            Capm c = new Capm();

            c.ModelType = cboModel.SelectedIndex; //型号
            c.MsgType   = 0;                      //消息类型
            c.Ids       = new int[] { num };
            c.Vals      = new int[] { GetValuesByNum(num) };

            string data = TcpManager.Client(txtIP.Text, Convert.ToInt32(txtPort.Text), getJson(c));

            ExecuteResponse(data);
        }
Esempio n. 4
0
        private void btnSom_Click(object sender, EventArgs e)
        {
            int num = Convert.ToInt32(((Button)sender).Tag);//机号位

            string[] sp = txtsome.Text.Split(',');

            Capm c = new Capm();

            c.ModelType = cboModel.SelectedIndex; //型号
            c.MsgType   = 0;                      //消息类型
            c.Ids       = new int[] { 1, 2, 3, 4, 5, 6, 7 };
            c.Vals      = ConvertIntByString(sp);

            string data = TcpManager.Client(txtIP.Text, Convert.ToInt32(txtPort.Text), getJson(c));

            ExecuteResponse(data);
        }
Esempio n. 5
0
        /// <summary>
        /// 批量操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void grd_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 8)
            {
                int i = e.RowIndex;
                //执行
                Capm c = new Capm();
                c.ModelType = cboModel.SelectedIndex; //型号
                c.MsgType   = 0;                      //消息类型
                c.Ids       = new int[] { 1, 2, 3, 4, 5, 6, 7 };

                c.Vals = new int[] { Convert.ToInt32(dt.Rows[i]["col1"]),
                                     Convert.ToInt32(dt.Rows[i]["col2"]),
                                     Convert.ToInt32(dt.Rows[i]["col3"]),
                                     Convert.ToInt32(dt.Rows[i]["col4"]),
                                     Convert.ToInt32(dt.Rows[i]["col5"]),
                                     Convert.ToInt32(dt.Rows[i]["col6"]),
                                     Convert.ToInt32(dt.Rows[i]["col7"]) };

                string data = TcpManager.Client(txtIP.Text, Convert.ToInt32(txtPort.Text), getJson(c));
                ExecuteResponse(data);
            }
            else if (e.ColumnIndex == 9)
            {
                //删除
                dt.Rows.RemoveAt(e.RowIndex);
                grd.DataSource = dt;
            }
            else if (e.ColumnIndex == 10)
            {
                if (e.RowIndex != 0)
                {
                    DataRow dr = dt.NewRow();
                    for (int i = 0; i < dt.Columns.Count; i++)
                    {
                        dr[dt.Columns[i].Caption] = dt.Rows[e.RowIndex][dt.Columns[i].Caption];
                    }
                    dt.Rows.RemoveAt(e.RowIndex);
                    dt.Rows.InsertAt(dr, e.RowIndex - 1);
                    grd.DataSource = dt;
                }
            }
        }