public void OperandUpdated() { IgnoreSet = true; for (int i = 0; i < Flags.Length; i++) { var flag = Flags[i]; var ui = FlagChecks[i]; var property = Operand.GetType().GetProperty(flag.Property); bool value = Convert.ToBoolean(property.GetValue(Operand, new object[0])); ui.Checked = value; } IgnoreSet = false; }
public static void SetOperandProperty(VMPrimitiveOperand op, string propertyN, object value) { var property = op.GetType().GetProperty(propertyN); object finalType; try { finalType = Enum.ToObject(property.PropertyType, value); } catch (Exception) { finalType = Convert.ChangeType(value, property.PropertyType); } property.SetValue(op, finalType); }
public static void SetOperandProperty(VMPrimitiveOperand op, string propertyN, object value) { var property = op.GetType().GetProperty(propertyN); object finalType; try { finalType = Enum.ToObject(property.PropertyType, value); } catch (Exception) { if (value.GetType() != property.PropertyType && property.PropertyType == typeof(UInt32)) { finalType = unchecked((uint)Convert.ToInt32(value)); } else finalType = Convert.ChangeType(value, property.PropertyType); } property.SetValue(op, finalType, new object[0]); }
public static void SetOperandProperty(VMPrimitiveOperand op, string propertyN, object value) { var property = op.GetType().GetProperty(propertyN); object finalType; try { finalType = Enum.ToObject(property.PropertyType, value); } catch (Exception) { if (value.GetType() != property.PropertyType && property.PropertyType == typeof(UInt32)) { finalType = unchecked ((uint)Convert.ToInt32(value)); } else { finalType = Convert.ChangeType(value, property.PropertyType); } } property.SetValue(op, finalType); }
public static object GetOperandProperty(VMPrimitiveOperand op, string propertyN) { var property = op.GetType().GetProperty(propertyN); return(property.GetValue(op)); }
public static object GetOperandProperty(VMPrimitiveOperand op, string propertyN) { var property = op.GetType().GetProperty(propertyN); return(property.GetValue(op, new object[0])); }