コード例 #1
0
 // Token: 0x06000309 RID: 777 RVA: 0x000086E3 File Offset: 0x000068E3
 internal static void BroadcastLoadedSynchronously(DependencyObject rootDO, bool isLoaded)
 {
     if (!isLoaded)
     {
         BroadcastEventHelper.BroadcastEvent(rootDO, FrameworkElement.LoadedEvent);
     }
 }
コード例 #2
0
        ///<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;


                // 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);
                }
            }
        }
コード例 #3
0
 // Token: 0x0600031A RID: 794 RVA: 0x00008CE3 File Offset: 0x00006EE3
 private static void UpdateIsLoadedCache(FrameworkContentElement fce, DependencyObject parent)
 {
     if (fce.GetValue(FrameworkElement.LoadedPendingProperty) == null)
     {
         fce.IsLoadedCache = BroadcastEventHelper.IsLoadedHelper(parent);
         return;
     }
     fce.IsLoadedCache = false;
 }
コード例 #4
0
 internal static void BroadcastLoadedSynchronously(DependencyObject rootDO, bool isLoaded)
 {
     // It is possible that the loaded broadcast for a parent caused you to be loaded before
     // your broadcast item got dequeued. In that case simply ignore the operation
     if (!isLoaded)
     {
         // Broadcast the Loaded event
         BroadcastEventHelper.BroadcastEvent(rootDO, FrameworkElement.LoadedEvent);
     }
 }
コード例 #5
0
        // Token: 0x06000C1D RID: 3101 RVA: 0x0002D2C4 File Offset: 0x0002B4C4
        internal void RegisterNameInternal(string name, object scopedElement)
        {
            FrameworkElement        frameworkElement;
            FrameworkContentElement frameworkContentElement;

            Helper.DowncastToFEorFCE(scopedElement as DependencyObject, out frameworkElement, out frameworkContentElement, false);
            if (this._templatedParent == null)
            {
                if (this._nameMap == null)
                {
                    this._nameMap = new HybridDictionary();
                }
                this._nameMap[name] = scopedElement;
                if (frameworkElement != null || frameworkContentElement != null)
                {
                    this.SetTemplateParentValues(name, scopedElement);
                    return;
                }
            }
            else
            {
                if (frameworkElement == null && frameworkContentElement == null)
                {
                    Hashtable hashtable = TemplateNameScope._templatedNonFeChildrenField.GetValue(this._templatedParent);
                    if (hashtable == null)
                    {
                        hashtable = new Hashtable(1);
                        TemplateNameScope._templatedNonFeChildrenField.SetValue(this._templatedParent, hashtable);
                    }
                    hashtable[name] = scopedElement;
                    return;
                }
                this._affectedChildren.Add(scopedElement as DependencyObject);
                int num;
                if (frameworkElement != null)
                {
                    frameworkElement._templatedParent      = this._templatedParent;
                    frameworkElement.IsTemplatedParentAnFE = this._isTemplatedParentAnFE;
                    num = (frameworkElement.TemplateChildIndex = (int)this._frameworkTemplate.ChildIndexFromChildName[name]);
                }
                else
                {
                    frameworkContentElement._templatedParent      = this._templatedParent;
                    frameworkContentElement.IsTemplatedParentAnFE = this._isTemplatedParentAnFE;
                    num = (frameworkContentElement.TemplateChildIndex = (int)this._frameworkTemplate.ChildIndexFromChildName[name]);
                }
                HybridDictionary templateChildLoadedDictionary = this._frameworkTemplate._TemplateChildLoadedDictionary;
                FrameworkTemplate.TemplateChildLoadedFlags templateChildLoadedFlags = templateChildLoadedDictionary[num] as FrameworkTemplate.TemplateChildLoadedFlags;
                if (templateChildLoadedFlags != null && (templateChildLoadedFlags.HasLoadedChangedHandler || templateChildLoadedFlags.HasUnloadedChangedHandler))
                {
                    BroadcastEventHelper.AddHasLoadedChangeHandlerFlagInAncestry((frameworkElement != null) ? frameworkElement : frameworkContentElement);
                }
                StyleHelper.CreateInstanceDataForChild(StyleHelper.TemplateDataField, this._templatedParent, (frameworkElement != null) ? frameworkElement : frameworkContentElement, num, this._frameworkTemplate.HasInstanceValues, ref this._frameworkTemplate.ChildRecordFromChildIndex);
            }
        }
コード例 #6
0
        // 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);
        }
コード例 #7
0
        // handle the Unloaded event from the mentor
        void OnMentorUnloaded(object sender, RoutedEventArgs e)
        {
            FrameworkObject foMentor = new FrameworkObject((DependencyObject)sender);

            // stop listening for Unloaded, start listening for Loaded
            foMentor.Unloaded -= new RoutedEventHandler(OnMentorUnloaded);
            foMentor.Loaded   += new RoutedEventHandler(OnMentorLoaded);

            // broadcast the Unloaded event to my framework subtree
            //FireUnloadedOnDescendentsInternal();
            BroadcastEventHelper.BroadcastUnloadedSynchronously(this, IsLoaded);
        }
コード例 #8
0
 // Token: 0x06000307 RID: 775 RVA: 0x0000867B File Offset: 0x0000687B
 internal static void BroadcastLoadedOrUnloadedEvent(DependencyObject d, DependencyObject oldParent, DependencyObject newParent)
 {
     if (oldParent == null && newParent != null)
     {
         if (BroadcastEventHelper.IsLoadedHelper(newParent))
         {
             BroadcastEventHelper.FireLoadedOnDescendentsHelper(d);
             return;
         }
     }
     else if (oldParent != null && newParent == null && BroadcastEventHelper.IsLoadedHelper(oldParent))
     {
         BroadcastEventHelper.FireUnloadedOnDescendentsHelper(d);
     }
 }
コード例 #9
0
        // Token: 0x06000314 RID: 788 RVA: 0x00008A70 File Offset: 0x00006C70
        internal static void AddOrRemoveHasLoadedChangeHandlerFlag(DependencyObject d, DependencyObject oldParent, DependencyObject newParent)
        {
            bool flag = BroadcastEventHelper.SubtreeHasLoadedChangeHandlerHelper(d);

            if (flag)
            {
                if (oldParent == null && newParent != null)
                {
                    BroadcastEventHelper.AddHasLoadedChangeHandlerFlagInAncestry(newParent);
                    return;
                }
                if (oldParent != null && newParent == null)
                {
                    BroadcastEventHelper.RemoveHasLoadedChangeHandlerFlagInAncestry(oldParent);
                }
            }
        }
コード例 #10
0
 // Token: 0x06000319 RID: 793 RVA: 0x00008CA5 File Offset: 0x00006EA5
 private static void UpdateIsLoadedCache(FrameworkElement fe, DependencyObject parent)
 {
     if (fe.GetValue(FrameworkElement.LoadedPendingProperty) != null)
     {
         fe.IsLoadedCache = false;
         return;
     }
     if (parent != null)
     {
         fe.IsLoadedCache = BroadcastEventHelper.IsLoadedHelper(parent);
         return;
     }
     if (SafeSecurityHelper.IsConnectedToPresentationSource(fe))
     {
         fe.IsLoadedCache = true;
         return;
     }
     fe.IsLoadedCache = false;
 }
コード例 #11
0
        // Token: 0x06000312 RID: 786 RVA: 0x000089EC File Offset: 0x00006BEC
        internal static bool IsParentLoaded(DependencyObject d)
        {
            FrameworkObject  frameworkObject = new FrameworkObject(d);
            DependencyObject effectiveParent = frameworkObject.EffectiveParent;

            if (effectiveParent != null)
            {
                return(BroadcastEventHelper.IsLoadedHelper(effectiveParent));
            }
            Visual visual;

            if ((visual = (d as Visual)) != null)
            {
                return(SafeSecurityHelper.IsConnectedToPresentationSource(visual));
            }
            Visual3D reference;

            if ((reference = (d as Visual3D)) != null)
            {
                visual = VisualTreeHelper.GetContainingVisual2D(reference);
                return(visual != null && SafeSecurityHelper.IsConnectedToPresentationSource(visual));
            }
            return(false);
        }
コード例 #12
0
        /// <summary>
        ///     Invoked when logical parent is changed.  This just
        ///     sets the parent pointer.
        /// </summary>
        /// <remarks>
        ///     A parent change is considered catastrohpic and results in a large
        ///     amount of invalidations and tree traversals. <cref see="DependencyFastBuild"/>
        ///     is recommended to reduce the work necessary to build a tree
        /// </remarks>
        /// <param name="newParent">
        ///     New parent that was set
        /// </param>
        internal void ChangeLogicalParent(DependencyObject newParent)
        {
            ///////////////////
            // OnNewParent:
            ///////////////////

            //
            // -- Approved By The Core Team --
            //
            // Do not allow foreign threads to change the tree.
            // (This is a noop if this object is not assigned to a Dispatcher.)
            //
            // We also need to ensure that the tree is homogenous with respect
            // to the dispatchers that the elements belong to.
            //
            this.VerifyAccess();
            if (newParent != null)
            {
                newParent.VerifyAccess();
            }

            // Logical Parent must first be dropped before you are attached to a newParent
            // This mitigates illegal tree state caused by logical child stealing as illustrated in bug 970706
            if (_parent != null && newParent != null && _parent != newParent)
            {
                throw new System.InvalidOperationException(SR.Get(SRID.HasLogicalParent));
            }

            // Trivial check to avoid loops
            if (newParent == this)
            {
                throw new System.InvalidOperationException(SR.Get(SRID.CannotBeSelfParent));
            }

            // Logical Parent implies no InheritanceContext
            if (newParent != null)
            {
                ClearInheritanceContext();
            }

            IsParentAnFE = newParent is FrameworkElement;

            DependencyObject oldParent = _parent;

            OnNewParent(newParent);

            // Update Has[Loaded/Unloaded]Handler Flags
            BroadcastEventHelper.AddOrRemoveHasLoadedChangeHandlerFlag(this, oldParent, newParent);



            ///////////////////
            // OnParentChanged:
            ///////////////////

            // Invalidate relevant properties for this subtree
            DependencyObject parent = (newParent != null) ? newParent : oldParent;

            TreeWalkHelper.InvalidateOnTreeChange(/* fe = */ this, /* fce = */ null, parent, (newParent != null));

            // If no one has called BeginInit then mark the element initialized and fire Initialized event
            // (non-parser programmatic tree building scenario)
            TryFireInitialized();
        }
コード例 #13
0
        internal void RegisterNameInternal(string name, object scopedElement)
        {
            FrameworkElement        fe;
            FrameworkContentElement fce;

            Helper.DowncastToFEorFCE(scopedElement as DependencyObject,
                                     out fe, out fce,
                                     false /*throwIfNeither*/);

            int childIndex;


            // First, though, do we actually have a templated parent?  If not,
            // then we'll just set the properties directly on the element
            // (this is the serialization scenario).

            if (_templatedParent == null)
            {
                if (_nameMap == null)
                {
                    _nameMap = new HybridDictionary();
                }

                _nameMap[name] = scopedElement;

                // No, we don't have a templated parent.  Loop through
                // the shared values (assuming this is an FE/FCE), and set them
                // directly onto the element.

                if (fe != null || fce != null)
                {
                    SetTemplateParentValues(name, scopedElement);
                }
            }

            // We have a templated parent, but is this not a FE/FCE?

            else if (fe == null && fce == null)
            {
                // All we need to do is update the _templatedNonFeChildren list

                Hashtable nonFeChildren = _templatedNonFeChildrenField.GetValue(_templatedParent);
                if (nonFeChildren == null)
                {
                    nonFeChildren = new Hashtable(1);
                    _templatedNonFeChildrenField.SetValue(_templatedParent, nonFeChildren);
                }

                nonFeChildren[name] = scopedElement;
            }

            // Otherwise, we need to hook this FE/FCE up to the template.

            else
            {
                // Update the list on the templated parent of the named FE/FCEs.

                _affectedChildren.Add(scopedElement as DependencyObject);

                // Update the TemplatedParent, IsTemplatedParentAnFE, and TemplateChildIndex.

                if (fe != null)
                {
                    fe._templatedParent      = _templatedParent;
                    fe.IsTemplatedParentAnFE = _isTemplatedParentAnFE;

                    childIndex = fe.TemplateChildIndex = (int)_frameworkTemplate.ChildIndexFromChildName[name];
                }
                else
                {
                    fce._templatedParent      = _templatedParent;
                    fce.IsTemplatedParentAnFE = _isTemplatedParentAnFE;
                    childIndex = fce.TemplateChildIndex = (int)_frameworkTemplate.ChildIndexFromChildName[name];
                }

                // Entries into the NameScope MUST match the location in the AffectedChildren list
                Debug.Assert(_affectedChildren.Count == childIndex);

                // Make updates for the Loaded/Unloaded event listeners (if they're set).

                HybridDictionary templateChildLoadedDictionary = _frameworkTemplate._TemplateChildLoadedDictionary;

                FrameworkTemplate.TemplateChildLoadedFlags templateChildLoadedFlags
                    = templateChildLoadedDictionary[childIndex] as FrameworkTemplate.TemplateChildLoadedFlags;

                if (templateChildLoadedFlags != null)
                {
                    if (templateChildLoadedFlags.HasLoadedChangedHandler || templateChildLoadedFlags.HasUnloadedChangedHandler)
                    {
                        BroadcastEventHelper.AddHasLoadedChangeHandlerFlagInAncestry((fe != null) ? (DependencyObject)fe : (DependencyObject)fce);
                    }
                }


                // Establish databinding instance data.

                StyleHelper.CreateInstanceDataForChild(
                    StyleHelper.TemplateDataField,
                    _templatedParent,
                    (fe != null) ? (DependencyObject)fe : (DependencyObject)fce,
                    childIndex,
                    _frameworkTemplate.HasInstanceValues,
                    ref _frameworkTemplate.ChildRecordFromChildIndex);
            }
        }
コード例 #14
0
        // Token: 0x06000691 RID: 1681 RVA: 0x00014908 File Offset: 0x00012B08
        internal DependencyObject InstantiateTree(UncommonField <HybridDictionary[]> dataField, DependencyObject container, DependencyObject parent, List <DependencyObject> affectedChildren, ref List <DependencyObject> noChildIndexChildren, ref FrugalStructList <ChildPropertyDependent> resourceDependents)
        {
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordXamlBaml, EventTrace.Level.Verbose, EventTrace.Event.WClientParseFefCrInstBegin);
            FrameworkElement frameworkElement = container as FrameworkElement;
            bool             flag             = frameworkElement != null;
            DependencyObject dependencyObject = null;

            if (this._text != null)
            {
                IAddChild addChild = parent as IAddChild;
                if (addChild == null)
                {
                    throw new InvalidOperationException(SR.Get("TypeMustImplementIAddChild", new object[]
                    {
                        parent.GetType().Name
                    }));
                }
                addChild.AddText(this._text);
            }
            else
            {
                dependencyObject = this.CreateDependencyObject();
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordXamlBaml, EventTrace.Level.Verbose, EventTrace.Event.WClientParseFefCrInstEnd);
                FrameworkObject frameworkObject = new FrameworkObject(dependencyObject);
                Visual3D        visual3D        = null;
                bool            flag2           = false;
                if (!frameworkObject.IsValid)
                {
                    visual3D = (dependencyObject as Visual3D);
                    if (visual3D != null)
                    {
                        flag2 = true;
                    }
                }
                bool isFE = frameworkObject.IsFE;
                if (!flag2)
                {
                    FrameworkElementFactory.NewNodeBeginInit(isFE, frameworkObject.FE, frameworkObject.FCE);
                    if (StyleHelper.HasResourceDependentsForChild(this._childIndex, ref resourceDependents))
                    {
                        frameworkObject.HasResourceReference = true;
                    }
                    FrameworkElementFactory.UpdateChildChains(this._childName, this._childIndex, isFE, frameworkObject.FE, frameworkObject.FCE, affectedChildren, ref noChildIndexChildren);
                    FrameworkElementFactory.NewNodeStyledParentProperty(container, flag, isFE, frameworkObject.FE, frameworkObject.FCE);
                    if (this._childIndex != -1)
                    {
                        StyleHelper.CreateInstanceDataForChild(dataField, container, dependencyObject, this._childIndex, this._frameworkTemplate.HasInstanceValues, ref this._frameworkTemplate.ChildRecordFromChildIndex);
                    }
                    if (this.HasLoadedChangeHandler)
                    {
                        BroadcastEventHelper.AddHasLoadedChangeHandlerFlagInAncestry(dependencyObject);
                    }
                }
                else if (this._childName != null)
                {
                    affectedChildren.Add(dependencyObject);
                }
                else
                {
                    if (noChildIndexChildren == null)
                    {
                        noChildIndexChildren = new List <DependencyObject>(4);
                    }
                    noChildIndexChildren.Add(dependencyObject);
                }
                if (container == parent)
                {
                    TemplateNameScope value = new TemplateNameScope(container);
                    NameScope.SetNameScope(dependencyObject, value);
                    if (flag)
                    {
                        frameworkElement.TemplateChild = frameworkObject.FE;
                    }
                    else
                    {
                        FrameworkElementFactory.AddNodeToLogicalTree((FrameworkContentElement)parent, this._type, isFE, frameworkObject.FE, frameworkObject.FCE);
                    }
                }
                else
                {
                    this.AddNodeToParent(parent, frameworkObject);
                }
                if (!flag2)
                {
                    StyleHelper.InvalidatePropertiesOnTemplateNode(container, frameworkObject, this._childIndex, ref this._frameworkTemplate.ChildRecordFromChildIndex, false, this);
                }
                else
                {
                    for (int i = 0; i < this.PropertyValues.Count; i++)
                    {
                        if (this.PropertyValues[i].ValueType != PropertyValueType.Set)
                        {
                            throw new NotSupportedException(SR.Get("Template3DValueOnly", new object[]
                            {
                                this.PropertyValues[i].Property
                            }));
                        }
                        object    obj       = this.PropertyValues[i].ValueInternal;
                        Freezable freezable = obj as Freezable;
                        if (freezable != null && !freezable.CanFreeze)
                        {
                            obj = freezable.Clone();
                        }
                        MarkupExtension markupExtension = obj as MarkupExtension;
                        if (markupExtension != null)
                        {
                            ProvideValueServiceProvider provideValueServiceProvider = new ProvideValueServiceProvider();
                            provideValueServiceProvider.SetData(visual3D, this.PropertyValues[i].Property);
                            obj = markupExtension.ProvideValue(provideValueServiceProvider);
                        }
                        visual3D.SetValue(this.PropertyValues[i].Property, obj);
                    }
                }
                for (FrameworkElementFactory frameworkElementFactory = this._firstChild; frameworkElementFactory != null; frameworkElementFactory = frameworkElementFactory._nextSibling)
                {
                    frameworkElementFactory.InstantiateTree(dataField, container, dependencyObject, affectedChildren, ref noChildIndexChildren, ref resourceDependents);
                }
                if (!flag2)
                {
                    FrameworkElementFactory.NewNodeEndInit(isFE, frameworkObject.FE, frameworkObject.FCE);
                }
            }
            return(dependencyObject);
        }
コード例 #15
0
        // 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);
        }
コード例 #16
0
        // Token: 0x06000318 RID: 792 RVA: 0x00008B80 File Offset: 0x00006D80
        private static void UpdateHasLoadedChangeHandlerFlagInAncestry(DependencyObject d, bool addHandler)
        {
            FrameworkObject frameworkObject = new FrameworkObject(d);

            if (!addHandler && BroadcastEventHelper.AreThereLoadedChangeHandlersInSubtree(ref frameworkObject))
            {
                return;
            }
            if (frameworkObject.IsValid)
            {
                if (frameworkObject.SubtreeHasLoadedChangeHandler != addHandler)
                {
                    DependencyObject dependencyObject  = frameworkObject.IsFE ? VisualTreeHelper.GetParent(frameworkObject.FE) : null;
                    DependencyObject parent            = frameworkObject.Parent;
                    DependencyObject dependencyObject2 = null;
                    frameworkObject.SubtreeHasLoadedChangeHandler = addHandler;
                    if (dependencyObject != null)
                    {
                        BroadcastEventHelper.UpdateHasLoadedChangeHandlerFlagInAncestry(dependencyObject, addHandler);
                        dependencyObject2 = dependencyObject;
                    }
                    if (parent != null && parent != dependencyObject)
                    {
                        BroadcastEventHelper.UpdateHasLoadedChangeHandlerFlagInAncestry(parent, addHandler);
                        if (frameworkObject.IsFCE)
                        {
                            dependencyObject2 = parent;
                        }
                    }
                    if (parent == null && dependencyObject == null)
                    {
                        dependencyObject2 = Helper.FindMentor(frameworkObject.DO.InheritanceContext);
                        if (dependencyObject2 != null)
                        {
                            frameworkObject.ChangeSubtreeHasLoadedChangedHandler(dependencyObject2);
                        }
                    }
                    if (addHandler)
                    {
                        if (frameworkObject.IsFE)
                        {
                            BroadcastEventHelper.UpdateIsLoadedCache(frameworkObject.FE, dependencyObject2);
                            return;
                        }
                        BroadcastEventHelper.UpdateIsLoadedCache(frameworkObject.FCE, dependencyObject2);
                        return;
                    }
                }
            }
            else
            {
                DependencyObject dependencyObject3 = null;
                Visual           reference;
                ContentElement   reference2;
                Visual3D         reference3;
                if ((reference = (d as Visual)) != null)
                {
                    dependencyObject3 = VisualTreeHelper.GetParent(reference);
                }
                else if ((reference2 = (d as ContentElement)) != null)
                {
                    dependencyObject3 = ContentOperations.GetParent(reference2);
                }
                else if ((reference3 = (d as Visual3D)) != null)
                {
                    dependencyObject3 = VisualTreeHelper.GetParent(reference3);
                }
                if (dependencyObject3 != null)
                {
                    BroadcastEventHelper.UpdateHasLoadedChangeHandlerFlagInAncestry(dependencyObject3, addHandler);
                }
            }
        }
コード例 #17
0
 // Token: 0x06000316 RID: 790 RVA: 0x00008AA9 File Offset: 0x00006CA9
 internal static void RemoveHasLoadedChangeHandlerFlagInAncestry(DependencyObject d)
 {
     BroadcastEventHelper.UpdateHasLoadedChangeHandlerFlagInAncestry(d, false);
 }