Beispiel #1
0
        void OnModelCommandCompleted(DynamoModel.RecordableCommand command)
        {
            var name = command.GetType().Name;

            switch (name)
            {
            case "OpenFileCommand":
                this.AddToRecentFiles((command as DynamoModel.OpenFileCommand).XmlFilePath);
                this.VisualizationManager.UnPause();
                break;

            case "MutateTestCommand":
                var mutatorDriver = new Dynamo.TestInfrastructure.MutatorDriver(this);
                mutatorDriver.RunMutationTests();
                break;

            case "SelectInRegionCommand":
                var selectC = command as DynamoModel.SelectInRegionCommand;
                CurrentSpaceViewModel.SelectInRegion(selectC.Region, selectC.IsCrossSelection);
                break;

            case "DragSelectionCommand":
                var dragC = command as DynamoModel.DragSelectionCommand;

                if (DynamoModel.DragSelectionCommand.Operation.BeginDrag == dragC.DragOperation)
                {
                    CurrentSpaceViewModel.BeginDragSelection(dragC.MouseCursor);
                }
                else
                {
                    CurrentSpaceViewModel.EndDragSelection(dragC.MouseCursor);
                }
                break;

            case "DeleteModelCommand":
            case "CreateNodeCommand":
            case "CreateNoteCommand":
            case "UndoRedoCommand":
            case "ModelEventCommand":
            case "UpdateModelValueCommand":
            case "ConvertNodesToCodeCommand":
                UndoCommand.RaiseCanExecuteChanged();
                RedoCommand.RaiseCanExecuteChanged();
                break;

            case "SwitchTabCommand":
                if (command.IsInPlaybackMode)
                {
                    RaisePropertyChanged("CurrentWorkspaceIndex");
                }
                break;

            case "RunCancelCommand":
            case "ForceRunCancelCommand":
            case "SelectModelCommand":
            case "MakeConnectionCommand":
            case "CreateCustomNodeCommand":
                // for this commands there is no need
                // to do anything after execution
                break;

            default:
                throw new InvalidOperationException("Unhandled command name");
            }
        }
Beispiel #2
0
 private void SelectInRegionImpl(SelectInRegionCommand command)
 {
     CurrentSpaceViewModel.SelectInRegion(command.Region, command.IsCrossSelection);
 }
        void OnModelCommandCompleted(DynamoModel.RecordableCommand command)
        {
            var name = command.GetType().Name;

            switch (name)
            {
            case "OpenFileCommand":
                this.AddToRecentFiles((command as DynamoModel.OpenFileCommand).FilePath);
                break;

            case "SelectInRegionCommand":
                var selectC = command as DynamoModel.SelectInRegionCommand;
                CurrentSpaceViewModel.SelectInRegion(selectC.Region, selectC.IsCrossSelection);
                break;

            case "DragSelectionCommand":
                var dragC = command as DynamoModel.DragSelectionCommand;

                if (DynamoModel.DragSelectionCommand.Operation.BeginDrag == dragC.DragOperation)
                {
                    CurrentSpaceViewModel.BeginDragSelection(dragC.MouseCursor);
                }
                else
                {
                    CurrentSpaceViewModel.EndDragSelection(dragC.MouseCursor);
                }
                break;

            case "DeleteModelCommand":
                CurrentSpaceViewModel.CancelActiveState();
                RaiseCanExecuteUndoRedo();
                break;

            case "CreateNodeCommand":
            case "CreateProxyNodeCommand":
            case "CreateNoteCommand":
            case "CreateAnnotationCommand":
            case "UndoRedoCommand":
            case "ModelEventCommand":
            case "UpdateModelValueCommand":
            case "ConvertNodesToCodeCommand":
            case "UngroupModelCommand":
            case "AddModelToGroupCommand":
            case "CreateAndConnectNodeCommand":
                RaiseCanExecuteUndoRedo();
                break;

            case "SwitchTabCommand":
                if (command.IsInPlaybackMode)
                {
                    RaisePropertyChanged("CurrentWorkspaceIndex");
                }
                break;

            case "RunCancelCommand":
            case "ForceRunCancelCommand":
            case "SelectModelCommand":
            case "MakeConnectionCommand":
            case "CreateCustomNodeCommand":
            case "AddPresetCommand":
            case "ApplyPresetCommand":
                // for this commands there is no need
                // to do anything after execution
                break;

            default:
                throw new InvalidOperationException("Unhandled command name");
            }
        }