SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
Group.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4 using System.Text;
5 
6 namespace Sample_Environment_Control_Interface
7 {
16  public class Group
17  {
18  private String _name;
19  private List<String> _viMembers = new List<String>();
20  private List<String> _progMembers = new List<String>();
21 
22  public String GroupName { get { return _name; } set { _name = value; } }
23  public String[] VIMembers
24  {
25  get { return _viMembers.ToArray(); }
26  set { _viMembers.Clear(); _viMembers.AddRange(value); }
27  }
28  public String[] ProgMembers
29  {
30  get { return _progMembers.ToArray(); }
31  set { _progMembers.Clear(); _progMembers.AddRange(value); }
32  }
33 
37  public Group()
38  {
39 
40  }
41 
46  public Group(String groupName)
47  {
48  _name = groupName;
49  }
50 
56  public void AddVIMember(String viName)
57  {
58  if (!_viMembers.Contains(viName))
59  {
60  _viMembers.Add(viName);
61  }
62  }
63 
69  public void RemoveVIMember(String viName)
70  {
71  _viMembers.Remove(viName);
72  }
73 
80  public Boolean ContainsProg(String filePath)
81  {
82  return _progMembers.Contains(filePath);
83  }
84 
90  public void AddProgMember(String filePath)
91  {
92  if (!_progMembers.Contains(filePath))
93  {
94  _progMembers.Add(filePath);
95  }
96  }
97 
103  public void RemoveProgMember(String filePath)
104  {
105  _progMembers.Remove(filePath);
106  }
107 
112  public void ClearGroup()
113  {
114  _viMembers.Clear();
115  _progMembers.Clear();
116  }
117 
121  public void ShowGroup()
122  {
123  //VIs
124  for (int i = 0; i < _viMembers.Count; ++i)
125  {
126  try
127  {
128  if (Seci.SeciInterface.LV_DoesVIExist(_viMembers[i]))
129  {
130  Seci.SeciInterface.LV_ShowVI(_viMembers[i]);
131  }
132  }
133  catch (Exception err)
134  {
135  //Log and carry on.
136  Seci.SeciInterface.Error_LogError("ShowGroup", err);
137  }
138  }
139 
140  //Progs
141  for (int i = 0; i < _progMembers.Count; ++i)
142  {
143  try
144  {
145  if (_progMembers[i] == "Open Genie")
146  {
147  Seci.SeciInterface.OpenGenie_Show();
148  }
149 
150  if (Seci.SeciInterface.Exe_DoesExeExist(_progMembers[i]))
151  {
152  Seci.SeciInterface.Exe_Show((String)_progMembers[i]);
153  }
154  }
155  catch (Exception err)
156  {
157  //Log and carry on.
158  Seci.SeciInterface.Error_LogError("ShowGroup", err);
159  }
160  }
161  }
162 
166  public void HideGroup()
167  {
168  //VIs
169  for (int i = 0; i < _viMembers.Count; ++i)
170  {
171  //Beam logger is special case as it is not in temp
172  if (_viMembers[i].ToString() == Seci.SeciInterface.BeamLogger_GetLocation())
173  {
174  Seci.SeciInterface.BeamLogger_HideVI();
175  continue;
176  }
177 
178  //hide it
179  if (Seci.SeciInterface.LV_DoesVIExist(_viMembers[i]))
180  {
181  Seci.SeciInterface.LV_HideVI(_viMembers[i]);
182  }
183  }
184 
185  //Progs
186  for (int i = 0; i < _progMembers.Count; ++i)
187  {
188  if (_progMembers[i] == "Open Genie")
189  {
190  Seci.SeciInterface.OpenGenie_Hide();
191  }
192 
193  if (Seci.SeciInterface.Exe_DoesExeExist(_progMembers[i]))
194  {
195  Seci.SeciInterface.Exe_Hide(_progMembers[i]);
196  }
197  }
198  }
199 
200  public void RemoveInvalidMembers()
201  {
202  //VIs
203  for (int i = _viMembers.Count - 1; i >= 0; --i)
204  {
205  if (!Seci.SeciInterface.LV_DoesVIExist(_viMembers[i]))
206  {
207  _viMembers.Remove(_viMembers[i]);
208  }
209  }
210 
211  //Progs
212  for (int i = _progMembers.Count - 1; i >= 0; --i)
213  {
214  if (!Seci.SeciInterface.Exe_DoesExeExist(_progMembers[i]))
215  {
216  _progMembers.Remove(_progMembers[i]);
217  }
218  }
219  }
220 
221  }
222 }
List< String > _progMembers
Stores the filepaths for the executables.
Definition: Group.cs:20
void AddProgMember(String filePath)
Definition: Group.cs:90
void RemoveProgMember(String filePath)
Definition: Group.cs:103
Boolean ContainsProg(String filePath)
Definition: Group.cs:80
List< String > _viMembers
Stores the filepaths for the VIs.
Definition: Group.cs:19
void RemoveVIMember(String viName)
Definition: Group.cs:69
String _name
The page name - must be unique.
Definition: Group.cs:18