VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
override void AVR.UI.Link.AVRUI_Link_Toggle.updateValue ( )
inlinevirtual

This method is executed when the runtime user changes the value of the UI element. This method should change the field on the actual target respectively.

Implements AVR.UI.Link.AVRUI_Link.

Definition at line 39 of file AVRUI_Link_Toggle.cs.

40  {
41  bool val = input.isOn;
42 
43  // Update it to the target, if possible.
44  try {
45  switch (memberType)
46  {
47  case MemberType.FIELD:
48  {
49  target.GetType().GetField(field).SetValue(target,
50  System.Convert.ChangeType(val, target.GetType().GetField(field).FieldType)
51  );
52  break;
53  }
54  case MemberType.PROPERTY:
55  {
56  target.GetType().GetProperty(field).SetValue(target,
57  System.Convert.ChangeType(val, target.GetType().GetProperty(field).PropertyType)
58  );
59  break;
60  }
61  }
62  }
63  catch(System.Exception) {
64  AVR_DevConsole.cwarn("Could not update the given target value to "+val, this);
65  }
66  }