2 using System.Collections.Generic;
3 using System.ComponentModel;
8 using System.Windows.Forms;
10 namespace SeciUserInterface.Dialogs.Graphs
19 InitializeComponent();
20 _maxGraphs = maxGraphs;
37 if (Graphs.Count < _maxGraphs)
40 if (add.ShowDialog() == DialogResult.OK)
42 Graphs.Add(add.Graph);
48 MessageBox.Show(
"Maximum number of graphs allowed is " + _maxGraphs +
".");
54 if (lstGraphs.SelectedIndex != -1)
56 if (!String.IsNullOrEmpty(Graphs[lstGraphs.SelectedIndex].OwningComponent))
58 MessageBox.Show(
"This graph belongs to a Sub-Configuration and cannot be edited.",
"Cannot Edit Graph", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
63 edit.Graph = Graphs[lstGraphs.SelectedIndex];
64 if (edit.ShowDialog() == DialogResult.OK)
66 Graphs[lstGraphs.SelectedIndex] = edit.Graph;
74 if (lstGraphs.SelectedIndex != -1)
76 if (!String.IsNullOrEmpty(Graphs[lstGraphs.SelectedIndex].OwningComponent))
78 MessageBox.Show(
"This graph belongs to a Sub-Configuration and cannot be deleted.",
"Cannot Delete Graph", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
82 Graphs.RemoveAt(lstGraphs.SelectedIndex);
89 lstGraphs.Items.Clear();
91 foreach (Seci.Definitions.GraphDefinition graph in Graphs)
93 lstGraphs.Items.Add(graph.Title);
95 lstPlots.Items.Clear();
101 DialogResult = DialogResult.OK;
107 lstPlots.Items.Clear();
109 if (lstGraphs.SelectedIndex != -1)
111 for (
int i = 0; i < Graphs[lstGraphs.SelectedIndex].Plots.Count; ++i)
113 lstPlots.Items.Add(Graphs[lstGraphs.SelectedIndex].Plots[i].BlockName);
This class is used for serializing the graphs for saving in the configuration.