2 using System.Collections;
3 using System.Collections.Generic;
4 using System.ComponentModel;
8 using System.Windows.Forms;
10 namespace Sample_Environment_Control_Interface.Dialogs.Layout.Groups
16 private List<String> _fullVINames =
new List<String>();
21 InitializeComponent();
26 InitializeComponent();
34 _fullVINames.AddRange(Seci.SeciInterface.LV_GetListOfVIs());
35 _fullVINames.Add(Seci.SeciInterface.BeamLogger_GetLocation());
38 _fullProgNames = Seci.SeciInterface.Exe_GetListOfAllExes();
39 _fullProgNames.Add(
"Open Genie");
45 txtName.Text = myGroup.GroupName;
48 for (
int i = 0; i < myGroup.VIMembers.GetLength(0); ++i)
50 String vi = myGroup.VIMembers[i].Substring(myGroup.VIMembers[i].LastIndexOf(
"\\") + 1);
51 lstVIMembers.Items.Add(vi);
52 lstVIs.Items.Remove(vi);
55 for (
int i = 0; i < myGroup.ProgMembers.GetLength(0); ++i)
57 String prog = myGroup.ProgMembers[i].Substring(myGroup.ProgMembers[i].LastIndexOf(
"\\") + 1);
58 lstProgMembers.Items.Add(prog);
59 lstProgs.Items.Remove(prog);
67 for (
int i = 0; i < _fullVINames.Count; ++i)
69 lstVIs.Items.Add(_fullVINames[i].Substring(_fullVINames[i].LastIndexOf(
"\\") + 1));
72 for (
int i = 0; i < _fullProgNames.Count; ++i)
74 lstProgs.Items.Add(_fullProgNames[i].Substring(_fullProgNames[i].LastIndexOf(
"\\") + 1));
80 if (lstVIs.SelectedIndex != -1)
82 lstVIMembers.Items.Add(lstVIs.SelectedItem);
83 lstVIs.Items.RemoveAt(lstVIs.SelectedIndex);
89 if (lstProgs.SelectedIndex != -1)
91 lstProgMembers.Items.Add(lstProgs.SelectedItem);
92 lstProgs.Items.RemoveAt(lstProgs.SelectedIndex);
98 if (lstVIMembers.SelectedIndex != -1)
100 lstVIs.Items.Add(lstVIMembers.SelectedItem);
101 lstVIMembers.Items.RemoveAt(lstVIMembers.SelectedIndex);
107 if (lstProgMembers.SelectedIndex != -1)
109 lstProgs.Items.Add(lstProgMembers.SelectedItem);
110 lstProgMembers.Items.RemoveAt(lstProgMembers.SelectedIndex);
117 if (txtName.Text.Trim() !=
"")
122 Group newgrp =
new Group(txtName.Text.Trim());
124 for (
int i = 0; i < lstVIMembers.Items.Count; ++i)
126 String fullname = GetVIFullname(lstVIMembers.Items[i].ToString());
128 if (fullname != null)
130 newgrp.AddVIMember(fullname);
134 for (
int i = 0; i < lstProgMembers.Items.Count; ++i)
136 String fullname = GetProgFullname(lstProgMembers.Items[i].ToString());
138 if (fullname != null)
140 newgrp.AddProgMember(fullname);
146 DialogResult = DialogResult.OK;
151 MessageBox.Show(
"Page name is not unique! Please change it to something else.",
"Name Not Unique!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
156 MessageBox.Show(
"Please enter a page name.",
"No Name Given!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
162 for (
int i = 0; i < _fullVINames.Count; ++i)
164 if (_fullVINames[i].EndsWith(shortname))
166 return _fullVINames[i];
175 for (
int i = 0; i < _fullProgNames.Count; ++i)
177 if (_fullProgNames[i].EndsWith(shortname))
179 return _fullProgNames[i];
void btnOK_Click(object sender, EventArgs e)
Boolean GroupExists(String name)
List< String > _fullProgNames
void btnRemoveProg_Click(object sender, EventArgs e)
String GetProgFullname(String shortname)
static GUILayout CurrentLayout
String GetVIFullname(String shortname)
void btnRemoveVI_Click(object sender, EventArgs e)
void btnAddProg_Click(object sender, EventArgs e)
void AddEditGroup_Load(object sender, EventArgs e)
void btnAddVI_Click(object sender, EventArgs e)