コード例 #1
0
ファイル: DynamoCommands.cs プロジェクト: hipigod/Dynamo
        private void DeleteModelImpl(DeleteModelCommand command)
        {
            List <ModelBase> modelsToDelete = new List <ModelBase>();

            if (command.ModelGuid != Guid.Empty)
            {
                modelsToDelete.Add(CurrentSpace.GetModelInternal(command.ModelGuid));
            }
            else
            {
                // When nothing is specified then it means all selected models.
                foreach (ISelectable selectable in DynamoSelection.Instance.Selection)
                {
                    if (selectable is ModelBase)
                    {
                        modelsToDelete.Add(selectable as ModelBase);
                    }
                }
            }

            model.DeleteModelInternal(modelsToDelete);

            UndoCommand.RaiseCanExecuteChanged();
            RedoCommand.RaiseCanExecuteChanged();
        }
コード例 #2
0
ファイル: DynamoCommands.cs プロジェクト: hipigod/Dynamo
        private void SelectModelImpl(SelectModelCommand command)
        {
            // Empty ModelGuid means clear selection.
            if (command.ModelGuid == Guid.Empty)
            {
                DynamoSelection.Instance.ClearSelection();
                return;
            }

            ModelBase model = CurrentSpace.GetModelInternal(command.ModelGuid);

            if (false == model.IsSelected)
            {
                if (!command.Modifiers.HasFlag(ModifierKeys.Shift))
                {
                    DynamoSelection.Instance.ClearSelection();
                }

                if (!DynamoSelection.Instance.Selection.Contains(model))
                {
                    DynamoSelection.Instance.Selection.Add(model);
                }
            }
            else
            {
                if (command.Modifiers.HasFlag(ModifierKeys.Shift))
                {
                    DynamoSelection.Instance.Selection.Remove(model);
                }
            }
        }