示例#1
0
        /// <summary>
        /// Gets the frame that creates cells associated to a comment in a state.
        /// This overload uses selectors to choose the correct frame.
        /// </summary>
        /// <param name="state">The state.</param>
        /// <param name="selectorStack">A list of selectors to choose the correct frame.</param>
        public virtual IFocusCommentFrame GetCommentFrame(IFocusNodeState state, IList <IFocusFrameSelectorList> selectorStack)
        {
            Type OwnerType              = state.Node.GetType();
            Type InterfaceType          = NodeTreeHelper.NodeTypeToInterfaceType(OwnerType);
            IFocusNodeTemplate Template = (IFocusNodeTemplate)NodeTypeToTemplate(InterfaceType);
            IFocusCommentFrame Frame    = Template.GetCommentFrame(selectorStack);

            return(Frame);
        }
示例#2
0
        private protected virtual bool GetFirstCommentFrame(IFocusFrame root, IList <IFocusFrameSelectorList> selectorStack, out IFocusCommentFrame frame)
        {
            bool Found = false;

            frame = null;

            if (root is IFocusCommentFrame AsCommentFrame)
            {
                frame = AsCommentFrame;
                Found = true;
            }

            if (!Found && root is IFocusPanelFrame AsPanelFrame)
            {
                foreach (IFocusFrame Item in AsPanelFrame.Items)
                {
                    if (GetFirstCommentFrame(Item, selectorStack, 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 (GetFirstCommentFrame(SelectedFrame.Content, selectorStack, out frame))
                    {
                        Found = true;
                    }
                }
            }

            return(Found);
        }
        private bool GetFirstCommentFrameSelection(IFocusSelectionFrame root, IList <FocusFrameSelectorList> selectorStack, out IFocusCommentFrame 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 (GetFirstCommentFrame(SelectedFrame.Content, selectorStack, out frame))
                {
                    return(true);
                }
            }

            return(false);
        }
        private bool GetFirstCommentFramePanel(IFocusPanelFrame root, IList <FocusFrameSelectorList> selectorStack, out IFocusCommentFrame frame)
        {
            frame = null;

            foreach (IFocusFrame Item in root.Items)
            {
                if (GetFirstCommentFrame(Item, selectorStack, out frame))
                {
                    return(true);
                }
            }

            return(false);
        }
 private bool GetFirstCommentFrameComment(IFocusCommentFrame root, out IFocusCommentFrame frame)
 {
     frame = root;
     return(true);
 }
        private protected virtual bool GetFirstCommentFrame(IFocusFrame root, IList <FocusFrameSelectorList> selectorStack, out IFocusCommentFrame frame)
        {
            bool Found = false;

            frame = null;

            switch (root)
            {
            case IFocusCommentFrame AsCommentFrame:
                Found = GetFirstCommentFrameComment(AsCommentFrame, out frame);
                break;

            case IFocusPanelFrame AsPanelFrame:
                Found = GetFirstCommentFramePanel(AsPanelFrame, selectorStack, out frame);
                break;

            case IFocusSelectionFrame AsSelectionFrame:
                Found = GetFirstCommentFrameSelection(AsSelectionFrame, selectorStack, out frame);
                break;
            }

            return(Found);
        }