Esempio n. 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;
        }
Esempio n. 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);
        }
Esempio n. 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));
        }
Esempio n. 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();
        }
Esempio n. 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));
        }
Esempio n. 8
0
 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);
 }
Esempio n. 9
0
 public void TestInitialize()
 {
     WiringContext.ClearNamesCopes();
 }
Esempio n. 10
0
 public SuperProtoParser(WiringContext wiringContext)
 {
     this.wiringContext = wiringContext;
     nodeBuilder = new ProtoNodeBuilder(wiringContext.TypeContext);
 }
Esempio n. 11
0
 public WpfTemplateContent(IEnumerable<XamlNode> nodes, WiringContext context)
 {
     this.Nodes = nodes;
     this.Context = context;
 }
Esempio n. 12
0
 public SuperObjectAssembler(StackingLinkedList<Level> state, WiringContext wiringContext, ITopDownMemberValueContext topDownMemberValueContext)
 {
     WiringContext = wiringContext;
     StateCommuter = new StateCommuter(state, wiringContext, topDownMemberValueContext);
 }
 public ObjectAssemblerFactory(WiringContext wiringContext)
 {
     this.wiringContext = wiringContext;
 }
Esempio n. 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());
 }
Esempio n. 15
0
 public XamlNodesPullParser(WiringContext wiringContext)
 {
     this.wiringContext = wiringContext;
 }
Esempio n. 16
0
 public TemplateContent(IEnumerable<XamlNode> nodes, WiringContext wiringContext)
 {
     this.nodes = nodes;
     this.wiringContext = wiringContext;
 }
 public MarkupExtensionNodeToXamlNodesConverter(WiringContext wiringContext)
 {
     this.wiringContext = wiringContext;
 }
Esempio n. 18
0
 public TemplateContent(IEnumerable<XamlNode> nodes, WiringContext context)
 {
     Nodes = nodes;
     Context = context;
 }
 public DummyAssemblerFactory(WiringContext wiringContext)
 {
     this.wiringContext = wiringContext;
 }
Esempio n. 20
0
 public ValuePipeline(WiringContext wiringContext)
 {
     WiringContext = wiringContext;
 }
Esempio n. 21
0
 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);
 }
Esempio n. 23
0
 public NodeInflater(IEnumerable<Type> inflatables, WiringContext wiringContext)
 {
     this.inflatables = inflatables;
     this.wiringContext = wiringContext;
     nodeBuilder = new XamlNodeBuilder(wiringContext.TypeContext);
 }