private INamespaceRegistry CreateNamespaceRegistry() { var namespaceRegistry = new NamespaceRegistry(); namespaceRegistry.FillFromAttributes(ScannedAssemblies); return(namespaceRegistry); }
public StructTransform(NamingRulesManager namingRules, NamespaceRegistry namespaceRegistry, MarshalledElementFactory factory, Ioc ioc) : base(namingRules, ioc) { this.namespaceRegistry = namespaceRegistry; this.factory = factory; factory.RequestStructProcessing += Process; }
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 }) })); }
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 }) })); }
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); }
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)); }
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); }
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; }
public EnumTransform(NamingRulesManager namingRules, NamespaceRegistry namespaceRegistry, Ioc ioc) : base(namingRules, ioc) { this.namespaceRegistry = namespaceRegistry; }