Exemplo n.º 1
0
        private void UpdateDisplay()
        {
            if (_ledType == LEDDisplyType.ComplexType)
            {
                for (int i = 0; i < _curLedInf.ScannerCount; i++)
                {
                    _scanBoardTempInfo = (ScanBoardRegionInfo)_curLedInf[i].Clone();
                    _tempAddr          = StaticFunction.GetSBAddr(_commPort,
                                                                  _scanBoardTempInfo.SenderIndex,
                                                                  _scanBoardTempInfo.PortIndex,
                                                                  _scanBoardTempInfo.ConnectIndex);

                    if (!_curSettingDic.ContainsKey(_tempAddr))
                    {
                        _curSettingDic.Add(_tempAddr, _commonInfo.SameCount);
                        if (_setOneScanBoardInfoEvent != null)
                        {
                            _setOneScanBoardInfoEvent.Invoke(_tempAddr, _commonInfo.SameCount);
                        }
                    }
                    _complexLayout.AddOneMonitorCardInf(_tempAddr, _curSettingDic[_tempAddr]);
                }
            }
            else
            {
                Point screenLocation = _curLedInf.GetScreenPosition();
                for (int i = 0; i < _curLedInf.ScannerCount; i++)
                {
                    if (_curLedInf[i] == null || _curLedInf[i].SenderIndex == 255)
                    {
                        continue;
                    }
                    _scanBoardTempInfo = (ScanBoardRegionInfo)_curLedInf[i].Clone();
                    _tempAddr          = StaticFunction.GetSBAddr(_commPort,
                                                                  _scanBoardTempInfo.SenderIndex,
                                                                  _scanBoardTempInfo.PortIndex,
                                                                  _scanBoardTempInfo.ConnectIndex);
                    _tempRect = new Rectangle(_scanBoardTempInfo.X - screenLocation.X,
                                              _scanBoardTempInfo.Y - screenLocation.Y,
                                              _scanBoardTempInfo.Width,
                                              _scanBoardTempInfo.Height);

                    if (!_curSettingDic.ContainsKey(_tempAddr))
                    {
                        _curSettingDic.Add(_tempAddr, _commonInfo.SameCount);

                        if (_setOneScanBoardInfoEvent != null)
                        {
                            _setOneScanBoardInfoEvent.Invoke(_tempAddr, _commonInfo.SameCount);
                        }
                    }
                    _tempCustomInfo = new SetCustomObjInfo();
                    _tempCustomInfo.ScanBordInfo = _scanBoardTempInfo;
                    _tempCustomInfo.Count        = _curSettingDic[_tempAddr];
                    _standarAndSimpleLayout.AddRectangularGrid(_tempRect, _tempAddr, _tempCustomInfo);
                }
                _standarAndSimpleLayout.InvalidateDrawArea();
            }
        }
        private void RemoveCountInfoForOther()
        {
            if (_oneLedInfos != null && _oneLedInfos.Count > 0)
            {
                List <string>       addrTempList      = new List <string>();
                string              addr              = "";
                ScanBoardRegionInfo scanBoardTempInfo = null;
                foreach (ILEDDisplayInfo led in _oneLedInfos)
                {
                    if (led == null)
                    {
                        continue;
                    }
                    for (int j = 0; j < led.ScannerCount; j++)
                    {
                        if (led[j] == null || led[j].SenderIndex == 255)
                        {
                            continue;
                        }
                        scanBoardTempInfo = (ScanBoardRegionInfo)led[j].Clone();
                        addr = StaticFunction.GetSBAddr(_commPort,
                                                        scanBoardTempInfo.SenderIndex,
                                                        scanBoardTempInfo.PortIndex,
                                                        scanBoardTempInfo.ConnectIndex);
                        addrTempList.Add(addr);
                    }
                }

                List <string> otherScanBoardAddrList = new List <string>();

                foreach (string key in _curConfigDic.Keys)
                {
                    if (!addrTempList.Contains(key))
                    {
                        otherScanBoardAddrList.Add(key);
                    }
                }

                for (int i = 0; i < otherScanBoardAddrList.Count; i++)
                {
                    _curConfigDic.Remove(otherScanBoardAddrList[i]);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 添加一个接收卡的监控信息
        /// </summary>
        /// <param name="addr"></param>
        /// <param name="info"></param>
        public void AddOneMonitorCardInf(string addr, byte count)
        {
            _countList.Add(count);
            _addrList.Add(addr);
            dbfDataGridView_ComplexLayout.RowCount++;
            int    nRowIndex = dbfDataGridView_ComplexLayout.RowCount - 1;
            bool   isConnect = false;
            string countStr  = CountArray[0];

            if (count > 0)
            {
                isConnect = true;
                countStr  = count.ToString();
            }

            string commPort       = "";
            byte   senderIndex    = 0;
            byte   portIndex      = 0;
            UInt16 scanBoardIndex = 0;

            StaticFunction.GetPerAddr(addr, out commPort, out senderIndex, out portIndex, out scanBoardIndex);
            dbfDataGridView_ComplexLayout.Rows[nRowIndex].SetValues(new object[]
            {
                isConnect,
                commPort,
                (senderIndex + 1).ToString(),
                (portIndex + 1).ToString(),
                (scanBoardIndex + 1).ToString(),
                countStr
            });

            DataGridViewDisableComboBoxCell comBoxCell = dbfDataGridView_ComplexLayout[(int)ColType.Count, nRowIndex] as DataGridViewDisableComboBoxCell;;

            if (isConnect)
            {
                comBoxCell.Enabled = true;
            }
            else
            {
                comBoxCell.Enabled = false;
            }
            this.Refresh();
        }
Exemplo n.º 4
0
        private void crystalButton_Resume_Click(object sender, EventArgs e)
        {
            string info = Frm_FanPowerAdvanceSetting.GetLangControlText("WhetherSetDefaultValue",
                                                                        "确认需要将当前显示屏的监控信息设置为默认值?");

            if (CustomMessageBox.ShowTopMostCustomMessageBox(this.ParentForm, info, "",
                                                             MessageBoxButtons.YesNo, MessageBoxIconType.Question) == DialogResult.No)
            {
                return;
            }

            if (_ledType == LEDDisplyType.ComplexType)
            {
                _complexLayout.ResumeDefaultCount(_commonInfo.SameCount);
            }
            else
            {
                for (int i = 0; i < _curLedInf.ScannerCount; i++)
                {
                    _scanBoardTempInfo = (ScanBoardRegionInfo)_curLedInf[i].Clone();
                    _tempAddr          = StaticFunction.GetSBAddr(_commPort,
                                                                  _scanBoardTempInfo.SenderIndex,
                                                                  _scanBoardTempInfo.PortIndex,
                                                                  _scanBoardTempInfo.ConnectIndex);

                    _tempCustomInfo              = new SetCustomObjInfo();
                    _tempCustomInfo.Count        = _commonInfo.SameCount;
                    _tempCustomInfo.ScanBordInfo = _scanBoardTempInfo;

                    _standarAndSimpleLayout.GridDic[_tempAddr].CustomObj = _tempCustomInfo;

                    _curSettingDic[_tempAddr] = _commonInfo.SameCount;

                    if (_setOneScanBoardInfoEvent != null)
                    {
                        _setOneScanBoardInfoEvent.Invoke(_tempAddr, _commonInfo.SameCount);
                    }
                }
                _standarAndSimpleLayout.InvalidateDrawArea();
            }
        }
Exemplo n.º 5
0
        private void StandarAndSimpleLayout_GridMouseDoubleClick(object sender, RectangularGridMouseEventArgs e)
        {
            if (e.GridInfo == null)
            {
                return;
            }
            _tempCustomInfo = (SetCustomObjInfo)e.GridInfo.CustomObj;
            if (_tempCustomInfo == null)
            {
                return;
            }
            _scanBoardTempInfo = (ScanBoardRegionInfo)_tempCustomInfo.ScanBordInfo.Clone();
            _tempCnt           = _tempCustomInfo.Count;

            _setInfoFrm = new Frm_SetInfo(_commonInfo.TypeStr, _tempCnt, _commonInfo.MaxCount);

            if (_setInfoFrm.ShowDialog() == DialogResult.OK)
            {
                _tempCustomInfo.Count = _setInfoFrm.Count;


                _tempAddr = StaticFunction.GetSBAddr(_commPort,
                                                     _scanBoardTempInfo.SenderIndex,
                                                     _scanBoardTempInfo.PortIndex,
                                                     _scanBoardTempInfo.ConnectIndex);

                _standarAndSimpleLayout.GridDic[_tempAddr].CustomObj = _tempCustomInfo;
                _curSettingDic[_tempAddr] = _setInfoFrm.Count;

                if (_setOneScanBoardInfoEvent != null)
                {
                    _setOneScanBoardInfoEvent.Invoke(_tempAddr, _setInfoFrm.Count);
                }
                _standarAndSimpleLayout.InvalidateDrawArea();
            }
        }
Exemplo n.º 6
0
        private void crystalButton_SetSelect_Click(object sender, EventArgs e)
        {
            if (_ledType == LEDDisplyType.ComplexType)
            {
                if (_complexLayout.SelectedItemRowsItems.Count <= 0)
                {
                    string info = Frm_FanPowerAdvanceSetting.GetLangControlText("PleaseSelectScanBoard", "请选中需要设置的接收卡!");
                    CustomMessageBox.ShowTopMostCustomMessageBox(this.ParentForm, info, "",
                                                                 MessageBoxButtons.OK, MessageBoxIconType.Alert);
                    return;
                }
                if (_complexLayout.SelectedItemRowsItems.Count == 1)
                {
                    bool bGetRes = _complexLayout.GetCountByRowIndex(_complexLayout.SelectedItemRowsItems[0].Index,
                                                                     out _tempCnt);
                }
                else
                {
                    _tempCnt = _commonInfo.SameCount;
                }

                _setInfoFrm = new Frm_SetInfo(_commonInfo.TypeStr, _tempCnt, _commonInfo.MaxCount);

                if (_setInfoFrm.ShowDialog() == DialogResult.OK)
                {
                    _complexLayout.SetCountForSelectedItems(_setInfoFrm.Count);
                }
            }
            else
            {
                if (_standarAndSimpleLayout.SelectedGrid == null ||
                    _standarAndSimpleLayout.SelectedGrid.Count <= 0)
                {
                    string info = Frm_FanPowerAdvanceSetting.GetLangControlText("PleaseSelectScanBoard", "请选中需要设置的接收卡!");
                    CustomMessageBox.ShowTopMostCustomMessageBox(this.ParentForm, info, "",
                                                                 MessageBoxButtons.OK, MessageBoxIconType.Alert);
                    return;
                }
                if (_standarAndSimpleLayout.SelectedGrid.Count == 1)
                {
                    _tempCustomInfo = (SetCustomObjInfo)_standarAndSimpleLayout.SelectedGrid[0].CustomObj;
                    if (_tempCustomInfo == null)
                    {
                        return;
                    }
                    _tempCnt = _tempCustomInfo.Count;
                }
                else
                {
                    _tempCnt = _commonInfo.SameCount;
                }

                _setInfoFrm = new Frm_SetInfo(_commonInfo.TypeStr, _tempCnt, _commonInfo.MaxCount);

                if (_setInfoFrm.ShowDialog() == DialogResult.OK)
                {
                    for (int i = 0; i < _standarAndSimpleLayout.SelectedGrid.Count; i++)
                    {
                        _tempCustomInfo = (SetCustomObjInfo)_standarAndSimpleLayout.SelectedGrid[i].CustomObj;
                        if (_tempCustomInfo == null)
                        {
                            continue;
                        }
                        _scanBoardTempInfo    = (ScanBoardRegionInfo)_tempCustomInfo.ScanBordInfo.Clone();
                        _tempCustomInfo.Count = _setInfoFrm.Count;
                        _standarAndSimpleLayout.SelectedGrid[i].CustomObj = _tempCustomInfo;

                        _tempAddr = StaticFunction.GetSBAddr(_commPort,
                                                             _scanBoardTempInfo.SenderIndex,
                                                             _scanBoardTempInfo.PortIndex,
                                                             _scanBoardTempInfo.ConnectIndex);

                        _curSettingDic[_tempAddr] = _setInfoFrm.Count;

                        if (_setOneScanBoardInfoEvent != null)
                        {
                            _setOneScanBoardInfoEvent.Invoke(_tempAddr, _setInfoFrm.Count);
                        }
                    }
                    _standarAndSimpleLayout.InvalidateDrawArea();
                }
            }
        }