22using NodeDev . Blazor . NodeAttributes ;
33using NodeDev . Core . Connections ;
44using NodeDev . Core . Nodes ;
5- using System ;
6- using System . Collections . Generic ;
7- using System . Linq ;
85using System . Numerics ;
9- using System . Text ;
10- using System . Threading . Tasks ;
116
127namespace NodeDev . Blazor . DiagramsModels
138{
14- public class GraphNodeModel : NodeModel
15- {
16- internal readonly Node Node ;
9+ public class GraphNodeModel : NodeModel
10+ {
11+ internal readonly Node Node ;
1712
1813 /// <summary>
1914 /// Set to true by the canvas when the user hit "f2" to edit the node name.
@@ -23,18 +18,18 @@ public class GraphNodeModel : NodeModel
2318
2419
2520 public GraphNodeModel ( Node node ) : base ( new ( node . GetOrAddDecoration < NodeDecorationPosition > ( ( ) => new ( Vector2 . Zero ) ) . X , node . GetOrAddDecoration < NodeDecorationPosition > ( ( ) => new ( Vector2 . Zero ) ) . Y ) )
26- {
27- Node = node ;
28- }
21+ {
22+ Node = node ;
23+ }
2924
30- public GraphPortModel GetPort ( Connection connection ) => Ports . OfType < GraphPortModel > ( ) . First ( x => x . Connection == connection ) ;
25+ public GraphPortModel GetPort ( Connection connection ) => Ports . OfType < GraphPortModel > ( ) . First ( x => x . Connection == connection ) ;
3126
3227 internal void OnNodeExecuted ( Connection exec )
3328 {
3429
3530 }
3631
37- internal void OnConnectionPathHighlighted ( Connection connection )
32+ internal void OnConnectionPathHighlighted ( Connection connection )
3833 {
3934 var port = GetPort ( connection ) ;
4035
@@ -47,7 +42,7 @@ internal void OnConnectionPathHighlighted(Connection connection)
4742 }
4843 }
4944
50- internal void OnConnectionPathUnhighlighted ( Connection connection )
45+ internal void OnConnectionPathUnhighlighted ( Connection connection )
5146 {
5247 var port = GetPort ( connection ) ;
5348
@@ -60,23 +55,23 @@ internal void OnConnectionPathUnhighlighted(Connection connection)
6055
6156 internal async Task OnNodeExecuting ( Connection exec )
6257 {
63- var port = GetPort ( exec ) ;
64-
65- foreach ( var link in port . Links . OfType < LinkModel > ( ) )
66- {
67- if ( ! link . Classes . Contains ( "executing" ) )
68- link . Classes += " executing" ;
69-
70- link . Refresh ( ) ;
71- }
72-
73- var currentCount = ++ port . ExecutionCount ;
74- await Task . Delay ( 100 ) ;
75- if ( currentCount == port . ExecutionCount )
76- {
77- foreach ( var link in port . Links . OfType < LinkModel > ( ) )
78- {
79- link . Classes = link . Classes . Replace ( " executing" , "" ) ;
58+ var port = GetPort ( exec ) ;
59+
60+ foreach ( var link in port . Links . OfType < LinkModel > ( ) )
61+ {
62+ if ( ! link . Classes . Contains ( "executing" ) )
63+ link . Classes += " executing" ;
64+
65+ link . Refresh ( ) ;
66+ }
67+
68+ var currentCount = ++ port . ExecutionCount ;
69+ await Task . Delay ( 100 ) ;
70+ if ( currentCount == port . ExecutionCount )
71+ {
72+ foreach ( var link in port . Links . OfType < LinkModel > ( ) )
73+ {
74+ link . Classes = link . Classes . Replace ( " executing" , "" ) ;
8075 link . Refresh ( ) ;
8176 }
8277 }
0 commit comments