2 using System.Collections;
3 using System.Collections.Generic;
6 namespace Seci.LabView.Controls
22 public String Name {
get {
return _name; } }
30 public abstract String GetNameAndType();
38 public virtual String[]
GetValue(ref strongnameLabview.VirtualInstrument vi)
42 if (_clusterIndices == null)
44 String temp = Convert.ToString(vi.GetControlValue(_name));
45 String[] temp2 = { temp };
50 String temp = Convert.ToString(GetValueFromCluster(vi)[_clusterIndices[_clusterIndices.Count - 1]]);
51 String[] temp2 = { temp };
58 public abstract String GetControlType();
66 public virtual void SetValue(ref strongnameLabview.VirtualInstrument vi, Object value)
68 if (_clusterIndices == null)
70 vi.SetControlValue(_name, value);
74 SetValueInCluster(ref vi, value);
87 String[] splitName = _name.Split(
':');
89 Object[] vals = (Object[])vi.GetControlValue(splitName[0]);
92 for (
int i = 0; i < _clusterIndices.Count - 1; ++i)
94 vals = (Object[])vals[_clusterIndices[i]];
115 String[] splitName = _name.Split(
':');
117 Object[] vals = (Object[])vi.GetControlValue(splitName[0]);
120 if (_clusterIndices.Count == 1)
122 vals[_clusterIndices[0]] = value;
124 else if (_clusterIndices.Count == 2)
126 ((Object[])vals[_clusterIndices[0]])[_clusterIndices[1]] = value;
128 else if (_clusterIndices.Count == 3)
130 ((Object[])(((Object[])vals[_clusterIndices[0]])[_clusterIndices[1]]))[_clusterIndices[2]] = value;
132 else if (_clusterIndices.Count == 4)
134 ((Object[])(((Object[])(((Object[])vals[_clusterIndices[0]])[_clusterIndices[1]]))[_clusterIndices[2]]))[_clusterIndices[3]] = value;
140 throw new ArgumentException(
"Looking for a nested cluster >4 deep.");
148 vi.SetControlValue(splitName[0], vals);
void SetValueInCluster(ref strongnameLabview.VirtualInstrument vi, Object value)
Method for setting a value in a cluster. Individual values in the cluster cannot be set...
SerialisableList< int > _clusterIndices
If the control is in a cluster then the index is stored in a SerialisableList. A SerialisableList is ...
Object[] GetValueFromCluster(strongnameLabview.VirtualInstrument vi)
Method for returning a cluster value from the front panel. The cluster contains the required control ...
String _name
The name of the control.
virtual String[] GetValue(ref strongnameLabview.VirtualInstrument vi)
Method for returning a value from the actual front panel control which this class corresponds to...
virtual void SetValue(ref strongnameLabview.VirtualInstrument vi, Object value)
Virtual method for setting a value on the actual front panel control which this class corresponds to...
This class is the abstract base class of the objects used to store the VI control information...