Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
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)
            {
                finalType = Convert.ChangeType(value, property.PropertyType);
            }

            property.SetValue(op, finalType);
        }
Ejemplo n.º 3
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, new object[0]);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        public static object GetOperandProperty(VMPrimitiveOperand op, string propertyN)
        {
            var property = op.GetType().GetProperty(propertyN);

            return(property.GetValue(op));
        }
Ejemplo n.º 6
0
 public static object GetOperandProperty(VMPrimitiveOperand op, string propertyN)
 {
     var property = op.GetType().GetProperty(propertyN);
     return(property.GetValue(op, new object[0]));
 }