Ejemplo n.º 1
0
        internal List <UndoRedoManager.RemoveCommand> Remove(bool isRegUndoRedo, bool isGetUndoredo)
        {
            List <UndoRedoManager.RemoveCommand> commands = null;

            if (!IsRemove)
            {
                return(commands);
            }
            IsRomoving = true;
            ViewItem fi = null;

            if (FocusItem != null)
            {
                for (int i = FocusItem.Index - 1; i >= 0; i--)
                {
                    if (ItemsCollection.GetViewItem(i) is ViewItem item && !item.Selected)
                    {
                        fi = item;
                        break;
                    }
                }
            }
            commands = ItemsCollection.Remove(GetSelectList <object>(out int level), isRegUndoRedo || isGetUndoredo) as List <UndoRedoManager.RemoveCommand>;
            int sindex = fi == null ? 0 : fi.Index + 1;

            if (commands != null && isRegUndoRedo)
            {
                UndoRedoManager.RegistredNewCommand(commands);
            }
            SetFocus(sindex);
            IsRomoving = false;
            return(commands);
        }