Exemplo n.º 1
0
        private protected virtual bool IsExtremumCheckParent(IFocusNodeState state, IFocusContentFocusableCellView cellView, System.Func <IFocusNodeState, IFocusContentFocusableCellView, bool> isGoodFocusableCellView, System.Func <int, int> getInsertPosition, out IFocusCollectionInner inner, out IFocusInsertionCollectionNodeIndex index)
        {
            inner = null;
            index = null;
            bool Result = false;

            IFocusNodeState ParentState = state.ParentState;

            if (ParentState != null && isGoodFocusableCellView(state, cellView))
            {
                Result = IsListExtremumItem(ParentState, cellView, isGoodFocusableCellView, getInsertPosition, out inner, out index);
            }

            return(Result);
        }
Exemplo n.º 2
0
        private protected virtual bool IsLastFocusableCellView(IFocusNodeState state, IFocusContentFocusableCellView cellView)
        {
            Debug.Assert(StateViewTable.ContainsKey(state));

            IFocusNodeStateView StateView = (IFocusNodeStateView)StateViewTable[state];

            StateView.RootCellView.EnumerateVisibleCellViews(GetLastFocusable, out IFrameVisibleCellView FirstCellView, reversed: true);
            return(FirstCellView == cellView);
        }
Exemplo n.º 3
0
        private protected virtual bool IsListExtremumItem(IFocusNodeState state, IFocusContentFocusableCellView cellView, System.Func <IFocusNodeState, IFocusContentFocusableCellView, bool> isGoodFocusableCellView, System.Func <int, int> getInsertPosition, out IFocusCollectionInner inner, out IFocusInsertionCollectionNodeIndex index)
        {
            inner = null;
            index = null;

            IFocusInner ParentInner = state.ParentInner;

            if (ParentInner == null)
            {
                return(false);
            }

            Node NewItem;
            int  BlockPosition;
            int  ItemPosition;
            bool IsHandled = false;
            bool Result    = false;

            switch (ParentInner)
            {
            case IFocusPlaceholderInner AsPlaceholderInner:
            case IFocusOptionalInner AsOptionalInner:
                Result    = IsExtremumCheckParent(state, cellView, isGoodFocusableCellView, getInsertPosition, out inner, out index);
                IsHandled = true;
                break;

            // Check the parent state if there is a deeper list (typically, for a qualified name, there would be one).
            case IFocusListInner AsListInner:
                if (IsDeepestList(state))
                {
                    NewItem      = NodeHelper.CreateDefaultFromType(AsListInner.InterfaceType);
                    ItemPosition = (state.ParentIndex as IFocusBrowsingListNodeIndex).Index;

                    inner = AsListInner;
                    index = CreateListNodeIndex(inner.Owner.Node, inner.PropertyName, NewItem, getInsertPosition(ItemPosition));

                    Result = true;
                }
                else
                {
                    Result = IsExtremumCheckParent(state, cellView, isGoodFocusableCellView, getInsertPosition, out inner, out index);
                }
                IsHandled = true;
                break;

            case IFocusBlockListInner AsBlockListInner:
                NewItem       = NodeHelper.CreateDefaultFromType(AsBlockListInner.InterfaceType);
                BlockPosition = (state.ParentIndex as IFocusBrowsingExistingBlockNodeIndex).BlockIndex;
                ItemPosition  = (state.ParentIndex as IFocusBrowsingExistingBlockNodeIndex).Index;

                inner = AsBlockListInner;
                index = CreateExistingBlockNodeIndex(inner.Owner.Node, inner.PropertyName, NewItem, BlockPosition, getInsertPosition(ItemPosition));

                Result    = true;
                IsHandled = true;
                break;
            }

            Debug.Assert(IsHandled);

            return(Result);
        }