Пример #1
0
        private void AlarmGroupList_Load(object sender, EventArgs e)
        {
            var alarmGroups = _iAlarmDesignRepository.FindAlarmGroups();

            dataGridView1.Rows.Clear();
            foreach (var alarmGroup in alarmGroups)
            {
                var row = new DataGridViewRow();
                row.CreateCells(dataGridView1);
                row.Cells[0].Value = alarmGroup.Name;
                row.Cells[1].Value = alarmGroup.Description;
                dataGridView1.Rows.Add(row);
            }
        }
Пример #2
0
        private void RefreshDataGridView()
        {
            switch (_displayState)
            {
            case Displaytype.Alarm:
                dataGridView_Avaiable.Rows.Clear();
                foreach (AlarmBase alarmBase in _iAalarmDesignRepository.FindAlarms())
                {
                    var alarmGridViewRow = new DataGridViewRow();
                    alarmGridViewRow.CreateCells(dataGridView_Avaiable);
                    alarmGridViewRow.Cells[0].Value = alarmBase.Name;
                    alarmGridViewRow.Cells[1].Value = alarmBase.Variable == null ? null : alarmBase.Variable.Name;
                    alarmGridViewRow.Cells[2].Value = alarmBase;
                    alarmGridViewRow.Cells[3].Value = alarm_Level.Items[alarmBase.Level];
                    alarmGridViewRow.Cells[4].Value = alarmBase.Group == null ? null : alarmBase.Group.Name;
                    alarmGridViewRow.Cells[5].Value = alarmBase.Description;
                    dataGridView_Avaiable.Rows.Add(alarmGridViewRow);
                }
                break;

            case Displaytype.AlarmGroup:
                dataGridView_Avaiable.Rows.Clear();
                foreach (AlarmGroup alarmGroup in _iAalarmDesignRepository.FindAlarmGroups())
                {
                    var alarmGridViewRow = new DataGridViewRow();
                    alarmGridViewRow.CreateCells(dataGridView_Avaiable);
                    alarmGridViewRow.Cells[0].Value = alarmGroup.Name;
                    alarmGridViewRow.Cells[1].Value = alarmGroup.Description;
                    dataGridView_Avaiable.Rows.Add(alarmGridViewRow);
                }
                break;

            case Displaytype.Variable:
                treeView_FunctionTest.SelectedNode = _currentNode;
                VariableGroup varGroup =
                    _iVariableDesignRepository.FindGroupByPath(GetVariableGroupPath(_currentNode.FullPath));
                if (varGroup == null)
                {
                    return;
                }
                dataGridView_Avaiable.Rows.Clear();
                foreach (VariableBase variable in _iVariableDesignRepository.FindVariables(varGroup.AbsolutePath))
                {
                    AddVarToListview(variable, dataGridView_Avaiable);
                }
                break;
            }
        }