private bool GetFirstNamedFrameNamed(IFocusNamedFrame root, string propertyName, ref int valueFrameIndex, out IFocusNamedFrame frame)
        {
            frame = null;

            valueFrameIndex++;

            if (root.PropertyName == propertyName)
            {
                frame = root;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        private protected bool GetFirstNamedFrame(IFocusFrame root, string propertyName, IList <IFocusFrameSelectorList> selectorStack, bool reverseSearch, ref int valueFrameIndex, out IFocusNamedFrame frame)
        {
            frame = null;
            bool Found = false;

            if (root is IFocusNamedFrame AsNamedFrame)
            {
                valueFrameIndex++;

                if (AsNamedFrame.PropertyName == propertyName)
                {
                    frame = AsNamedFrame;
                    Found = true;
                }
            }

            if (root is IFocusPanelFrame AsPanelFrame)
            {
                int Count = AsPanelFrame.Items.Count;
                for (int i = 0; i < Count; i++)
                {
                    IFocusFrame Item = AsPanelFrame.Items[reverseSearch ? Count - 1 - i : i];

                    if (GetFirstNamedFrame(Item, propertyName, selectorStack, reverseSearch, ref valueFrameIndex, out frame))
                    {
                        Found = true;
                        break;
                    }
                }
            }

            else if (root is IFocusSelectionFrame AsSelectionFrame)
            {
                IFocusSelectableFrame SelectedFrame = null;

                foreach (IFocusSelectableFrame Item in AsSelectionFrame.Items)
                {
                    foreach (IFocusFrameSelectorList SelectorList in selectorStack)
                    {
                        foreach (IFocusFrameSelector Selector in SelectorList)
                        {
                            if (Selector.SelectorType == NodeType)
                            {
                                if (Selector.SelectorName == Item.Name)
                                {
                                    SelectedFrame = Item;
                                    break;
                                }
                            }
                        }
                        if (SelectedFrame != null)
                        {
                            break;
                        }
                    }
                    if (SelectedFrame != null)
                    {
                        break;
                    }
                }

                if (SelectedFrame != null)
                {
                    if (GetFirstNamedFrame(SelectedFrame.Content, propertyName, selectorStack, reverseSearch, ref valueFrameIndex, out frame))
                    {
                        Found = true;
                    }
                }
            }

            return(Found);
        }
        private bool GetFirstNamedFrameSelection(IFocusSelectionFrame root, string propertyName, IList <FocusFrameSelectorList> selectorStack, bool reverseSearch, ref int valueFrameIndex, out IFocusNamedFrame frame)
        {
            frame = null;

            IFocusSelectableFrame SelectedFrame = null;

            foreach (IFocusSelectableFrame Item in root.Items)
            {
                foreach (FocusFrameSelectorList SelectorList in selectorStack)
                {
                    foreach (IFocusFrameSelector Selector in SelectorList)
                    {
                        if (Selector.SelectorType == NodeType)
                        {
                            if (Selector.SelectorName == Item.Name)
                            {
                                SelectedFrame = Item;
                                break;
                            }
                        }
                    }
                    if (SelectedFrame != null)
                    {
                        break;
                    }
                }
                if (SelectedFrame != null)
                {
                    break;
                }
            }

            if (SelectedFrame != null)
            {
                if (GetFirstNamedFrame(SelectedFrame.Content, propertyName, selectorStack, reverseSearch, ref valueFrameIndex, out frame))
                {
                    return(true);
                }
            }

            return(false);
        }
        private bool GetFirstNamedFramePanel(IFocusPanelFrame root, string propertyName, IList <FocusFrameSelectorList> selectorStack, bool reverseSearch, ref int valueFrameIndex, out IFocusNamedFrame frame)
        {
            frame = null;

            int Count = root.Items.Count;

            for (int i = 0; i < Count; i++)
            {
                IFocusFrame Item = (IFocusFrame)root.Items[reverseSearch ? Count - 1 - i : i];

                if (GetFirstNamedFrame(Item, propertyName, selectorStack, reverseSearch, ref valueFrameIndex, out frame))
                {
                    return(true);
                }
            }

            return(false);
        }
        private protected bool GetFirstNamedFrame(IFocusFrame root, string propertyName, IList <FocusFrameSelectorList> selectorStack, bool reverseSearch, ref int valueFrameIndex, out IFocusNamedFrame frame)
        {
            frame = null;
            bool Found = false;

            switch (root)
            {
            case IFocusNamedFrame AsNamedFrame:
                Found = GetFirstNamedFrameNamed(AsNamedFrame, propertyName, ref valueFrameIndex, out frame);
                break;

            case IFocusPanelFrame AsPanelFrame:
                Found = GetFirstNamedFramePanel(AsPanelFrame, propertyName, selectorStack, reverseSearch, ref valueFrameIndex, out frame);
                break;

            case IFocusSelectionFrame AsSelectionFrame:
                Found = GetFirstNamedFrameSelection(AsSelectionFrame, propertyName, selectorStack, reverseSearch, ref valueFrameIndex, out frame);
                break;
            }

            return(Found);
        }