SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
Configure_BlockViewer.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_BlockViewer : Form
12  {
13  public Seci.SerialisableList<SECI_Controls.Run_Information.Scaling_BlockViewer> current = new Seci.SerialisableList<SECI_Controls.Run_Information.Scaling_BlockViewer>();
14 
16  {
17  InitializeComponent();
18  }
19 
20  private void Configure_RunInfo_Load(object sender, EventArgs e)
21  {
22  for (int i = 0; i < SECI_GUI.CurrentLayout.BlockViewers.Count; ++i)
23  {
24  SECI_Controls.Run_Information.Scaling_BlockViewer temp = new SECI_Controls.Run_Information.Scaling_BlockViewer();
25  temp.Location = SECI_GUI.CurrentLayout.BlockViewers[i].Location;
26  temp.ItemsToShow = SECI_GUI.CurrentLayout.BlockViewers[i].ItemsToShow;
27  temp.TitleName = SECI_GUI.CurrentLayout.BlockViewers[i].TitleName;
28  temp.ShowTitle = SECI_GUI.CurrentLayout.BlockViewers[i].ShowTitle;
29 
30  current.Add(temp);
31  }
32 
33  PopulateList();
34  }
35 
36  private void PopulateList()
37  {
38  lstControls.Items.Clear();
39  lstItems.Items.Clear();
40 
41  for (int i = 0; i < current.Count; ++i)
42  {
43  lstControls.Items.Add(current[i].TitleName);
44  }
45  }
46 
47  private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
48  {
49  lstItems.Items.Clear();
50 
51  if (lstControls.SelectedIndex != -1)
52  {
53  lstItems.Items.AddRange(current[lstControls.SelectedIndex].ItemsToShow.ToArray());
54  }
55  }
56 
57  private void btnAdd_Click(object sender, EventArgs e)
58  {
59  SECI_Controls.Run_Information.Edit_BlockViewer add = new SECI_Controls.Run_Information.Edit_BlockViewer();
60 
61  if (add.ShowDialog() == DialogResult.OK)
62  {
63  SECI_Controls.Run_Information.Scaling_BlockViewer temp = new SECI_Controls.Run_Information.Scaling_BlockViewer();
64  temp.ChangeItemsToShow(add.blocksToShow, add.showTitle, add.name);
65 
66  current.Add(temp);
67 
68  PopulateList();
69  }
70 
71  }
72 
73  private void btnEdit_Click(object sender, EventArgs e)
74  {
75  if (lstControls.SelectedIndex != -1)
76  {
77  SECI_Controls.Run_Information.Edit_BlockViewer edit = new SECI_Controls.Run_Information.Edit_BlockViewer();
78  edit.blocksToShow = current[lstControls.SelectedIndex].ItemsToShow;
79  edit.name = current[lstControls.SelectedIndex].TitleName;
80  edit.showTitle = current[lstControls.SelectedIndex].ShowTitle;
81 
82  if (edit.ShowDialog() == DialogResult.OK)
83  {
84  current[lstControls.SelectedIndex].ChangeItemsToShow(edit.blocksToShow, edit.showTitle, edit.name);
85 
86  PopulateList();
87  }
88  }
89  }
90 
91  private void btnDelete_Click(object sender, EventArgs e)
92  {
93  if (lstControls.SelectedIndex != -1)
94  {
95  current.RemoveAt(lstControls.SelectedIndex);
96  PopulateList();
97  }
98  }
99 
100  private void btnOK_Click(object sender, EventArgs e)
101  {
102  DialogResult = DialogResult.OK;
103  Close();
104  }
105  }
106 }