Пример #1
0
        private void ShowBoardInfo(int index)
        {
            Board board = getBoardInfoDelegate(index);

            dgvControlBits.Rows.Clear();
            dgvControlBits.Refresh();

            dgvParams.Rows.Clear();
            dgvParams.Refresh();

            for (byte loop = 0; loop < board.Params.GetNumberOfParams(board.BoardVersion); loop++)
            {
                ParamInfo paramInfo = board.Params[loop].GetParamInfo(board.BoardVersion);

                if (paramInfo == null)
                {
                    _logger.WriteLine(LogLevel.Error, $"Unable to load param bit info for bit[{loop}] and board ver[{board.BoardVersion}]");
                    return;
                }

                if (paramInfo.Visible)
                {
                    DataGridViewRow dgr = new DataGridViewRow();

                    dgr.Cells.Add(new DataGridViewTextBoxCell());
                    dgr.Cells.Add(new DataGridViewTextBoxCell());
                    dgr.Cells.Add(new DataGridViewTextBoxCell());

                    dgr.Cells[0].Value = loop;
                    dgr.Cells[1].Value = paramInfo.Description;
                    dgr.Cells[2].Value = board.Params[loop].Value;

                    dgvParams.Rows.Add(dgr);
                }
            }

            ControlBitParam controlBitParam = board.ControlParam;

            for (byte loop = 0; loop < ControlBitParam.NUMBER_OF_CONTROL_BITS; loop++)
            {
                ControlBitInfo controlBitInfo = controlBitParam[loop].GetControlBitInfo(board.BoardVersion);
                if (controlBitInfo == null)
                {
                    _logger.WriteLine(LogLevel.Error, $"Unable to load control bit info for bit[{loop}] and board ver[{board.BoardVersion}]");
                    return;
                }
                if (controlBitInfo.Visible)
                {
                    DataGridViewRow dgr = new DataGridViewRow();

                    dgr.Cells.Add(new DataGridViewTextBoxCell());
                    dgr.Cells.Add(new DataGridViewTextBoxCell());
                    dgr.Cells.Add(new DataGridViewComboBoxCell());

                    dgr.Cells[0].Value = loop;
                    dgr.Cells[1].Value = controlBitInfo.Description;

                    // fill combobox

                    DataGridViewComboBoxCell comboBoxCell = (DataGridViewComboBoxCell)(dgr.Cells[2]);

                    foreach (string valueInfo in controlBitInfo.ValuesInfo)
                    {
                        comboBoxCell.Items.Add(valueInfo);
                    }
                    comboBoxCell.Value = comboBoxCell.Items[0];

                    dgvControlBits.Rows.Add(dgr);
                }
            }
        }
Пример #2
0
 public Board()
 {
     BoardVersion = Defs.CB_DEFAULT_BOARD_VERSION;
     ControlParam = new ControlBitParam(Settings.ApplicationPath + Defs.PARAMINFO_INI_FILE_NAME);
     Params       = new ParamArray(Settings.ApplicationPath + Defs.PARAMINFO_INI_FILE_NAME);
 }