internal DeferrableContent(Stream stream, Baml2006SchemaContext schemaContext, IXamlObjectWriterFactory objectWriterFactory, IServiceProvider serviceProvider, object rootObject) { ObjectWriterParentSettings = objectWriterFactory.GetParentSettings(); if (ObjectWriterParentSettings.AccessLevel != null) { XamlLoadPermission loadPermission = new XamlLoadPermission(ObjectWriterParentSettings.AccessLevel); loadPermission.Demand(); this.LoadPermission = loadPermission; } bool assemblyTargetsFramework2 = false; // The local assembly can be null if it is not specified in the XamlReaderSettings. if (schemaContext.LocalAssembly != null) { assemblyTargetsFramework2 = schemaContext.LocalAssembly.ImageRuntimeVersion.StartsWith("v2", StringComparison.Ordinal); } // There is an incompatibility between the framework versions 3 and 4 regarding MarkupExtension resources. // In version 3, MarkupExtension resources did not provide values when looked up. // In version 4, they do. if (assemblyTargetsFramework2) { ObjectWriterParentSettings.SkipProvideValueOnRoot = true; } this.Stream = stream; this.SchemaContext = schemaContext; this.ObjectWriterFactory = objectWriterFactory; this.ServiceProvider = serviceProvider; this.RootObject = rootObject; }
public FooContainerFactory(IXamlObjectWriterFactory objectWriterFactory, XamlReader xamlReader) { this.nodeList = new XamlNodeList(xamlReader.SchemaContext); XamlServices.Transform(xamlReader, nodeList.Writer); this.objectWriterFactory = objectWriterFactory; }
internal DeferrableContent(Stream stream, Baml2006SchemaContext schemaContext, IXamlObjectWriterFactory objectWriterFactory, IServiceProvider serviceProvider, object rootObject) { ObjectWriterParentSettings = objectWriterFactory.GetParentSettings(); if (ObjectWriterParentSettings.AccessLevel != null) { XamlLoadPermission loadPermission = new XamlLoadPermission(ObjectWriterParentSettings.AccessLevel); loadPermission.Demand(); this.LoadPermission = loadPermission; } bool assemblyTargetsFramework2 = false; // The local assembly can be null if it is not specified in the XamlReaderSettings. if (schemaContext.LocalAssembly != null) { assemblyTargetsFramework2 = schemaContext.LocalAssembly.ImageRuntimeVersion.StartsWith("v2", StringComparison.Ordinal); } // There is an incompatibility between the framework versions 3 and 4 regarding MarkupExtension resources. // In version 3, MarkupExtension resources did not provide values when looked up. // In version 4, they do. if (assemblyTargetsFramework2) { ObjectWriterParentSettings.SkipProvideValueOnRoot = true; } this.Stream = stream; this.SchemaContext = schemaContext; this.ObjectWriterFactory = objectWriterFactory; this.ServiceProvider = serviceProvider; this.RootObject = rootObject; }
public override object Load(XamlReader xamlReader, IServiceProvider serviceProvider) { IXamlObjectWriterFactory settings = serviceProvider.GetService(typeof(IXamlObjectWriterFactory)) as IXamlObjectWriterFactory; System.Windows.Markup.IProvideValueTarget provideValueService = serviceProvider.GetService(typeof(System.Windows.Markup.IProvideValueTarget)) as System.Windows.Markup.IProvideValueTarget; Type propertyType = null; // IProvideValueTarget.TargetProperty can return DP, Attached Property or MemberInfo for clr property // In this case it should always be a regular clr property here. PropertyInfo propertyInfo = provideValueService.TargetProperty as PropertyInfo; if (propertyInfo != null) { propertyType = propertyInfo.PropertyType; } else { return(null); } object instance = Activator.CreateInstance( typeof(FuncFactory <>).MakeGenericType(propertyType.GetGenericArguments()), settings, xamlReader); return(Delegate.CreateDelegate(propertyType, instance, instance.GetType().GetMethod("Evaluate"))); }
public override object Load(XamlReader reader, IServiceProvider context) { IXamlObjectWriterFactory objectWriterFactory = (IXamlObjectWriterFactory)context.GetService(typeof(IXamlObjectWriterFactory)); FooContainerFactory fooContainerFactory = new FooContainerFactory(objectWriterFactory, reader); return(new Func <FooContainer>(() => fooContainerFactory.GetFooContainer())); }
public static object LoadDeferredContent(System.Xaml.XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, bool skipJournaledProperties, Object rootObject, XamlObjectWriterSettings parentSettings, Uri baseUri) { XamlObjectWriterSettings settings = XamlReader.CreateObjectWriterSettings(parentSettings); // Don't set settings.RootObject because this isn't the real root return Load(xamlReader, writerFactory, skipJournaledProperties, rootObject, settings, baseUri); }
public static object LoadDeferredContent(System.Xaml.XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, bool skipJournaledProperties, Object rootObject, XamlObjectWriterSettings parentSettings, Uri baseUri) { XamlObjectWriterSettings settings = XamlReader.CreateObjectWriterSettings(parentSettings); // Don't set settings.RootObject because this isn't the real root return(Load(xamlReader, writerFactory, skipJournaledProperties, rootObject, settings, baseUri)); }
void Initialize(PrefixLookup prefixLookup, XamlSchemaContext schemaContext, Func <IAmbientProvider> ambientProvider, IProvideValueTarget provideValue, IRootObjectProvider rootProvider, IDestinationTypeProvider destinationProvider, IXamlObjectWriterFactory objectWriterFactory) { prefix_lookup = prefixLookup ?? throw new ArgumentNullException("prefixLookup"); sctx = schemaContext ?? throw new ArgumentNullException("schemaContext"); _ambientProviderProvider = ambientProvider; this.provideValue = provideValue; this.rootProvider = rootProvider; this.destinationProvider = destinationProvider; this.objectWriterFactory = objectWriterFactory; }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value != null) { if (context == null) { throw new ArgumentNullException("context"); } XamlSchemaContext xamlSchemaContext = RequireService <IXamlSchemaContextProvider>(context).SchemaContext; Baml2006SchemaContext schemaContext = xamlSchemaContext as Baml2006SchemaContext; if (schemaContext == null) { throw new InvalidOperationException(SR.Get(SRID.ExpectedBamlSchemaContext)); } IXamlObjectWriterFactory objectWriterFactory = RequireService <IXamlObjectWriterFactory>(context); IProvideValueTarget ipvt = RequireService <IProvideValueTarget>(context); IRootObjectProvider rootObjectProvider = RequireService <IRootObjectProvider>(context); ResourceDictionary dictionary = ipvt.TargetObject as ResourceDictionary; if (dictionary == null) { throw new InvalidOperationException(SR.Get(SRID.ExpectedResourceDictionaryTarget)); } Stream stream = value as Stream; if (stream == null) { byte[] bytes = value as byte[]; if (bytes != null) { stream = new MemoryStream(bytes); } } if (stream == null) { throw new InvalidOperationException(SR.Get(SRID.ExpectedBinaryContent)); } // DeferrableContent deferrableContext = new DeferrableContent(stream, schemaContext, objectWriterFactory, context, rootObjectProvider.RootObject); return(deferrableContext); } return(base.ConvertFrom(context, culture, value)); }
/// <summary>Loads XAML content in a deferred mode, based on a <see cref="T:System.Xaml.XamlReader" /> and certain required services from a service provider.</summary> /// <param name="xamlReader">The initiating reader that is then returned on calls to <see cref="M:System.Windows.TemplateContentLoader.Save(System.Object,System.IServiceProvider)" />.</param> /// <param name="serviceProvider">Service provider for required services.</param> /// <returns>The root object for the node stream of the input <see cref="T:System.Xaml.XamlReader" />. Specifically, this is a <see cref="T:System.Windows.TemplateContent" /> instance.</returns> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="xamlReader" /> or <paramref name="serviceProvider" /> are <see langword="null" />.</exception> /// <exception cref="T:System.InvalidOperationException"> /// <paramref name="serviceProvider" /> does not provide a required service.</exception> // Token: 0x06000C0B RID: 3083 RVA: 0x0002CEF8 File Offset: 0x0002B0F8 public override object Load(XamlReader xamlReader, IServiceProvider serviceProvider) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } if (xamlReader == null) { throw new ArgumentNullException("xamlReader"); } IXamlObjectWriterFactory factory = TemplateContentLoader.RequireService <IXamlObjectWriterFactory>(serviceProvider); return(new TemplateContent(xamlReader, factory, serviceProvider)); }
public override object Load(XamlReader xamlReader, IServiceProvider context) { IXamlObjectWriterFactory service = context.GetService(typeof(IXamlObjectWriterFactory)) as IXamlObjectWriterFactory; IProvideValueTarget target = context.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget; Type propertyType = null; PropertyInfo targetProperty = target.TargetProperty as PropertyInfo; if (targetProperty != null) { propertyType = targetProperty.PropertyType; } object firstArgument = Activator.CreateInstance(typeof(FuncFactory).MakeGenericType(propertyType.GetGenericArguments()), new object[] { service, xamlReader }); return(Delegate.CreateDelegate(propertyType, firstArgument, firstArgument.GetType().GetMethod("Evaluate"))); }
public ValueSerializerContext(PrefixLookup prefixLookup, XamlSchemaContext schemaContext, IAmbientProvider ambientProvider, IProvideValueTarget provideValue, IRootObjectProvider rootProvider, IDestinationTypeProvider destinationProvider, IXamlObjectWriterFactory objectWriterFactory) { if (prefixLookup == null) { throw new ArgumentNullException("prefixLookup"); } if (schemaContext == null) { throw new ArgumentNullException("schemaContext"); } prefix_lookup = prefixLookup; sctx = schemaContext; ambient_provider = ambientProvider; this.provideValue = provideValue; this.rootProvider = rootProvider; this.destinationProvider = destinationProvider; this.objectWriterFactory = objectWriterFactory; }
internal static FuncFactory CreateFactory(XamlReader xamlReader, IServiceProvider context) { IXamlObjectWriterFactory objectWriterFactory = context.GetService(typeof(IXamlObjectWriterFactory)) as IXamlObjectWriterFactory; IProvideValueTarget provideValueService = context.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget; Type propertyType = null; // // IProvideValueTarget.TargetProperty can return DP, Attached Property or MemberInfo for clr property // In this case it should always be a regular clr property here - we are always targeting Activity.Body. PropertyInfo propertyInfo = provideValueService.TargetProperty as PropertyInfo; if (propertyInfo != null) { propertyType = propertyInfo.PropertyType; } FuncFactory funcFactory = CreateFactory(objectWriterFactory, xamlReader, propertyType.GetGenericArguments()); return(funcFactory); }
/// <summary>Converts the specified stream to a new <see cref="T:System.Windows.DeferrableContent" /> object.</summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context. </param> /// <param name="culture">The <see cref="T:System.Globalization.CultureInfo" /> to use as the current culture. </param> /// <param name="value">The source stream to convert.</param> /// <returns>A new <see cref="T:System.Windows.DeferrableContent" /> object.</returns> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="context" /> is <see langword="null" />.</exception> /// <exception cref="T:System.InvalidOperationException"> /// <paramref name="context" /> is not able to provide the necessary XAML schema context for BAML.-or- /// <see cref="T:System.Windows.Markup.IProvideValueTarget" /> service interpretation of <paramref name="context" /> determines that the target object is not a <see cref="T:System.Windows.ResourceDictionary" />.-or- /// <paramref name="value" /> is not a valid byte stream.</exception> // Token: 0x060003AC RID: 940 RVA: 0x0000A73C File Offset: 0x0000893C public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value == null) { return(base.ConvertFrom(context, culture, value)); } if (context == null) { throw new ArgumentNullException("context"); } XamlSchemaContext schemaContext = DeferrableContentConverter.RequireService <IXamlSchemaContextProvider>(context).SchemaContext; Baml2006SchemaContext baml2006SchemaContext = schemaContext as Baml2006SchemaContext; if (baml2006SchemaContext == null) { throw new InvalidOperationException(SR.Get("ExpectedBamlSchemaContext")); } IXamlObjectWriterFactory objectWriterFactory = DeferrableContentConverter.RequireService <IXamlObjectWriterFactory>(context); IProvideValueTarget provideValueTarget = DeferrableContentConverter.RequireService <IProvideValueTarget>(context); IRootObjectProvider rootObjectProvider = DeferrableContentConverter.RequireService <IRootObjectProvider>(context); if (!(provideValueTarget.TargetObject is ResourceDictionary)) { throw new InvalidOperationException(SR.Get("ExpectedResourceDictionaryTarget")); } Stream stream = value as Stream; if (stream == null) { byte[] array = value as byte[]; if (array != null) { stream = new MemoryStream(array); } } if (stream == null) { throw new InvalidOperationException(SR.Get("ExpectedBinaryContent")); } return(new DeferrableContent(stream, baml2006SchemaContext, objectWriterFactory, context, rootObjectProvider.RootObject)); }
public XamlReaderMarkupFactory(System.Xaml.XamlReader reader, IXamlObjectWriterFactory xamlObjectWriterFactory) { _xamlObjectWriterFactory = xamlObjectWriterFactory; _xamlNodeList = new XamlNodeList(reader.SchemaContext); XamlServices.Transform(reader, _xamlNodeList.Writer); }
public static ValueSerializerContext Create(PrefixLookup prefixLookup, XamlSchemaContext schemaContext, IAmbientProvider ambientProvider, IProvideValueTarget provideValue, IRootObjectProvider rootProvider, IDestinationTypeProvider destinationProvider, IXamlObjectWriterFactory objectWriterFactory) { #if !HAS_TYPE_CONVERTER ValueSerializerContext context; var type = GetValueSerializerType(); if (type != null) { context = Activator.CreateInstance(type) as ValueSerializerContext; } else { context = new ValueSerializerContext(); } #else var context = new ValueSerializerContext(); #endif context.Initialize(prefixLookup, schemaContext, ambientProvider, provideValue, rootProvider, destinationProvider, objectWriterFactory); return(context); }
public static ValueSerializerContext Create(PrefixLookup prefixLookup, XamlSchemaContext schemaContext, Func <IAmbientProvider> ambientProvider, IProvideValueTarget provideValue, IRootObjectProvider rootProvider, IDestinationTypeProvider destinationProvider, IXamlObjectWriterFactory objectWriterFactory) { var context = new ValueSerializerContext(); context.Initialize(prefixLookup, schemaContext, ambientProvider, provideValue, rootProvider, destinationProvider, objectWriterFactory); return(context); }
private static object Load(System.Xaml.XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, bool skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri) { XamlObjectWriter xamlWriter = null; XamlContextStack<WpfXamlFrame> stack = new XamlContextStack<WpfXamlFrame>(() => new WpfXamlFrame()); int persistId = 1; settings.AfterBeginInitHandler = delegate(object sender, System.Xaml.XamlObjectEventArgs args) { if (EventTrace.IsEnabled(EventTrace.Keyword.KeywordXamlBaml | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Verbose)) { IXamlLineInfo ixli = xamlReader as IXamlLineInfo; int lineNumber = -1; int linePosition = -1; if (ixli != null && ixli.HasLineInfo) { lineNumber = ixli.LineNumber; linePosition = ixli.LinePosition; } EventTrace.EventProvider.TraceEvent( EventTrace.Event.WClientParseXamlBamlInfo, EventTrace.Keyword.KeywordXamlBaml | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Verbose, args.Instance == null ? 0 : PerfService.GetPerfElementID(args.Instance), lineNumber, linePosition); } UIElement uiElement = args.Instance as UIElement; if (uiElement != null) { uiElement.SetPersistId(persistId++); } DependencyObject dObject = args.Instance as DependencyObject; if (dObject != null && stack.CurrentFrame.XmlnsDictionary != null) { XmlnsDictionary dictionary = stack.CurrentFrame.XmlnsDictionary; dictionary.Seal(); XmlAttributeProperties.SetXmlnsDictionary(dObject, dictionary); } stack.CurrentFrame.Instance = args.Instance; }; if (writerFactory != null) { xamlWriter = writerFactory.GetXamlObjectWriter(settings); } else { xamlWriter = new System.Xaml.XamlObjectWriter(xamlReader.SchemaContext, settings); } IXamlLineInfo xamlLineInfo = null; try { //Handle Line Numbers xamlLineInfo = xamlReader as IXamlLineInfo; IXamlLineInfoConsumer xamlLineInfoConsumer = xamlWriter as IXamlLineInfoConsumer; bool shouldPassLineNumberInfo = false; if ((xamlLineInfo != null && xamlLineInfo.HasLineInfo) && (xamlLineInfoConsumer != null && xamlLineInfoConsumer.ShouldProvideLineInfo)) { shouldPassLineNumberInfo = true; } IStyleConnector styleConnector = rootObject as IStyleConnector; TransformNodes(xamlReader, xamlWriter, false /*onlyLoadOneNode*/, skipJournaledProperties, shouldPassLineNumberInfo, xamlLineInfo, xamlLineInfoConsumer, stack, styleConnector); xamlWriter.Close(); return xamlWriter.Result; } catch (Exception e) { // Don't wrap critical exceptions or already-wrapped exceptions. if (MS.Internal.CriticalExceptions.IsCriticalException(e) || !XamlReader.ShouldReWrapException(e, baseUri)) { throw; } XamlReader.RewrapException(e, xamlLineInfo, baseUri); return null; // this should never be executed } }
internal DeferrableContent(Stream stream, Baml2006SchemaContext schemaContext, IXamlObjectWriterFactory objectWriterFactory, IServiceProvider serviceProvider, object rootObject) { this.ObjectWriterParentSettings = objectWriterFactory.GetParentSettings(); if (this.ObjectWriterParentSettings.AccessLevel != null) { XamlLoadPermission xamlLoadPermission = new XamlLoadPermission(this.ObjectWriterParentSettings.AccessLevel); xamlLoadPermission.Demand(); this.LoadPermission = xamlLoadPermission; } bool flag = false; if (schemaContext.LocalAssembly != null) { flag = schemaContext.LocalAssembly.ImageRuntimeVersion.StartsWith("v2", StringComparison.Ordinal); } if (flag) { this.ObjectWriterParentSettings.SkipProvideValueOnRoot = true; } this.Stream = stream; this.SchemaContext = schemaContext; this.ObjectWriterFactory = objectWriterFactory; this.ServiceProvider = serviceProvider; this.RootObject = rootObject; }
// Back-compat workaround: returnType should only be a single value. But in 4.0 we didn't // validate this; we just passed the array in to MakeGenericType, which would throw if there // were multiple values. To preserve the same exception, we allow passing in an array here. private static FuncFactory CreateFactory(IXamlObjectWriterFactory objectWriterFactory, XamlReader xamlReader, params Type[] returnType) { var closedType = typeof(FuncFactory <>).MakeGenericType(returnType); return((FuncFactory)Activator.CreateInstance(closedType, objectWriterFactory, xamlReader)); }
public TestTemplate(XamlReader xamlReader, IXamlObjectWriterFactory factory) { XamlObjectWriterFactory = factory; _xamlNodeList = new XamlNodeList(xamlReader.SchemaContext); XamlServices.Transform(xamlReader, _xamlNodeList.Writer); }
// Token: 0x0600226A RID: 8810 RVA: 0x000AAE10 File Offset: 0x000A9010 private static object Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, bool skipJournaledProperties, object rootObject, XamlObjectWriterSettings settings, Uri baseUri) { XamlContextStack <WpfXamlFrame> stack = new XamlContextStack <WpfXamlFrame>(() => new WpfXamlFrame()); int persistId = 1; settings.AfterBeginInitHandler = delegate(object sender, XamlObjectEventArgs args) { if (EventTrace.IsEnabled(EventTrace.Keyword.KeywordPerf | EventTrace.Keyword.KeywordXamlBaml, EventTrace.Level.Verbose)) { IXamlLineInfo xamlLineInfo2 = xamlReader as IXamlLineInfo; int num = -1; int num2 = -1; if (xamlLineInfo2 != null && xamlLineInfo2.HasLineInfo) { num = xamlLineInfo2.LineNumber; num2 = xamlLineInfo2.LinePosition; } EventTrace.EventProvider.TraceEvent(EventTrace.Event.WClientParseXamlBamlInfo, EventTrace.Keyword.KeywordPerf | EventTrace.Keyword.KeywordXamlBaml, EventTrace.Level.Verbose, new object[] { (args.Instance == null) ? 0L : PerfService.GetPerfElementID(args.Instance), num, num2 }); } UIElement uielement = args.Instance as UIElement; if (uielement != null) { UIElement uielement2 = uielement; int persistId = persistId; persistId++; uielement2.SetPersistId(persistId); } XamlSourceInfoHelper.SetXamlSourceInfo(args.Instance, args, baseUri); DependencyObject dependencyObject = args.Instance as DependencyObject; if (dependencyObject != null && stack.CurrentFrame.XmlnsDictionary != null) { XmlnsDictionary xmlnsDictionary = stack.CurrentFrame.XmlnsDictionary; xmlnsDictionary.Seal(); XmlAttributeProperties.SetXmlnsDictionary(dependencyObject, xmlnsDictionary); } stack.CurrentFrame.Instance = args.Instance; }; XamlObjectWriter xamlObjectWriter; if (writerFactory != null) { xamlObjectWriter = writerFactory.GetXamlObjectWriter(settings); } else { xamlObjectWriter = new XamlObjectWriter(xamlReader.SchemaContext, settings); } IXamlLineInfo xamlLineInfo = null; object result; try { xamlLineInfo = (xamlReader as IXamlLineInfo); IXamlLineInfoConsumer xamlLineInfoConsumer = xamlObjectWriter; bool shouldPassLineNumberInfo = false; if (xamlLineInfo != null && xamlLineInfo.HasLineInfo && xamlLineInfoConsumer != null && xamlLineInfoConsumer.ShouldProvideLineInfo) { shouldPassLineNumberInfo = true; } IStyleConnector styleConnector = rootObject as IStyleConnector; WpfXamlLoader.TransformNodes(xamlReader, xamlObjectWriter, false, skipJournaledProperties, shouldPassLineNumberInfo, xamlLineInfo, xamlLineInfoConsumer, stack, styleConnector); xamlObjectWriter.Close(); result = xamlObjectWriter.Result; } catch (Exception ex) { if (CriticalExceptions.IsCriticalException(ex) || !XamlReader.ShouldReWrapException(ex, baseUri)) { throw; } XamlReader.RewrapException(ex, xamlLineInfo, baseUri); result = null; } return(result); }
private static object Load(System.Xaml.XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, bool skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri) { XamlObjectWriter xamlWriter = null; XamlContextStack <WpfXamlFrame> stack = new XamlContextStack <WpfXamlFrame>(() => new WpfXamlFrame()); int persistId = 1; settings.AfterBeginInitHandler = delegate(object sender, System.Xaml.XamlObjectEventArgs args) { if (EventTrace.IsEnabled(EventTrace.Keyword.KeywordXamlBaml | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Verbose)) { IXamlLineInfo ixli = xamlReader as IXamlLineInfo; int lineNumber = -1; int linePosition = -1; if (ixli != null && ixli.HasLineInfo) { lineNumber = ixli.LineNumber; linePosition = ixli.LinePosition; } EventTrace.EventProvider.TraceEvent( EventTrace.Event.WClientParseXamlBamlInfo, EventTrace.Keyword.KeywordXamlBaml | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Verbose, args.Instance == null ? 0 : PerfService.GetPerfElementID(args.Instance), lineNumber, linePosition); } UIElement uiElement = args.Instance as UIElement; if (uiElement != null) { uiElement.SetPersistId(persistId++); } XamlSourceInfoHelper.SetXamlSourceInfo(args.Instance, args, baseUri); DependencyObject dObject = args.Instance as DependencyObject; if (dObject != null && stack.CurrentFrame.XmlnsDictionary != null) { XmlnsDictionary dictionary = stack.CurrentFrame.XmlnsDictionary; dictionary.Seal(); XmlAttributeProperties.SetXmlnsDictionary(dObject, dictionary); } stack.CurrentFrame.Instance = args.Instance; }; if (writerFactory != null) { xamlWriter = writerFactory.GetXamlObjectWriter(settings); } else { xamlWriter = new System.Xaml.XamlObjectWriter(xamlReader.SchemaContext, settings); } IXamlLineInfo xamlLineInfo = null; try { //Handle Line Numbers xamlLineInfo = xamlReader as IXamlLineInfo; IXamlLineInfoConsumer xamlLineInfoConsumer = xamlWriter as IXamlLineInfoConsumer; bool shouldPassLineNumberInfo = false; if ((xamlLineInfo != null && xamlLineInfo.HasLineInfo) && (xamlLineInfoConsumer != null && xamlLineInfoConsumer.ShouldProvideLineInfo)) { shouldPassLineNumberInfo = true; } IStyleConnector styleConnector = rootObject as IStyleConnector; TransformNodes(xamlReader, xamlWriter, false /*onlyLoadOneNode*/, skipJournaledProperties, shouldPassLineNumberInfo, xamlLineInfo, xamlLineInfoConsumer, stack, styleConnector); xamlWriter.Close(); return(xamlWriter.Result); } catch (Exception e) { // Don't wrap critical exceptions or already-wrapped exceptions. if (MS.Internal.CriticalExceptions.IsCriticalException(e) || !XamlReader.ShouldReWrapException(e, baseUri)) { throw; } XamlReader.RewrapException(e, xamlLineInfo, baseUri); return(null); // this should never be executed } }
internal FakeFrameworkElementFactory(System.Xaml.XamlReader reader, IXamlObjectWriterFactory xamlObjectWriterFactory) { impl = new XamlReaderMarkupFactory(reader, xamlObjectWriterFactory); }
public TestFactory(IXamlObjectWriterFactory context, System.Xaml.XamlReader reader) : base(context, reader) { }
// Token: 0x06002267 RID: 8807 RVA: 0x000AAD70 File Offset: 0x000A8F70 public static object LoadDeferredContent(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, bool skipJournaledProperties, object rootObject, XamlObjectWriterSettings parentSettings, Uri baseUri) { XamlObjectWriterSettings settings = XamlReader.CreateObjectWriterSettings(parentSettings); return(WpfXamlLoader.Load(xamlReader, writerFactory, skipJournaledProperties, rootObject, settings, baseUri)); }