Esempio 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;
        }
Esempio 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);
        }
Esempio 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]);
        }
Esempio 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);
        }
Esempio n. 5
0
        public static object GetOperandProperty(VMPrimitiveOperand op, string propertyN)
        {
            var property = op.GetType().GetProperty(propertyN);

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