2 using System.Collections.Generic;
3 using System.ComponentModel;
8 using System.Windows.Forms;
10 namespace SeciUserInterface.Dialogs.Graphs
18 InitializeComponent();
25 txtTitle.Text = Graph.Title;
26 txtYlabel.Text = Graph.YLabel;
27 txtY2label.Text = Graph.Y2Label;
28 comboRate.SelectedIndex = findIndex(Graph.UpdateRate);
29 chkShowZero1.Checked = Graph.ShowZeroY1;
30 chkShowZero2.Checked = Graph.ShowZeroY2;
37 comboRate.SelectedIndex = 5;
38 chkShowZero1.Checked =
true;
39 chkShowZero2.Checked =
true;
45 for (
int i = 0; i < comboRate.Items.Count; ++i)
47 if (comboRate.Items[i].ToString().StartsWith(updaterate.ToString()))
58 if (Graph.Plots.Count < Seci.Definitions.Status.MaxNumberPlotsPerGraph)
63 if (add.ShowDialog() == DialogResult.OK)
65 if (!lstPlots.Items.Contains(add.
Plot.BlockName))
67 Graph.Plots.Add(add.Plot);
73 MessageBox.Show(
"Plot not added: Block is already plotted in this graph.");
79 MessageBox.Show(
"Maximum number of plots allowed is " + Seci.Definitions.Status.MaxNumberPlotsPerGraph +
".");
85 if (lstPlots.SelectedIndex != -1)
87 int index = lstPlots.SelectedIndex;
89 edit.Plot = Graph.Plots[lstPlots.SelectedIndex];
91 if (edit.ShowDialog() == DialogResult.OK)
93 lstPlots.Items.RemoveAt(lstPlots.SelectedIndex);
94 if (!lstPlots.Items.Contains(edit.
Plot.BlockName))
96 Graph.Plots[index] = edit.Plot;
100 MessageBox.Show(
"Plot not changed: Block is already plotted in this graph.");
109 if (lstPlots.SelectedIndex != -1)
111 Graph.Plots.RemoveAt(lstPlots.SelectedIndex);
119 lstPlots.Items.Clear();
121 foreach (Seci.Definitions.PlotDefinition plot in Graph.Plots)
123 lstPlots.Items.Add(plot.BlockName);
129 if (txtTitle.Text.Trim() !=
"")
131 Graph.Title = txtTitle.Text.Trim();
132 Graph.YLabel = txtYlabel.Text.Trim();
133 Graph.Y2Label = txtY2label.Text.Trim();
134 String val = comboRate.SelectedItem.ToString();
136 if (Double.TryParse(val.Substring(0, val.IndexOf(
' ')), out rate))
138 Graph.UpdateRate = rate;
142 Graph.UpdateRate = 30.0;
145 Graph.ShowZeroY1 = chkShowZero1.Checked;
146 Graph.ShowZeroY2 = chkShowZero2.Checked;
148 DialogResult = DialogResult.OK;
153 MessageBox.Show(
"Please fill in the Graph Title",
"Missing Title", MessageBoxButtons.OK, MessageBoxIcon.Warning);
This class is used for serializing the graphs for saving in the configuration.
Seci.Definitions.PlotDefinition Plot