Exemplo n.º 1
0
        private void UnGroupObject_Click(object sender, EventArgs e)
        {
            UnGroupCommand command = new UnGroupCommand((DiagramToolkit.Api.Shapes.Rectangle)curCanvas.getActiveObject());

            command.UnExecute();
            undoRedo.InsertCommand(command);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles UI buttons and activates the command pattern
        /// </summary>
        private async void UserActionClick(object sender, RoutedEventArgs e)
        {
            if (sender is AppBarButton button)
            {
                IUserActionCommand cmd = null;

                switch (button.Name)
                {
                case "OpenButton":
                    cmd = new OpenFileCommand(this);
                    break;

                case "SaveButton":
                    cmd = new SaveFileCommand();
                    break;

                case "RedoButton":
                    cmd = new RedoCommand(this);
                    break;

                case "UndoButton":
                    cmd = new UndoCommand(this);
                    break;

                case "GroupButton":
                    cmd = new GroupCommand(this);
                    break;

                case "UnGroupButton":
                    cmd = new UnGroupCommand(this);
                    break;

                case "DeleteButton":
                    cmd = new DeleteItemCommand(this);
                    break;
                }

                if (cmd != null)
                {
                    cmd.RedoStack = _redoStack;
                    cmd.UndoStack = _undoStack;
                    cmd.ShapeList = _shapeList;

                    await _userInvoker.InvokeUserActionAsync(cmd);
                }
            }
        }