public void Inject(object obj, object[] args, IRuntimeImportContext ctx)
        {
            var tree = new ActivatorTree(null, ctx.StaticContext);

            tree.Key = new ActivatorKey(obj.GetType(), null);
            var injectors = GetClassInjector(tree);

            injectors.Item1(ctx, args, obj);
            injectors.Item2(ctx, args, obj);
        }
Esempio n. 2
0
        public T GetTarget <T>()
        {
            IRuntimeImportContext ctx = this;

            while (ctx != null)
            {
                if (ctx.Target is T r)
                {
                    return(r);
                }
                ctx = ctx.Parent;
            }

            return(default(T));
        }
Esempio n. 3
0
 public void Initialize(IRuntimeImportContext ctx, object[] args)
 {
 }
Esempio n. 4
0
 public void Initialize(IRuntimeImportContext ctx, object[] args)
 {
     Mvvm = ctx.GetTarget <IMvvmService>();
 }
 public object Locate(IRuntimeImportContext ctx, object[] args = null)
 => GetLocator(new ActivatorTree(null, ctx.StaticContext))(ctx, args);
Esempio n. 6
0
        public void Initialize(IRuntimeImportContext ctx, object[] args)
        {
            var target = ctx.GetTarget <TClass>();

            _target = new WeakReference <TClass>(target);
        }
Esempio n. 7
0
 protected RuntimeImportContext(IRuntimeImportContext parent, IImportContext ctx)
 {
     Parent        = parent;
     StaticContext = ctx;
     Target        = parent?.Target;
 }