2 using System.Collections.Generic;
3 using System.ComponentModel;
7 using System.Windows.Forms;
9 namespace Sample_Environment_Control_Interface.Dialogs.Blocks
18 InitializeComponent();
24 foreach (DataGridViewColumn i
in dataGridView1.Columns)
26 i.SortMode = DataGridViewColumnSortMode.NotSortable;
29 if (Seci.SeciInterface.SeciStatus.UseDaeMonitorVi)
31 Seci.SeciInterface.DAEMonitor_GetRunControlSettings();
38 if (tempBlocks == null)
51 dataGridView1.Rows.Clear();
54 if (tempBlocks != null)
56 for (
int i = 0; i < tempBlocks.Count; ++i)
59 Boolean OutofRange = Seci.SeciInterface.Blocks[i].OutOfRange();
60 String InRange =
"True";
69 if (Seci.SeciInterface.Blocks[i].BlockEnabled)
71 dataGridView1.Rows.Add(tempBlocks[i].BlockName, tempBlocks[i].UnderRunControl,
72 tempBlocks[i].LowerLimit, tempBlocks[i].UpperLimit,
73 tempBlocks[i].CurrentValue, InRange,
"N/A");
77 dataGridView1.Rows.Add(tempBlocks[i].BlockName, tempBlocks[i].UnderRunControl,
78 tempBlocks[i].LowerLimit, tempBlocks[i].UpperLimit,
84 dataGridView1.Sort(dataGridView1.Columns[
"colBlock"], ListSortDirection.Ascending);
92 if (tempBlocks != null)
95 for (
int i = 0; i < dataGridView1.Rows.Count; ++i)
98 if (Seci.SeciInterface.Blocks[dataGridView1.Rows[i].Cells[
"colBlock"].Value.ToString()].BlockEnabled)
101 dataGridView1.Rows[i].Cells[
"colRunControl"].Value = Seci.SeciInterface.Blocks[dataGridView1.Rows[i].Cells[
"colBlock"].Value.ToString()].UnderRunControl;
103 dataGridView1.Rows[i].Cells[
"colCurrent"].Value = Seci.SeciInterface.Blocks[dataGridView1.Rows[i].Cells[
"colBlock"].Value.ToString()].CurrentValue;
106 Boolean OutofRange = Seci.SeciInterface.Blocks[dataGridView1.Rows[i].Cells[
"colBlock"].Value.ToString()].OutOfRange();
107 String InRange =
"True";
114 dataGridView1.Rows[i].Cells[
"colInRange"].Value = InRange;
118 dataGridView1.Rows[i].Cells[
"colCurrent"].Value =
"N/A";
119 dataGridView1.Rows[i].Cells[
"colInRange"].Value =
"N/A";
132 doChanges(tempBlocks[dataGridView1.CurrentRow.Cells[
"colBlock"].Value.ToString()]);
139 if (dataGridView1.CurrentCell == dataGridView1.CurrentRow.Cells[
"colRunControl"])
141 block.UnderRunControl = (bool)dataGridView1.CurrentRow.Cells[
"colRunControl"].Value;
143 else if (dataGridView1.CurrentCell == dataGridView1.CurrentRow.Cells[
"colLower"])
147 block.LowerLimit = Convert.ToDouble(dataGridView1.CurrentRow.Cells[
"colLower"].Value);
151 MessageBox.Show(
"Invalid value enter; value rest to previous value.",
"Invalid Value", MessageBoxButtons.OK, MessageBoxIcon.Error);
152 dataGridView1.CurrentRow.Cells[
"colLower"].Value = block.LowerLimit;
155 else if (dataGridView1.CurrentCell == dataGridView1.CurrentRow.Cells[
"colUpper"])
159 block.UpperLimit = Convert.ToDouble(dataGridView1.CurrentRow.Cells[
"colUpper"].Value);
163 MessageBox.Show(
"Invalid value enter; value rest to previous value.",
"Invalid Value", MessageBoxButtons.OK, MessageBoxIcon.Error);
164 dataGridView1.CurrentRow.Cells[
"colUpper"].Value = block.UpperLimit;
173 for (
int i = 0; i < tempBlocks.Count; ++i)
175 if (tempBlocks[i].LowerLimit > tempBlocks[i].UpperLimit)
178 double temp = tempBlocks[i].LowerLimit;
179 tempBlocks[i].LowerLimit = tempBlocks[i].UpperLimit;
180 tempBlocks[i].UpperLimit = temp;
185 Seci.SeciInterface.Blocks = tempBlocks;
189 if (Seci.SeciInterface.SeciStatus.UseDaeMonitorVi)
191 Seci.SeciInterface.DAEMonitor_SetBlocks();
194 DialogResult = DialogResult.OK;
206 DialogResult = DialogResult.Cancel;
void initialiseDataGrid()
void doChanges(Seci.BlockInfo block)
void RunControlViewer_Load(object sender, EventArgs e)
void dataGridView1_CellValidated(object sender, DataGridViewCellEventArgs e)
void timer1_Tick(object sender, EventArgs e)
Specialised version of the Dictionary class which can be converted to XML. Also has some additional s...
void btnCancel_Click(object sender, EventArgs e)
void btnOK_Click(object sender, EventArgs e)