Exemple #1
0
 public PolyfacingValueOfDecoration(IValueOf <T> decorated, Polyface rootFace = null)
     : base(decorated)
 {
     //if no polyface is set we create new one
     this.RootFace = (rootFace == null) ? Polyface.New() : rootFace;
     //register the face
     this.RootFace.Is(typeof(Tface), this);
 }
Exemple #2
0
        /// <summary>
        /// a new Polyface is created and injected.
        /// </summary>
        /// <param name="face"></param>
        /// <returns></returns>
        public static Polyface NewRoot(this IPolyfacing face)
        {
            Condition.Requires(face).IsNotNull();
            var rv = Polyface.New();

            rv.Is(face.GetType(), face);

            return(rv);
        }
Exemple #3
0
        /// <summary>
        /// Sets the behaviour for the provided face name
        /// </summary>
        /// <param name="type"></param>
        /// <param name="behaviour"></param>
        /// <returns></returns>
        public static Polyface Is(this IPolyfacing face, string faceName, object behaviour)
        {
            Condition.Requires(face).IsNotNull();
            Polyface rv = face.RootFace;

            if (rv == null)
            {
                rv            = Polyface.New();
                face.RootFace = rv;
            }
            return(rv.Is(faceName, behaviour));
        }