Skip to content

Commit

Permalink
Add Modified to the LinterExtensionBase notification infrastructure (#…
Browse files Browse the repository at this point in the history
…11774)

Co-authored-by: Craig Long <[email protected]>
  • Loading branch information
saintentropy and saintentropy authored Jun 24, 2021
1 parent bac165b commit 04faeaf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/DynamoCore/Extensions/LinterExtensionBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ internal abstract class LinterExtensionBase : IExtension
{
private const string NODE_ADDED_PROPERTY = "NodeAdded";
private const string NODE_REMOVED_PROPERTY = "NodeRemoved";
private const string NODE_MODIFIED_PROPERTY = "Modified";

#region Private/Internal properties
private HashSet<LinterRule> linterRules = new HashSet<LinterRule>();
Expand Down Expand Up @@ -308,6 +309,7 @@ private void SubscribeNodeEvents()
foreach (var node in currentWorkspace.Nodes)
{
node.PropertyChanged += OnNodePropertyChanged;
node.Modified += OnNodeModified;
}
}

Expand All @@ -323,20 +325,27 @@ private void UnsubscribeGraphEvents(WorkspaceModel workspaceModel)
private void UnsubscribeNodeEvents(NodeModel node)
{
node.PropertyChanged -= OnNodePropertyChanged;
node.Modified -= OnNodeModified;
}

private void OnNodeAdded(NodeModel node)
{
EvaluateGraphRules(node, NODE_ADDED_PROPERTY);
EvaluateNodeRules(node, NODE_ADDED_PROPERTY);
node.PropertyChanged += OnNodePropertyChanged;
node.Modified += OnNodeModified;
}

private void OnNodeModified(NodeModel node)
{
EvaluateGraphRules(node, NODE_MODIFIED_PROPERTY);
EvaluateNodeRules(node, NODE_MODIFIED_PROPERTY);
}

private void OnNodePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
EvaluateNodeRules(sender as NodeModel, e.PropertyName);
EvaluateGraphRules(sender as NodeModel, e.PropertyName);

}

private void OnNodeRemoved(Graph.Nodes.NodeModel node)
Expand Down

0 comments on commit 04faeaf

Please sign in to comment.