예제 #1
0
 //添加消费机
 private void button1_Click(object sender, System.EventArgs e)
 {
     int comport = decimal.ToInt32(ComPort.Value);
     int posit =  decimal.ToInt32(PosId.Value);
     Pos pos = new Pos(comport,posit);
     bool posconnect = pos.IsConnected();
     Poses.Add(pos);
     ListViewItem newpos = new ListViewItem(
         new string[]{
             "COM"+comport,
             ""+posit,
             (posconnect?"已连接":"未连接")},
             null,
             posconnect?System.Drawing.Color.Black:System.Drawing.Color.Gray,
             System.Drawing.Color.White,
             this.checkBox1.Font
         );
     PosList.Items.Add(newpos);
     ComPort.Value++;
     PosId.Value++;
 }