Exemple #1
0
        // Token: 0x06007C12 RID: 31762 RVA: 0x0022E560 File Offset: 0x0022C760
        private bool ResolveLocatorPart(DependencyObject dependencyObject, LocatorManager.ResolvingLocatorState data, bool visitedViaVisualTree)
        {
            if (data.Finished)
            {
                return(false);
            }
            ContentLocator     contentLocatorBase = data.ContentLocatorBase;
            bool               result             = true;
            ContentLocatorPart contentLocatorPart = contentLocatorBase.Parts[data.LocatorPartIndex];

            if (contentLocatorPart == null)
            {
                result = false;
            }
            SubTreeProcessor subTreeProcessorForLocatorPart = this.GetSubTreeProcessorForLocatorPart(contentLocatorPart);

            if (subTreeProcessorForLocatorPart == null)
            {
                result = false;
            }
            if (contentLocatorPart != null && subTreeProcessorForLocatorPart != null)
            {
                DependencyObject dependencyObject2 = subTreeProcessorForLocatorPart.ResolveLocatorPart(contentLocatorPart, dependencyObject, out result);
                if (dependencyObject2 != null)
                {
                    data.AttachmentLevel = AttachmentLevel.Incomplete;
                    data.AttachedAnchor  = dependencyObject2;
                    result = true;
                    data.LastNodeMatched = dependencyObject2;
                    data.LocatorPartIndex++;
                    if (data.LocatorPartIndex == contentLocatorBase.Parts.Count)
                    {
                        data.AttachmentLevel = AttachmentLevel.Full;
                        data.AttachedAnchor  = dependencyObject2;
                        result = false;
                    }
                    else if (data.LocatorPartIndex == contentLocatorBase.Parts.Count - 1)
                    {
                        contentLocatorPart = contentLocatorBase.Parts[data.LocatorPartIndex];
                        SelectionProcessor selectionProcessorForLocatorPart = this.GetSelectionProcessorForLocatorPart(contentLocatorPart);
                        if (selectionProcessorForLocatorPart != null)
                        {
                            AttachmentLevel attachmentLevel;
                            object          obj = selectionProcessorForLocatorPart.ResolveLocatorPart(contentLocatorPart, dependencyObject2, out attachmentLevel);
                            if (obj != null)
                            {
                                data.AttachmentLevel = attachmentLevel;
                                data.AttachedAnchor  = obj;
                                result = false;
                            }
                            else
                            {
                                result = false;
                            }
                        }
                    }
                }
            }
            return(result);
        }
Exemple #2
0
 // Token: 0x06007C13 RID: 31763 RVA: 0x0022E677 File Offset: 0x0022C877
 private bool TerminateResolve(DependencyObject dependencyObject, LocatorManager.ResolvingLocatorState data, bool visitedViaVisualTree)
 {
     if (!data.Finished && data.LastNodeMatched == dependencyObject)
     {
         data.Finished = true;
     }
     return(false);
 }
Exemple #3
0
        // Token: 0x06007C11 RID: 31761 RVA: 0x0022E4B0 File Offset: 0x0022C6B0
        private LocatorManager.ResolvingLocatorState ResolveSingleLocator(ref object selection, ref AttachmentLevel attachmentLevel, AttachmentLevel attemptedLevel, ContentLocator locator, int offset, DependencyObject startNode, bool skipStartNode)
        {
            LocatorManager.ResolvingLocatorState resolvingLocatorState = new LocatorManager.ResolvingLocatorState();
            resolvingLocatorState.LocatorPartIndex   = offset;
            resolvingLocatorState.ContentLocatorBase = locator;
            PrePostDescendentsWalker <LocatorManager.ResolvingLocatorState> prePostDescendentsWalker = new PrePostDescendentsWalker <LocatorManager.ResolvingLocatorState>(TreeWalkPriority.VisualTree, new VisitedCallback <LocatorManager.ResolvingLocatorState>(this.ResolveLocatorPart), new VisitedCallback <LocatorManager.ResolvingLocatorState>(this.TerminateResolve), resolvingLocatorState);

            prePostDescendentsWalker.StartWalk(startNode, skipStartNode);
            if (resolvingLocatorState.AttachmentLevel == AttachmentLevel.Full && resolvingLocatorState.AttachedAnchor != null)
            {
                if (selection != null)
                {
                    SelectionProcessor selectionProcessor = this.GetSelectionProcessor(selection.GetType());
                    if (selectionProcessor != null)
                    {
                        object obj;
                        if (selectionProcessor.MergeSelections(selection, resolvingLocatorState.AttachedAnchor, out obj))
                        {
                            selection = obj;
                        }
                        else
                        {
                            attachmentLevel &= ~attemptedLevel;
                        }
                    }
                    else
                    {
                        attachmentLevel &= ~attemptedLevel;
                    }
                }
                else
                {
                    selection = resolvingLocatorState.AttachedAnchor;
                }
            }
            else
            {
                attachmentLevel &= ~attemptedLevel;
            }
            return(resolvingLocatorState);
        }
Exemple #4
0
        // Token: 0x06007C10 RID: 31760 RVA: 0x0022E31C File Offset: 0x0022C51C
        private object InternalResolveLocator(ContentLocatorBase locator, int offset, DependencyObject startNode, bool skipStartNode, out AttachmentLevel attachmentLevel)
        {
            attachmentLevel = AttachmentLevel.Full;
            object result = null;
            ContentLocatorGroup contentLocatorGroup = locator as ContentLocatorGroup;
            ContentLocator      contentLocator      = locator as ContentLocator;
            AttachmentLevel     attachmentLevel2    = AttachmentLevel.Unresolved;

            if (contentLocator != null && offset == contentLocator.Parts.Count - 1)
            {
                ContentLocatorPart locatorPart = contentLocator.Parts[offset];
                SelectionProcessor selectionProcessorForLocatorPart = this.GetSelectionProcessorForLocatorPart(locatorPart);
                if (selectionProcessorForLocatorPart != null)
                {
                    result          = selectionProcessorForLocatorPart.ResolveLocatorPart(locatorPart, startNode, out attachmentLevel2);
                    attachmentLevel = attachmentLevel2;
                    return(result);
                }
            }
            IList <ContentLocator> list;

            if (contentLocatorGroup == null)
            {
                list = new List <ContentLocator>(1);
                list.Add(contentLocator);
            }
            else
            {
                AnnotationService service = AnnotationService.GetService(startNode);
                if (service != null)
                {
                    startNode = service.Root;
                }
                list          = contentLocatorGroup.Locators;
                offset        = 0;
                skipStartNode = false;
            }
            bool flag = true;

            if (list.Count > 0)
            {
                LocatorManager.ResolvingLocatorState resolvingLocatorState = this.ResolveSingleLocator(ref result, ref attachmentLevel, AttachmentLevel.StartPortion, list[0], offset, startNode, skipStartNode);
                if (list.Count == 1)
                {
                    result          = resolvingLocatorState.AttachedAnchor;
                    attachmentLevel = resolvingLocatorState.AttachmentLevel;
                }
                else
                {
                    if (list.Count > 2)
                    {
                        AttachmentLevel attachmentLevel3 = AttachmentLevel.Unresolved;
                        AttachmentLevel attachmentLevel4 = attachmentLevel;
                        for (int i = 1; i < list.Count - 1; i++)
                        {
                            resolvingLocatorState = this.ResolveSingleLocator(ref result, ref attachmentLevel, AttachmentLevel.MiddlePortion, list[i], offset, startNode, skipStartNode);
                            if (attachmentLevel3 == AttachmentLevel.Unresolved || (attachmentLevel & AttachmentLevel.MiddlePortion) != AttachmentLevel.Unresolved)
                            {
                                attachmentLevel3 = attachmentLevel;
                            }
                            attachmentLevel = attachmentLevel4;
                        }
                        attachmentLevel = attachmentLevel3;
                    }
                    else
                    {
                        flag = false;
                    }
                    resolvingLocatorState = this.ResolveSingleLocator(ref result, ref attachmentLevel, AttachmentLevel.EndPortion, list[list.Count - 1], offset, startNode, skipStartNode);
                    if (!flag && attachmentLevel == AttachmentLevel.MiddlePortion)
                    {
                        attachmentLevel &= ~AttachmentLevel.MiddlePortion;
                    }
                    if (attachmentLevel == (AttachmentLevel.StartPortion | AttachmentLevel.EndPortion))
                    {
                        attachmentLevel = AttachmentLevel.Full;
                    }
                }
            }
            else
            {
                attachmentLevel = AttachmentLevel.Unresolved;
            }
            return(result);
        }