Ejemplo n.º 1
0
 /// Caches early-riser Views.
 ///
 /// If a View is on stage at startup, it's possible for that
 /// View to be Awake before this Context has finished initing.
 /// `cacheView()` maintains a list of such 'early-risers'
 /// until the Context is ready to mediate them.
 virtual protected void cacheView(MonoBehaviour view)
 {
     if (viewCache.constraint.Equals(BindingConstraintType.ONE))
     {
         viewCache.constraint = BindingConstraintType.MANY;
     }
     viewCache.Add(view);
 }
 virtual public IBinding To(object o)
 {
     _value.Add(o);
     if (resolver != null)
     {
         resolver(this);
     }
     return(this);
 }
Ejemplo n.º 3
0
 /// Promise this Binding to any instance of Type type
 public IInjectionBinding SupplyTo(Type type)
 {
     supplyList.Add(type);
     if (resolver != null)
     {
         resolver(this);
     }
     return(this);
 }
        virtual public IBinding ToName(object o)
        {
            object toName = (o == null) ? BindingConst.NULLOID : o;

            _name.Add(toName);
            if (resolver != null)
            {
                resolver(this);
            }
            return(this);
        }
Ejemplo n.º 5
0
        IMediationBinding IMediationBinding.ToAbstraction <T> ()
        {
            Type abstractionType = typeof(T);

            if (key != null)
            {
                Type keyType = key as Type;
                if (abstractionType.IsAssignableFrom(keyType) == false)
                {
                    throw new MediationException("The View " + key.ToString() + " has been bound to the abstraction " + typeof(T).ToString() + " which the View neither extends nor implements. ", MediationExceptionType.VIEW_NOT_ASSIGNABLE);
                }
            }
            _abstraction.Add(abstractionType);
            return(this);
        }
 virtual public IBinding Key(object o)
 {
     _key.Add(o);
     return(this);
 }
Ejemplo n.º 7
0
 public void TestType()
 {
     semibinding.Add(typeof(TestSemiBinding));
     Assert.AreEqual(typeof(TestSemiBinding), semibinding.value);
 }
Ejemplo n.º 8
0
 public virtual IBinding Bind(object o)
 {
     _key.Add(o);
     return(this);
 }