コード例 #1
0
ファイル: RulerView.cs プロジェクト: yousafgill/Timeliner
        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
ファイル: BaseClasses.cs プロジェクト: yousafgill/Timeliner
 public TLViewBase(TLModelBase model, TLViewBase parent)
 {
     FGroup.Transforms = new SvgTransformCollection();
     Parent            = parent;
     Model             = model;
     History           = Model.Mapper.Map <ICommandHistory>();
     FGroup.ID         = GetGroupID();
 }