예제 #1
0
        void SendValue(ref CompoundCommand cmds, TLModelBase model, string name, object newValue)
        {
            //from editor get editableproperty
            var property = model.GetType().GetProperty(name);

            if (property.PropertyType.GenericTypeArguments[0] == typeof(string))
            {
                var prop = (EditableProperty <string>)property.GetValue(model);
                cmds.Append(Command.Set(prop, newValue));
            }
            else if (property.PropertyType.GenericTypeArguments[0] == typeof(float))
            {
                var prop = (EditableProperty <float>)property.GetValue(model);
                cmds.Append(Command.Set(prop, newValue));
            }
            else if (property.PropertyType.GenericTypeArguments[0] == typeof(int))
            {
                var prop = (EditableProperty <int>)property.GetValue(model);
                cmds.Append(Command.Set(prop, (int)((float)newValue)));
            }
            else if (property.PropertyType.GenericTypeArguments[0] == typeof(bool))
            {
                var prop = (EditableProperty <bool>)property.GetValue(model);
                cmds.Append(Command.Set(prop, (float)newValue >= 0.5));
            }
        }
예제 #2
0
 public TLViewBase(TLModelBase model, TLViewBase parent)
 {
     FGroup.Transforms = new SvgTransformCollection();
     Parent            = parent;
     Model             = model;
     History           = Model.Mapper.Map <ICommandHistory>();
     FGroup.ID         = GetGroupID();
 }