コード例 #1
0
ファイル: CardTable.cs プロジェクト: yisea123/TestOne
        private void FillTableWithAxisInf(CARD card, int row = -2)
        {
            if (card == null)
            {
                return;
            }
            //if empty or add mode then add
            //if (dgv.Rows.Count == 0|| row == -2) row = dgv.Rows.Add();
            if (dgv.Rows.Count == 0 || row < 0 || row >= dgv.Rows.Count)
            {
                row = dgv.Rows.Add();
            }
            //the last row
            else if (row < 0)
            {
                row = dgv.Rows.Count - 1;
            }

            dgv.Rows[row].Cells[0].Value = card.disc;
            dgv.Rows[row].Cells[1].Value = card.isReady?"就绪":"异常";
            dgv.Rows[row].Cells[2].Value = card.id;
            dgv.Rows[row].Cells[3].Value = card.ip.Length > 0 ? card.ip : (card.maincard_id > 0 ? string.Format("{0}/{1}", card.card_id, card.maincard_id) : card.card_id.ToString());
            dgv.Rows[row].Cells[4].Value = card.ax_num;
            dgv.Rows[row].Cells[5].Value = card.output_num;
            dgv.Rows[row].Cells[6].Value = card.input_num;
            dgv.Rows[row].Cells[7].Value = card.brand;
            dgv.Rows[row].Cells[8].Value = card.ps;
        }
コード例 #2
0
ファイル: CardTable.cs プロジェクト: yisea123/TestOne
 public void AddCard(CARD card)
 {
     if (true)//if (ax.isInit)
     {
         if (list_card.Contains(card) == false)
         {
             list_card.Add(card);
             FillTableWithAxisInf(card);
         }
     }
     else
     {
         VAR.msg.AddMsg(Msg.EM_MSGTYPE.ERR, String.Format("板卡列表,{0} 未初始化!", card.disc));
         return;
     }
 }
コード例 #3
0
ファイル: GPIO.cs プロジェクト: yisea123/TestOne
        public GPIO(ushort io_num, AXIS ax, IO_DIR dir, IO_TYPE type, string disc, IO_STA default_sta = IO_STA.NULL, bool binvert = false)
        {
            this.bInvert = binvert;
            axis         = ax;
            card         = ax.card;
            if (card != null)
            {
                m_id = (int)(card.id << 8) + (int)(io_num & 0xFF);
            }
            else
            {
                m_id = -1;
            }

            num              = io_num;
            this.dir         = dir;
            this.type        = type;
            str_disc         = disc;
            this.default_sta = default_sta;

            //check num
            if (num < 0 || ((int)type == (int)IO_TYPE.VIRTUAL_ELN && (int)type == (int)IO_TYPE.VIRTUAL_ORG) && num >= card.ax_num)
            {
                VAR.msg.AddMsg(Msg.EM_MSGTYPE.ERR, String.Format("{0} io_num {1} 超范围[{2},{3})", disc, num, 0, card.ax_num));
            }
            else
            {
                if (dir == IO_DIR.IN && (type == IO_TYPE.MT_CARD && num >= card.input_num) || (type == IO_TYPE.IO_CARD && num > card.input_num))
                {
                    VAR.msg.AddMsg(Msg.EM_MSGTYPE.ERR, String.Format("{0} io_num {1} 超范围[{2},{3}]", disc, num, 0, card.input_num));
                }
                if (dir == IO_DIR.OUT && (type == IO_TYPE.MT_CARD && num >= card.output_num) || (type == IO_TYPE.IO_CARD && num > card.output_num))
                {
                    VAR.msg.AddMsg(Msg.EM_MSGTYPE.ERR, String.Format("{0} io_num {1} 超范围[{2},{3}]", disc, num, 0, card.output_num));
                }
            }

            ChkSafe = null;

            if (card != null)
            {
                card.GPIOList.Add(this);
            }
        }