/// <summary></summary>
        protected virtual void PasteNode(INode node, out bool isChanged)
        {
            isChanged = false;

            IFocusControllerView ControllerView = StateView.ControllerView;

            if (ControllerView.Focus is IFocusTextFocus AsTextFocus)
            {
                IFocusNodeState State = AsTextFocus.CellView.StateView.State;
                if (State.Node.GetType().IsAssignableFrom(node.GetType()))
                {
                    if (State.ParentIndex is IFocusBrowsingInsertableIndex AsInsertableIndex)
                    {
                        IFocusController Controller = StateView.ControllerView.Controller;
                        INode            ParentNode = State.ParentInner.Owner.Node;

                        IFocusInsertionChildIndex ReplaceIndex = (IFocusInsertionChildIndex)AsInsertableIndex.ToInsertionIndex(ParentNode, node);
                        Controller.Replace(State.ParentInner, ReplaceIndex, out IWriteableBrowsingChildIndex NewIndex);

                        isChanged = true;
                    }
                }
            }
        }
        /// <summary></summary>
        protected virtual void PasteNodeList(IList <INode> nodeList, out bool isChanged)
        {
            isChanged = false;

            IFocusControllerView ControllerView = StateView.ControllerView;

            if (ControllerView.Focus is IFocusTextFocus AsTextFocus)
            {
                IFocusNodeState State        = AsTextFocus.CellView.StateView.State;
                IFocusNodeState ParentState  = State;
                bool            IsAssignable = false;

                while (!IsAssignable && ParentState != null)
                {
                    State = ParentState;

                    if (State.ParentInner is IFocusCollectionInner AsCollectionInner && (nodeList.Count == 0 || AsCollectionInner.InterfaceType.IsAssignableFrom(nodeList[0].GetType())))
                    {
                        IsAssignable = true;
                    }

                    ParentState = State.ParentState;
                }

                if (IsAssignable)
                {
                    if (State.ParentInner is IFocusListInner AsListInner && State.ParentIndex is IFocusBrowsingListNodeIndex AsListNodeIndex)
                    {
                        PasteNodeListToList(nodeList, AsListInner, AsListNodeIndex, out isChanged);
                    }
                    else if (State.ParentInner is IFocusBlockListInner AsBlockListInner && State.ParentIndex is IFocusBrowsingExistingBlockNodeIndex AsExistingBlockNodeIndex)
                    {
                        PasteNodeListToBlockList(nodeList, AsBlockListInner, AsExistingBlockNodeIndex, out isChanged);
                    }
                }
            }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FocusSourceStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="state">The source state.</param>
 public FocusSourceStateView(IFocusControllerView controllerView, IFocusSourceState state)
     : base(controllerView, state)
 {
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FocusBlockStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="blockState">The block state.</param>
 public FocusBlockStateView(IFocusControllerView controllerView, IFocusBlockState blockState)
     : base(controllerView, blockState)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FocusPatternStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="state">The pattern state.</param>
 public FocusPatternStateView(IFocusControllerView controllerView, IFocusPatternState state)
     : base(controllerView, state)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FocusPlaceholderNodeStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="state">The child node state.</param>
 public FocusPlaceholderNodeStateView(IFocusControllerView controllerView, IFocusPlaceholderNodeState state)
     : base(controllerView, state)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FocusOptionalNodeStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="state">The optional node state.</param>
 public FocusOptionalNodeStateView(IFocusControllerView controllerView, IFocusOptionalNodeState state)
     : base(controllerView, state)
 {
 }