public FakeFrameworkElement Evaluate() { FailIfDisposed(); XamlObjectWriter writer = _xamlObjectWriterFactory.GetXamlObjectWriter(null); System.Xaml.XamlReader reader = CreateReader(); XamlServices.Transform(reader, writer); return((FakeFrameworkElement)writer.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 } }
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 } }
// 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); }