コード例 #1
0
 private void RegisterContentProperties(WiringContextBuilder wiringContextBuilder)
 {
     foreach (var contentPropertyDefinition in ContentPropertyDefinitions)
     {
         wiringContextBuilder.WithContentProperty(contentPropertyDefinition);
     }
 }
コード例 #2
0
        public XamlXmlLoader Build()
        {
            var wiringContextBuilder = new WiringContextBuilder();

            wiringContextBuilder
                .WithContentPropertiesFromAssemblies(lookupAssemblies)
                .WithNsPrefixes(prefixes)
                .WithConverters(Converters.FromAssemblies(lookupAssemblies));

            RegisterNamespaces(wiringContextBuilder);
            RegisterContentProperties(wiringContextBuilder);

            var wiringContext = wiringContextBuilder.Build();
            var assembler = new ObjectAssembler(wiringContext);
            return new XamlXmlLoader(assembler, wiringContext);
        }
コード例 #3
0
        public static WiringContext Create(ITypeFactory typeFactory)
        {
            var rootType = typeof (DummyClass);
            var anotherType = typeof (Foreigner);

            var builder = new WiringContextBuilder();

            var definitionForRoot = XamlNamespace
                .Map("root")
                .With(
                    new[]
                    {
                        Route.Assembly(rootType.Assembly)
                            .WithNamespaces(
                                new[]
                                {
                                    rootType.Namespace,
                                    typeof (Window).Namespace,
                                })
                    });

            var definitionForAnother = XamlNamespace
                .Map("another")
                .With(
                    new[]
                    {
                        Route.Assembly(anotherType.Assembly)
                            .WithNamespaces(new[] {anotherType.Namespace})
                    });

            var contentProperties = ContentProperties.DefinedInAssemblies(new[] {rootType.Assembly});

            builder.WithNamespaces(new List<XamlNamespace> {definitionForRoot, definitionForAnother})
                .WithContentProperties(contentProperties)
                .WithNsPrefixes(
                    new List<PrefixRegistration>
                    {
                        new PrefixRegistration(string.Empty, "root"),
                        new PrefixRegistration("x", "another"),
                    });

            builder.WithTypeFactory(typeFactory);

            return builder.Build();
        }
コード例 #4
0
 private void RegisterNamespaces(WiringContextBuilder wiringContextBuilder)
 {
     wiringContextBuilder.WithNamespaces(NamespaceRegistrations);
 }