Borodar.ReorderableList.ReorderableListControl.HandleCommand C# (CSharp) Метод

HandleCommand() защищенный Метод

Invoked to handle context command.

It is important to set the value of GUI.changed to true if any changes are made by command handler.

Default command handling functionality can be inherited:

protected HandleCommand ( string commandName, int itemIndex, IReorderableListAdaptor adaptor ) : bool
commandName string Name of command. This is the text shown in the context menu.
itemIndex int Zero-based index of item which was right-clicked.
adaptor IReorderableListAdaptor Reorderable list adaptor.
Результат bool
        protected virtual bool HandleCommand(string commandName, int itemIndex, IReorderableListAdaptor adaptor)
        {
            switch (commandName) {
                case "Move to Top":
                    MoveItem(adaptor, itemIndex, 0);
                    return true;
                case "Move to Bottom":
                    MoveItem(adaptor, itemIndex, adaptor.Count);
                    return true;

                case "Insert Above":
                    InsertItem(adaptor, itemIndex);
                    return true;
                case "Insert Below":
                    InsertItem(adaptor, itemIndex + 1);
                    return true;
                case "Duplicate":
                    DuplicateItem(adaptor, itemIndex);
                    return true;

                case "Remove":
                    RemoveItem(adaptor, itemIndex);
                    return true;
                case "Clear All":
                    ClearAll(adaptor);
                    return true;

                default:
                    return false;
            }
        }