/// <summary> /// Instantiates Property Dump Core with Visual that is root of XML dump /// </summary> /// <param name="visualId"></param> /// <param name="visualRoot"></param> void FindDumpRoot(string visualId, DependencyObject visualRoot) { DependencyObject DumpRoot = null; if (visualId == null || visualId == string.Empty) { DumpRoot = visualRoot; } else { DumpRoot = LogicalTreeHelper.FindLogicalNode(visualRoot, visualId); } if (DumpRoot == null) { GlobalLog.LogEvidence(new NullReferenceException("Dump root cannot be null.")); return; } if (DumpRoot is Visual) { core = new PropertyDumpCore((Visual)DumpRoot); } else { FindDumpRoot(visualId, DumpRoot); } }
// ------------------------------------------------------------------ // Static constructor. // ------------------------------------------------------------------ static FrameworkElements() { PropertyDumpCore.AddUIElementDumpHandler(typeof(TextBlock), new PropertyDumpCore.DumpCustomUIElement(DumpText)); PropertyDumpCore.AddUIElementDumpHandler(typeof(FlowDocumentScrollViewer), new PropertyDumpCore.DumpCustomUIElement(DumpTextPanel)); PropertyDumpCore.AddUIElementDumpHandler(typeof(DocumentPageView), new PropertyDumpCore.DumpCustomUIElement(DumpDocumentPageView)); PropertyDumpCore.AddUIElementDumpHandler(typeof(Viewbox), new PropertyDumpCore.DumpCustomUIElement(DumpViewbox)); AddDocumentPageDumpHandler(ReflectionHelper.GetTypeFromName("MS.Internal.PtsHost.FlowDocumentPage"), new DumpCustomDocumentPage(DumpFlowDocumentPage)); }
// ------------------------------------------------------------------ // Initialize framework elements dumpers. // ------------------------------------------------------------------ internal static void Init(PropertyDumpCore propDumpCore) { core = propDumpCore; // All work is done in the constructor, but Init call is required // to invoke it. }