Esempio n. 1
0
    public IInjectionBinding BindSignalCrossContext <S>()
    {
        IInjectionBinding binding = injectionBinder.GetBinding <S>() ?? injectionBinder.Bind <S>();

        binding.CrossContext();

        object instance = injectionBinder.GetInstance <S>();

        binding.ToValue(instance);

        return(binding);
    }
Esempio n. 2
0
    public static IInjectionBinding ReBind <T>(this ICrossContextInjectionBinder _this)
    {
        IInjectionBinding binding = _this.GetBinding <T>();

        if (binding != null)
        {
            _this.CrossContextBinder.Unbind <T>();
        }

        return(_this.Bind <T>());
    }
Esempio n. 3
0
        public static TAbstract BindCrossContextSingletonSafely <TAbstract, TConcrete>(this ICrossContextInjectionBinder injectionBinder)
        {
            IInjectionBinding binding = injectionBinder.GetBinding <TAbstract>();

            if (binding == null)
            {
                injectionBinder.Bind <TAbstract>().To <TConcrete>().ToSingleton().CrossContext();
            }

            TAbstract instance = injectionBinder.GetInstance <TAbstract>();

            return(instance);
        }
Esempio n. 4
0
        public static TDirect BindCrossContextSingletonSafely <TDirect>(this ICrossContextInjectionBinder injectionBinder, object toObject)
        {
            IInjectionBinding binding = injectionBinder.GetBinding <TDirect>();

            if (binding == null)
            {
                injectionBinder.Bind <TDirect>().To(toObject).ToSingleton().CrossContext();
            }

            TDirect instance = injectionBinder.GetInstance <TDirect>();

            return(instance);
        }
Esempio n. 5
0
        protected override void instantiateCoreComponents()
        {
            base.instantiateCoreComponents();

            IInjectionBinding dispatcherBinding = injectionBinder.GetBinding <IEventDispatcher> (ContextKeys.CONTEXT_DISPATCHER);

            if (dispatcherBinding != null)
            {
                IEventDispatcher dispatcher = injectionBinder.GetInstance <IEventDispatcher> (ContextKeys.CONTEXT_DISPATCHER) as IEventDispatcher;
                if (dispatcher != null)
                {
                    crossContextDispatcher = injectionBinder.GetInstance <IEventDispatcher> (ContextKeys.CROSS_CONTEXT_DISPATCHER) as IEventDispatcher;
                    (crossContextDispatcher as ITriggerProvider).AddTriggerable(dispatcher as ITriggerable);
                    (dispatcher as ITriggerProvider).AddTriggerable(crossContextBridge as ITriggerable);
                }
            }
        }
Esempio n. 6
0
 public static void QuickBind <T>(T value) where T : class
 {
     binder.Unbind <T>();
     binder.Bind <T>().ToValue(value);
     binder.GetBinding <T>().ToInject(false);
 }