Exemplo n.º 1
0
        private INamespaceRegistry CreateNamespaceRegistry()
        {
            var namespaceRegistry = new NamespaceRegistry();

            namespaceRegistry.FillFromAttributes(ScannedAssemblies);

            return(namespaceRegistry);
        }
Exemplo n.º 2
0
 public StructTransform(NamingRulesManager namingRules,
                        NamespaceRegistry namespaceRegistry,
                        MarshalledElementFactory factory,
                        Ioc ioc) : base(namingRules, ioc)
 {
     this.namespaceRegistry           = namespaceRegistry;
     this.factory                     = factory;
     factory.RequestStructProcessing += Process;
 }
Exemplo n.º 3
0
 public NamespaceRegistryTests()
 {
     type     = typeof(DummyClass);
     registry = new NamespaceRegistry();
     registry.RegisterPrefix(new PrefixRegistration("my", "target"));
     clrNamespace = $"clr-namespace:{type.Namespace};Assembly={type.GetTypeInfo().Assembly}";
     registry.RegisterPrefix(new PrefixRegistration("clr", clrNamespace));
     registry.AddNamespace(
         XamlNamespace.Map("target")
         .With(new[] { Route.Assembly(type.Assembly).WithNamespaces(new[] { type.Namespace }) }));
 }
Exemplo n.º 4
0
 public void Initialize()
 {
     type = typeof(DummyClass);
     registry = new NamespaceRegistry();
     registry.RegisterPrefix(new PrefixRegistration("my", "target"));
     clrNamespace = $"clr-namespace:{type.Namespace};Assembly={type.GetTypeInfo().Assembly}";
     registry.RegisterPrefix(new PrefixRegistration("clr", clrNamespace));
     registry.AddNamespace(
         XamlNamespace.Map("target")
             .With(new[] { Route.Assembly(type.Assembly).WithNamespaces(new[] { type.Namespace }) }));
 }
Exemplo n.º 5
0
        public static IRuntimeTypeSource FromAttributes(IEnumerable<Assembly> assemblies)
        {
            var allExportedTypes = assemblies.AllExportedTypes();

            var typeFactory = new TypeFactory();

            var xamlNamespaceRegistry = new NamespaceRegistry();
            xamlNamespaceRegistry.FillFromAttributes(assemblies);

            var typeFeatureProvider = new TypeFeatureProvider(new TypeConverterProvider());
            typeFeatureProvider.FillFromAttributes(allExportedTypes);
                
            var xamlTypeRepo = new TypeRepository(xamlNamespaceRegistry, typeFactory, typeFeatureProvider);

            return new RuntimeTypeSource(xamlTypeRepo, xamlNamespaceRegistry);
        }
Exemplo n.º 6
0
        public static IRuntimeTypeSource FromAttributes(IEnumerable <Assembly> assemblies)
        {
            var allExportedTypes = assemblies.AllExportedTypes();

            var typeFactory = new TypeFactory();

            var xamlNamespaceRegistry = new NamespaceRegistry();

            xamlNamespaceRegistry.FillFromAttributes(assemblies);

            var typeFeatureProvider = new TypeFeatureProvider(new TypeConverterProvider());

            typeFeatureProvider.FillFromAttributes(allExportedTypes);

            var xamlTypeRepo = new TypeRepository(xamlNamespaceRegistry, typeFactory, typeFeatureProvider);

            return(new RuntimeTypeSource(xamlTypeRepo, xamlNamespaceRegistry));
        }
Exemplo n.º 7
0
        private static NamespaceRegistry CreateXamlNamespaceRegistry()
        {
            var xamlNamespaceRegistry = new NamespaceRegistry();

            var windowType          = typeof(Window);
            var textBlockType       = typeof(TextBlock);
            var toggleButtonType    = typeof(ToggleButton);
            var rotateTransformType = typeof(RotateTransform);
            var bindingType         = typeof(BindingExtension);

            var rootNs = XamlNamespace.Map(WpfRootNs)
                         .With(
                new[]
            {
                Route.Assembly(bindingType.Assembly).WithNamespaces(
                    new[] { bindingType.Namespace }),
                Route.Assembly(rotateTransformType.Assembly).WithNamespaces(
                    new[] { rotateTransformType.Namespace }),
                Route.Assembly(bindingType.Assembly).WithNamespaces(
                    new[] { bindingType.Namespace }),
                Route.Assembly(windowType.Assembly).WithNamespaces(
                    new[]
                {
                    windowType.Namespace,
                    textBlockType.Namespace,
                    toggleButtonType.Namespace
                })
            });

            foreach (var ns in new List <XamlNamespace> {
                rootNs
            })
            {
                xamlNamespaceRegistry.AddNamespace(ns);
            }

            xamlNamespaceRegistry.RegisterPrefix(new PrefixRegistration("", WpfRootNs));

            return(xamlNamespaceRegistry);
        }
Exemplo n.º 8
0
        private static NamespaceRegistry CreateXamlNamespaceRegistry()
        {
            var xamlNamespaceRegistry = new NamespaceRegistry();

            var windowType = typeof (Window);
            var textBlockType = typeof (TextBlock);
            var toggleButtonType = typeof (ToggleButton);
            var rotateTransformType = typeof (RotateTransform);
            var bindingType = typeof (BindingExtension);

            var rootNs = XamlNamespace.Map(WpfRootNs)
                .With(
                    new[]
                    {
                        Route.Assembly(bindingType.Assembly).WithNamespaces(
                            new[] {bindingType.Namespace}),
                        Route.Assembly(rotateTransformType.Assembly).WithNamespaces(
                            new[] {rotateTransformType.Namespace}),
                        Route.Assembly(bindingType.Assembly).WithNamespaces(
                            new[] {bindingType.Namespace}),
                        Route.Assembly(windowType.Assembly).WithNamespaces(
                            new[]
                            {
                                windowType.Namespace,
                                textBlockType.Namespace,
                                toggleButtonType.Namespace
                            })
                    });

            foreach (var ns in new List<XamlNamespace> {rootNs})
            {
                xamlNamespaceRegistry.AddNamespace(ns);
            }

            xamlNamespaceRegistry.RegisterPrefix(new PrefixRegistration("", WpfRootNs));

            return xamlNamespaceRegistry;
        }
Exemplo n.º 9
0
 public EnumTransform(NamingRulesManager namingRules, NamespaceRegistry namespaceRegistry,
                      Ioc ioc) : base(namingRules, ioc)
 {
     this.namespaceRegistry = namespaceRegistry;
 }