Esempio n. 1
0
            /// <summary>
            /// 状态视图各矩形生成
            /// </summary>
            /// <param name="slotNum">槽位数量</param>
            /// <param name="link"></param>
            private void AssignSloteRects(int slotNum, out Rectangle link)
            {
                List <Rectangle> rtgs = new List <Rectangle>();//均分矩形

                int slotWidth  = _dsRec.Width;
                int slotHeight = _dsRec.Height / slotNum;
                int rtgX       = _dsRec.Location.X;
                int rtgY       = _dsRec.Location.Y;
                int slotKeyX   = 0;
                int slotKeyY   = 0;
                int countNum   = 0;

                for (int i = 0; i < slotNum; i++)
                {
                    rtgs.Add(new Rectangle(rtgX, rtgY + slotHeight * i, slotWidth, slotHeight));
                }

                slotWidth   = _dsRec.Width * 2 / 3;
                slotHeight /= 2;
                foreach (var rec in rtgs)
                {
                    SlotInfo slotInfo = new SlotInfo();
                    rtgX     = rec.Location.X + slotWidth / 4;
                    rtgY     = rec.Location.Y + slotHeight / 4;
                    slotKeyX = rtgX - slotHeight * 2;
                    slotKeyY = rtgY + slotHeight / 4;

                    slotInfo._slotChantRec = new Rectangle(slotKeyX, slotKeyY, slotHeight, slotHeight / 2);
                    slotInfo._slotShowRec  = new Rectangle(rtgX, rtgY, slotWidth, slotHeight);
                    slotInfo.slotChan      = countNum + 1;

                    slotInfo._temp     = _listSlots[countNum]._temp;
                    slotInfo._type     = _listSlots[countNum]._type;
                    slotInfo._voltage  = _listSlots[countNum]._voltage;
                    slotInfo._electric = _listSlots[countNum]._electric;
                    slotInfo._power    = _listSlots[countNum]._power;
                    slotInfo._status   = _listSlots[countNum]._status;

                    //_listSlots.Add(countNum, slotInfo);
                    _listSlots[countNum] = slotInfo;
                    countNum++;
                }
                link = new Rectangle(slotKeyX + slotHeight, _dsRec.Y, slotHeight, _dsRec.Height);
            }
Esempio n. 2
0
        private void ProcessNodeInfo(SystemInformation sysInfo, Dictionary <int, SlotInfo> infos)
        {
            try
            {
                //解析数据
                int slotNum = sysInfo._slotNum;       //槽位数
                _slotNum = slotNum;
                for (int i = 0; i < slotNum; i++)
                {
                    var slotInfo = sysInfo._boardsInfo[i];
                    int slotSn   = i + 1;

                    SlotInfo sInfo = new SlotInfo();
                    sInfo.slotChan = slotSn;
                    sInfo._type    = "板卡" + slotSn.ToString();
                    if (slotInfo._isOnline == 1) //在线
                    {
                        sInfo._temp     = slotInfo._temp;
                        sInfo._voltage  = slotInfo._vol;
                        sInfo._electric = slotInfo._cur;
                        sInfo._power    = slotInfo._power;
                        sInfo._status   = IsException(sInfo) ? "异常" : "正常";
                    }
                    else
                    {
                        sInfo._status = "异常";
                    }
                    infos.Add(i, sInfo);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("ProcessNodeInfo:" + e.Message);
                return;
            }
        }
Esempio n. 3
0
 //判断信息是都异常
 private bool IsException(SlotInfo info)
 {
     return(false);
 }