Example #1
0
 public void setTerminal(DXBStudio.Terminal terminal)
 {
     this.terminal = terminal;
     byte[] bb = BitConverter.GetBytes(terminal.Id);
     Text = "数据展示——"+ string.Format("终端号:{0:X2}{1:X2}{2:X2}{3:X2}",bb[0],bb[1],bb[2],bb[3]);
     dateTimePicker1.Value = DateTime.Now;
     dateTimePicker2.Value = DateTime.Now;
 }
Example #2
0
 public void AppRow(DataGridView dataGridView1, DXBStudio.Terminal t)
 {
     dataGridView1.Rows.Add();
     int i = dataGridView1.Rows.Count;
     dataGridView1.Rows[dataGridView1.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Yellow;
     dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0].Value = i ;
     dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[1].Value = t.Id;
     dataGridView1.Rows[dataGridView1.Rows.Count - 1].Tag = t;
     t.RowIndex = dataGridView1.Rows[i - 1].Index;
     //初始化无间隔发送时间
     //dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[2].Value =
     t.StateChange += new DXBStudio.Terminal._StateChange(t_StateChange);
     t.RecvData += new DXBStudio.Terminal._RecvData(t_RecvData);
 }
Example #3
0
        void t_StateChange(DXBStudio.Terminal sender,DXBStudio.Terminal.ConnectState cs)
        {
            //throw new NotImplementedException();
            if (cs == DXBStudio.Terminal.ConnectState.Normal)
            {
                dataGridView1.Rows[sender.RowIndex].DefaultCellStyle.BackColor = Color.Green;
                dataGridView1.Rows[sender.RowIndex].Cells[2].Value = "连接";
                lConNums.Text = (int.Parse(lConNums.Text) + 1).ToString();
                return;
            }
            if (cs == DXBStudio.Terminal.ConnectState.Disconnect)
            {
                dataGridView1.Rows[sender.RowIndex].DefaultCellStyle.BackColor = Color.Yellow;
                dataGridView1.Rows[sender.RowIndex].Cells[2].Value = "未连接";
                lConNums.Text = (int.Parse(lConNums.Text) - 1).ToString();
                return;
            }

            dataGridView1.Rows[sender.RowIndex].Cells[2].Value = "严重问题";
            dataGridView1.Rows[sender.RowIndex].DefaultCellStyle.BackColor = Color.Red;
            lConNums.Text = (int.Parse(lConNums.Text) - 1).ToString();
            return;
        }
Example #4
0
 void t_RecvData(DXBStudio.Terminal sender)
 {
     if (sender.State == DXBStudio.Terminal.ConnectState.Normal)
     {
         dataGridView1.Rows[sender.RowIndex].DefaultCellStyle.BackColor = Color.Green;
         dataGridView1.Rows[sender.RowIndex].Cells[2].Value = "连接";
     }
     if (sender.LastRecv != null)
     {
         dataGridView1.Rows[sender.RowIndex].Cells[3].Value = (sender.NowRecv - sender.LastRecv).TotalSeconds;
         sender.GPRSPeriod = (int)dataGridView1.Rows[sender.RowIndex].Cells[3].Value;
     }
 }
Example #5
0
        public void setTerminal(DXBStudio.Terminal terminal)
        {
            this.terminal = terminal;

            Text = "Can 设置 , 终端号:" + terminal.Id.ToString();
        }
Example #6
0
 public CanSet(DXBStudio.Terminal terminal)
 {
     InitializeComponent();
     // TODO: Complete member initialization
     setTerminal(terminal);
 }