///<summary> /// Broadcast Unloaded event starting at this node /// </summary> internal void FireUnloadedOnDescendentsInternal() { // This is to prevent duplicate Broadcasts for the Unloaded event if (UnloadedPending == null) { DependencyObject parent = Parent; if (parent == null) { parent = VisualTreeHelper.GetParent(this); } // Check if this Unloaded cancels against a previously queued Loaded event // Note that if the Loaded and the Unloaded do not change the position of // the node within the loagical tree they are considered to cancel each other out. object[] loadedPending = LoadedPending; if (loadedPending == null) { // Add a callback to the MediaContext which will be called // before the first render after this point BroadcastEventHelper.AddUnloadedCallback(this, parent); } else { // Dequeue Loaded BroadcastEventHelper.RemoveLoadedCallback(this, loadedPending); } } }
// Token: 0x06000308 RID: 776 RVA: 0x000086A8 File Offset: 0x000068A8 internal static object BroadcastLoadedEvent(object root) { DependencyObject dependencyObject = (DependencyObject)root; object[] loadedPending = (object[])dependencyObject.GetValue(FrameworkElement.LoadedPendingProperty); bool isLoaded = BroadcastEventHelper.IsLoadedHelper(dependencyObject); BroadcastEventHelper.RemoveLoadedCallback(dependencyObject, loadedPending); BroadcastEventHelper.BroadcastLoadedSynchronously(dependencyObject, isLoaded); return(null); }
// Token: 0x0600030D RID: 781 RVA: 0x000087B8 File Offset: 0x000069B8 private static bool OnBroadcastCallback(DependencyObject d, BroadcastEventHelper.BroadcastEventData data, bool visitedViaVisualTree) { DependencyObject root = data.Root; RoutedEvent routedEvent = data.RoutedEvent; List <DependencyObject> eventRoute = data.EventRoute; if (FrameworkElement.DType.IsInstanceOfType(d)) { FrameworkElement frameworkElement = (FrameworkElement)d; if (frameworkElement != root && routedEvent == FrameworkElement.LoadedEvent && frameworkElement.UnloadedPending != null) { frameworkElement.FireLoadedOnDescendentsInternal(); } else if (frameworkElement != root && routedEvent == FrameworkElement.UnloadedEvent && frameworkElement.LoadedPending != null) { BroadcastEventHelper.RemoveLoadedCallback(frameworkElement, frameworkElement.LoadedPending); } else { if (frameworkElement != root) { if (routedEvent == FrameworkElement.LoadedEvent && frameworkElement.LoadedPending != null) { BroadcastEventHelper.RemoveLoadedCallback(frameworkElement, frameworkElement.LoadedPending); } else if (routedEvent == FrameworkElement.UnloadedEvent && frameworkElement.UnloadedPending != null) { BroadcastEventHelper.RemoveUnloadedCallback(frameworkElement, frameworkElement.UnloadedPending); } } if (frameworkElement.SubtreeHasLoadedChangeHandler) { frameworkElement.IsLoadedCache = (routedEvent == FrameworkElement.LoadedEvent); eventRoute.Add(frameworkElement); return(true); } } } else { FrameworkContentElement frameworkContentElement = (FrameworkContentElement)d; if (frameworkContentElement != root && routedEvent == FrameworkElement.LoadedEvent && frameworkContentElement.UnloadedPending != null) { frameworkContentElement.FireLoadedOnDescendentsInternal(); } else if (frameworkContentElement != root && routedEvent == FrameworkElement.UnloadedEvent && frameworkContentElement.LoadedPending != null) { BroadcastEventHelper.RemoveLoadedCallback(frameworkContentElement, frameworkContentElement.LoadedPending); } else { if (frameworkContentElement != root) { if (routedEvent == FrameworkElement.LoadedEvent && frameworkContentElement.LoadedPending != null) { BroadcastEventHelper.RemoveLoadedCallback(frameworkContentElement, frameworkContentElement.LoadedPending); } else if (routedEvent == FrameworkElement.UnloadedEvent && frameworkContentElement.UnloadedPending != null) { BroadcastEventHelper.RemoveUnloadedCallback(frameworkContentElement, frameworkContentElement.UnloadedPending); } } if (frameworkContentElement.SubtreeHasLoadedChangeHandler) { frameworkContentElement.IsLoadedCache = (routedEvent == FrameworkElement.LoadedEvent); eventRoute.Add(frameworkContentElement); return(true); } } } return(false); }