public Caisson(BoardCardManager boardCardManager,
                BoardCardChannleInfo motorChannle,
                BoardCardChannleInfo fanChannle,
                string name,
                bool hasPumping = false, BoardCardChannleInfo waterPumpChannle = default(BoardCardChannleInfo),
                BoardCardChannleInfo liquidLevelSwitchChannle = default(BoardCardChannleInfo),
                UInt32 waterLevelTime = 1000)
 {
     this.boardCardManager         = boardCardManager;
     this.motorChannle             = motorChannle;
     this.fanChannle               = fanChannle;
     this.waterPumpChannle         = waterPumpChannle;
     this.liquidLevelSwitchChannle = liquidLevelSwitchChannle;
     this.isOverWaterLevel         = false;
     this.waterPumpRunning         = false;
     this.hasPumping               = hasPumping;
     this.name = name;
     if (this.hasPumping)
     {
         this.waterLevelTime  = waterLevelTime;
         this.waterLevelTimer = new MyTimer(waterLevelTime);
         this.waterLevelTimer.WaitCallback = new WaitOrTimerCallback(CallbackFun);
         this.waterLevelTimer.Start();
     }
 }
        private void modbtn_Click(object sender, EventArgs e)
        {
            if (this.selectedCaissonInfo == null)
            {
                return;
            }

            if (String.IsNullOrEmpty(this.caissonNametxt.Text))
            {
                MessageBox.Show("沉箱名字不能为空!");
            }

            GlobalParameter.GetInstance().UnitMediator.Caissons.Remove(this.selectedCaissonInfo.Caisson);
            this.caissonbds.Remove(this.selectedCaissonInfo);

            BoardCardChannleInfo motorChlInfo = new BoardCardChannleInfo(
                this.motorboardDiscmb.SelectedItem.ToString(), (int)this.motorBoardChannlecmb.SelectedItem);
            BoardCardChannleInfo fanChlInfo = new BoardCardChannleInfo(
                this.fanBoardDiscmb.SelectedItem.ToString(), (int)this.fanChannlecmb.SelectedItem);

            Caisson caisson = new Caisson(BoardCardManager.GetInstance(),
                                          motorChlInfo, fanChlInfo, this.caissonNametxt.Text);

            if (this.hasPumpchk.Checked)
            {
                caisson.HasPumping       = true;
                caisson.WaterPumpChannle = new BoardCardChannleInfo(
                    this.pumpBoardDiscmb.SelectedItem.ToString(), (int)this.pumpChannlecmb.SelectedItem);
                caisson.LiquidLevelSwitchChannle = new BoardCardChannleInfo(
                    this.liquidLevelSwitchDiscmb.SelectedItem.ToString(), (int)this.liquidLevelSwitchChannlecmb.SelectedItem);

                UInt32 timeout;
                if (UInt32.TryParse(this.waterLevelTimetxt.Text, out timeout) && timeout > 0)
                {
                    caisson.WaterLevelTime = timeout;
                }
            }

            GlobalParameter.GetInstance().UnitMediator.Caissons.Add(caisson);
            this.caissonbds.Add(new CaissonInfo(caisson));

            MessageBox.Show("修改成功!");
        }