AddCommand() 공개 메소드

public AddCommand ( Command command ) : void
command Command
리턴 void
예제 #1
0
        private void EndDrag(PointerEventInfo info, ILevelGeometry viewport)
        {
            Rectangle selection = ClampSelection(_band.Selection);

            CompoundCommand command = new CompoundCommand();

            if (_mergeAction == MergeAction.New || !_selectLayer.HasSelection || _selectLayer.TileSelection.Floating)
                ResetSelection(command);

            switch (_mergeAction) {
                case MergeAction.New:
                    ModifyNewTileSelectionCommand newCommand = new ModifyNewTileSelectionCommand(_selectLayer);
                    newCommand.AddLocations(TileCoordsFromRegion(selection));
                    command.AddCommand(newCommand);
                    break;
                case MergeAction.Add:
                    ModifyAddTileSelectionCommand addCommand = new ModifyAddTileSelectionCommand(_selectLayer);
                    addCommand.AddLocations(TileCoordsFromRegion(selection));
                    command.AddCommand(addCommand);
                    break;
                case MergeAction.Remove:
                    ModifyRemoveTileSelectionCommand removeCommand = new ModifyRemoveTileSelectionCommand(_selectLayer);
                    removeCommand.AddLocations(TileCoordsFromRegion(selection));
                    command.AddCommand(removeCommand);
                    break;
            }

            if (command.Count > 0)
                History.Execute(command);

            _annots.Remove(_selectionAnnot);
            _action = UpdateAction.None;

            EndAutoScroll(info, viewport);
        }
예제 #2
0
        private void ResetSelection(CompoundCommand command)
        {
            if (_selectLayer.HasSelection) {
                if (_selectLayer.TileSelection.Floating)
                    command.AddCommand(new DefloatTileSelectionCommand(Layer, _selectLayer));
                command.AddCommand(new DeleteTileSelectionCommand(_selectLayer));
            }

            command.AddCommand(new CreateTileSelectionCommand(_selectLayer));
        }
예제 #3
0
        private void DefloatSelection()
        {
            if (_selectLayer == null || _selectLayer.TileSelection == null)
                return;

            CompoundCommand command = new CompoundCommand();
            if (_selectLayer.TileSelection.Floating)
                command.AddCommand(new DefloatTileSelectionCommand(Layer, _selectLayer));
            command.AddCommand(new DeleteTileSelectionCommand(_selectLayer));
            History.Execute(command);
        }