SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
Configure_RunInfo.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Text;
7 using System.Windows.Forms;
8 
9 namespace Sample_Environment_Control_Interface.Dialogs.Layout
10 {
11  public partial class Configure_RunInfo : Form
12  {
13  public Seci.SerialisableList<SECI_Controls.Run_Information.Scaling_RunInfo> current = new Seci.SerialisableList<SECI_Controls.Run_Information.Scaling_RunInfo>();
14 
15  public Configure_RunInfo(Seci.SerialisableList<SECI_Controls.Run_Information.Scaling_RunInfo> list)
16  {
17  InitializeComponent();
18 
19  for (int i = 0; i < list.Count; ++i)
20  {
21  SECI_Controls.Run_Information.Scaling_RunInfo temp = new SECI_Controls.Run_Information.Scaling_RunInfo();
22  temp.Location = list[i].Location;
23  temp.ItemsToShow = list[i].ItemsToShow;
24  temp.TitleName = list[i].TitleName;
25  temp.ShowTitle = list[i].ShowTitle;
26 
27  current.Add(temp);
28  }
29 
30  }
31 
32  private void Configure_RunInfo_Load(object sender, EventArgs e)
33  {
34  PopulateList();
35  }
36 
37  private void PopulateList()
38  {
39  lstControls.Items.Clear();
40  lstItems.Items.Clear();
41 
42  for (int i = 0; i < current.Count; ++i)
43  {
44  lstControls.Items.Add(current[i].TitleName);
45  }
46  }
47 
48  private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
49  {
50  lstItems.Items.Clear();
51 
52  if (lstControls.SelectedIndex != -1)
53  {
54  lstItems.Items.AddRange((String[])current[lstControls.SelectedIndex].ItemsToShow.ToArray(typeof(String)));
55  }
56  }
57 
58  private void btnAdd_Click(object sender, EventArgs e)
59  {
60  SECI_Controls.Run_Information.Edit_RunInfo add = new SECI_Controls.Run_Information.Edit_RunInfo();
61 
62  if (add.ShowDialog() == DialogResult.OK)
63  {
64  SECI_Controls.Run_Information.Scaling_RunInfo temp = new SECI_Controls.Run_Information.Scaling_RunInfo();
65  temp.ChangeItemsToShow(add.varsToShow, add.showTitle, add.name);
66 
67  current.Add(temp);
68 
69  PopulateList();
70  }
71 
72  }
73 
74  private void btnEdit_Click(object sender, EventArgs e)
75  {
76  if (lstControls.SelectedIndex != -1)
77  {
78  SECI_Controls.Run_Information.Edit_RunInfo edit = new SECI_Controls.Run_Information.Edit_RunInfo();
79  edit.varsToShow = (String[])current[lstControls.SelectedIndex].ItemsToShow.ToArray(typeof(String));
80  edit.name = current[lstControls.SelectedIndex].TitleName;
81  edit.showTitle = current[lstControls.SelectedIndex].ShowTitle;
82 
83  if (edit.ShowDialog() == DialogResult.OK)
84  {
85  current[lstControls.SelectedIndex].ChangeItemsToShow(edit.varsToShow,edit.showTitle, edit.name);
86 
87  PopulateList();
88  }
89  }
90  }
91 
92  private void btnDelete_Click(object sender, EventArgs e)
93  {
94  if (lstControls.SelectedIndex != -1)
95  {
96  current.RemoveAt(lstControls.SelectedIndex);
97  PopulateList();
98  }
99  }
100 
101  private void btnOK_Click(object sender, EventArgs e)
102  {
103  DialogResult = DialogResult.OK;
104  Close();
105  }
106  }
107 }
Configure_RunInfo(Seci.SerialisableList< SECI_Controls.Run_Information.Scaling_RunInfo > list)