Example #1
0
        public void RegisterOneChildInNameScope()
        {
            WiringContext.EnableNameScope <DummyClass>();

            var actualInstance = XamlLoader.Load(Dummy.ChildInNameScope);
            var childInScope   = ((DummyObject)actualInstance).Find("MyObject");

            Assert.IsInstanceOfType(childInScope, typeof(ChildClass));
        }
        public static WiringContext GetContext(ITypeFactory factory)
        {
            if (context == null)
            {
                var builder = new CleanWiringContextBuilder(factory);
                context = builder.Build();
            }

            return context;
        }
Example #3
0
        public StateCommuter(StackingLinkedList<Level> stack, WiringContext wiringContext, ITopDownMemberValueContext topDownMemberValueContext)
        {
            Guard.ThrowIfNull(stack, nameof(stack));
            Guard.ThrowIfNull(wiringContext, nameof(wiringContext));
            Guard.ThrowIfNull(topDownMemberValueContext, nameof(topDownMemberValueContext));

            this.stack = stack;
            this.topDownMemberValueContext = topDownMemberValueContext;
            ValuePipeline = new ValuePipeline(wiringContext);
        }
Example #4
0
        public void RegisterOneChildInNameScope()
        {
            WiringContext.EnableNameScope <DummyClass>();

            sut.PumpNodes(source.ChildInNameScope);
            var actual       = sut.Result;
            var childInScope = ((DummyObject)actual).Find("MyObject");

            Assert.IsInstanceOfType(childInScope, typeof(ChildClass));
        }
Example #5
0
        public PerspexWiringContext(ITypeFactory typeFactory)
        {
            var featureProvider = new TypeFeatureProvider(GetContentPropertyProvider(), GetConverterProvider());

            var xamlNamespaceRegistry = CreateXamlNamespaceRegistry();
            var perspexPropertyBinder = new PerspexPropertyBinder(featureProvider.ConverterProvider);
            var xamlTypeRepository    = new PerspexTypeRepository(xamlNamespaceRegistry, typeFactory, featureProvider, perspexPropertyBinder);
            var typeContext           = new TypeContext(xamlTypeRepository, xamlNamespaceRegistry, typeFactory);

            _context = new WiringContext(typeContext, featureProvider);
        }
        public SuperObjectAssembler(WiringContext wiringContext, ITopDownMemberValueContext topDownMemberValueContext, ObjectAssemblerSettings settings = null)
            : this(new StackingLinkedList<Level>(), wiringContext, topDownMemberValueContext)
        {
            Guard.ThrowIfNull(wiringContext, nameof(wiringContext));
            Guard.ThrowIfNull(topDownMemberValueContext, nameof(topDownMemberValueContext));

            this.topDownMemberValueContext = topDownMemberValueContext;
            StateCommuter.RaiseLevel();
            rootInstance = settings?.RootInstance;
            rootInstanceType = settings?.RootInstance?.GetType();
        }
Example #7
0
        public void RegisterChildInDeeperNameScope()
        {
            WiringContext.EnableNameScope <Window>();

            sut.PumpNodes(source.ChildInDeeperNameScope);
            var actual     = sut.Result;
            var textBlock1 = ((Window)actual).Find("MyTextBlock");
            var textBlock2 = ((Window)actual).Find("MyOtherTextBlock");

            Assert.IsInstanceOfType(textBlock1, typeof(TextBlock));
            Assert.IsInstanceOfType(textBlock2, typeof(TextBlock));
        }
 public ObjectAssembler(WiringContext wiringContext, ObjectAssemblerSettings settings = null)
 {
     this.wiringContext = wiringContext;
     typeConverterProvider = wiringContext.ConverterProvider;
     xamlTypeRepository = wiringContext.TypeContext;
     typeRepository = wiringContext.TypeContext;
     typeOperations = new TypeOperations(typeRepository.TypeFactory);
     startMemberWriter = new StartMemberWriter(this);
     getObjectWriter = new GetObjectWriter(this);
     startObjectWriter = new StartObjectWriter(this, settings?.RootInstance);
     valueWriter = new ValueWriter(this);
 }
Example #9
0
 public void TestInitialize()
 {
     WiringContext.ClearNamesCopes();
 }
Example #10
0
 public SuperProtoParser(WiringContext wiringContext)
 {
     this.wiringContext = wiringContext;
     nodeBuilder = new ProtoNodeBuilder(wiringContext.TypeContext);
 }
 public WpfTemplateContent(IEnumerable<XamlNode> nodes, WiringContext context)
 {
     this.Nodes = nodes;
     this.Context = context;
 }
 public SuperObjectAssembler(StackingLinkedList<Level> state, WiringContext wiringContext, ITopDownMemberValueContext topDownMemberValueContext)
 {
     WiringContext = wiringContext;
     StateCommuter = new StateCommuter(state, wiringContext, topDownMemberValueContext);
 }
 public ObjectAssemblerFactory(WiringContext wiringContext)
 {
     this.wiringContext = wiringContext;
 }
Example #14
0
 public ObjectAssembler(WiringContext wiringContext, ObjectAssemblerSettings objectAssemblerSettings = null)
 {
     objectAssembler = new TemplateHostingObjectAssembler(new SuperObjectAssembler(wiringContext, new NewAssembler.TopDownMemberValueContext(), objectAssemblerSettings));
     objectAssembler.AddDeferredLoader<DataTemplate>(template => template.AlternateTemplateContent, new DeferredLoader());
 }
 public XamlNodesPullParser(WiringContext wiringContext)
 {
     this.wiringContext = wiringContext;
 }
Example #16
0
 public TemplateContent(IEnumerable<XamlNode> nodes, WiringContext wiringContext)
 {
     this.nodes = nodes;
     this.wiringContext = wiringContext;
 }
 public MarkupExtensionNodeToXamlNodesConverter(WiringContext wiringContext)
 {
     this.wiringContext = wiringContext;
 }
Example #18
0
 public TemplateContent(IEnumerable<XamlNode> nodes, WiringContext context)
 {
     Nodes = nodes;
     Context = context;
 }
 public DummyAssemblerFactory(WiringContext wiringContext)
 {
     this.wiringContext = wiringContext;
 }
Example #20
0
 public ValuePipeline(WiringContext wiringContext)
 {
     WiringContext = wiringContext;
 }
 public WpfObjectAssembler(WiringContext wiringContext)
 {
     objectAssembler = new TemplateHostingObjectAssembler(new ObjectAssembler(wiringContext));
     objectAssembler.DeferredAssembler<DataTemplate>(template => template.AlternateTemplateContent, new DeferredObjectAssembler());
 }
 public object Load(IEnumerable<XamlNode> nodes, WiringContext wiringContext)
 {
     return new TemplateContent(nodes, wiringContext);
 }
Example #23
0
 public NodeInflater(IEnumerable<Type> inflatables, WiringContext wiringContext)
 {
     this.inflatables = inflatables;
     this.wiringContext = wiringContext;
     nodeBuilder = new XamlNodeBuilder(wiringContext.TypeContext);
 }