-
Notifications
You must be signed in to change notification settings - Fork 636
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
View Extension API for ViewModel Delegate Commands (#9944)
* Add IDynamoViewModelDelegateCommands interface * Add ViewModelDelegateCommands to ViewLoadedParams * Add ViewModelDelegateCommands to ViewLoadedParams * Rename ViewModelCommandExecutive * Add FitViewCommand to ViewExtensionCommandExecutive * Remove IDynamoViewModelDelegateCommands * Move FItViewCommand to new DynamoViewModelCommandExecutive class * Add FindById and ForceRunExpression commands to VM Command Executive * Rename DynamoViewModelCommandExecutive -> ViewModelCommandExecutive * Update parameter name * Update model X and Y on CenterViewOnElement
- Loading branch information
1 parent
7758ff2
commit 3fc290e
Showing
4 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Dynamo.ViewModels; | ||
|
||
namespace Dynamo.Wpf.Extensions | ||
{ | ||
/// <summary> | ||
/// The ViewModelCommandExecutive provides access to DynamoViewModel and WorkspaceViewModel commands | ||
/// </summary> | ||
public class ViewModelCommandExecutive | ||
{ | ||
private DynamoViewModel dynamoViewModel; | ||
|
||
/// <summary> | ||
/// Create a Command Executive for a DynamoViewModel | ||
/// </summary> | ||
/// <param name="viewModel"></param> | ||
internal ViewModelCommandExecutive(DynamoViewModel viewModel) | ||
{ | ||
dynamoViewModel = viewModel; | ||
} | ||
|
||
/// <summary> | ||
/// Fit the current workspace view to the current selection | ||
/// </summary> | ||
public void FitViewCommand() | ||
{ | ||
dynamoViewModel.FitViewCommand.Execute(null); | ||
} | ||
|
||
/// <summary> | ||
/// Search for an element by its ID and focus the view on it | ||
/// </summary> | ||
/// <param name="objectID"></param> | ||
public void FindByIdCommand(string objectID) | ||
{ | ||
dynamoViewModel.CurrentSpaceViewModel.FindByIdCommand.Execute(objectID); | ||
} | ||
|
||
/// <summary> | ||
/// Force re-execute all nodes in the current workspace | ||
/// </summary> | ||
/// <param name="showErrors">Should errors be shown?</param> | ||
public void ForceRunExpressionCommand(bool showErrors = true) | ||
{ | ||
dynamoViewModel.ForceRunExpressionCommand.Execute(showErrors); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters