@@ -94,8 +94,10 @@ private void SetupBinding()
9494 public SimpleCommand CommandConnectorDragEnter { get ; set ; }
9595 public SimpleCommand CommandConnectorDrop { get ; set ; }
9696 public SimpleCommand CommandSetAsLoop { get ; set ; }
97- public SimpleCommand CommandAdd { get ; set ; }
98- public SimpleCommand CommandDelete { get ; set ; }
97+ //public SimpleCommand CommandAdd { get; set; }
98+ //public SimpleCommand CommandDelete { get; set; }
99+ //public SimpleCommand CommandAddWithConnect { get; set; }
100+ //public SimpleCommand CommandDeleteWithConnect { get; set; }
99101 public SimpleCommandWithParameter < SelectMode > CommandSelect { get ; set ; }
100102 public SimpleCommandWithParameter < string > CommandValidateName { get ; set ; }
101103
@@ -111,8 +113,11 @@ private void SetupCommands()
111113 CommandConnectorDragEnter = new SimpleCommand ( ConnectorDragEnter ) ;
112114 CommandConnectorDrop = new SimpleCommand ( ConnectorDrop ) ;
113115
114- CommandAdd = new SimpleCommand ( Add ) ;
115- CommandDelete = new SimpleCommand ( Delete ) ;
116+ //CommandAdd = new SimpleCommand(Add);
117+ //CommandDelete = new SimpleCommand(Delete);
118+ //CommandAddWithConnect = new SimpleCommand(AddWithConnect);
119+ //CommandDeleteWithConnect = new SimpleCommand(DeleteWithConnect);
120+
116121 CommandValidateName = new SimpleCommandWithParameter < string > ( ValidateName , NotSaved ) ;
117122
118123 CommandSelect = new SimpleCommandWithParameter < SelectMode > ( Select ) ;
@@ -170,59 +175,67 @@ private void SetAsLoop()
170175
171176 Node . CommandAddEmptyConnector . Execute ( ) ;
172177 }
173- private void Add ( )
174- {
175-
176- Node . CommandAddConnector . Execute ( this ) ;
177- }
178- private void Delete ( )
179- {
180- Node . CommandDeleteConnector . Execute ( this ) ;
181- }
178+ //private void Add()
179+ //{
180+ // Node.CommandAddConnector.Execute((0, this));
181+ //}
182+ //private void Delete()
183+ //{
184+ // Node.CommandDeleteConnector.Execute(this);
185+ //}
186+ //private void AddWithConnect()
187+ //{
188+ // this.Add();
189+ // this.Connect?.CommandAdd.Execute();
190+ //}
191+ //private void DeleteWithConnect()
192+ //{
193+ // this.Delete();
194+ // this.Connect?.CommandDelete.Execute();
195+ //}
182196 private void ConnectPointDrag ( )
183197 {
184- Node . NodesCanvas . CommandAddFreeConnect . Execute ( Node . CurrentConnector ) ;
198+ NodesCanvas . CommandAddDraggedConnect . Execute ( Node . CurrentConnector ) ;
185199 }
186200 private void DragConnector ( ViewModelConnector draggedConnector )
187201 {
188202
189203 }
190204
191205 private void ConnectPointDrop ( )
192- {
193-
194- if ( Node . NodesCanvas . DraggedConnect . FromConnector . Node != this . Node )
206+ {
207+ if ( NodesCanvas . DraggedConnect . FromConnector . Node != this . Node )
195208 {
196- var connect = Node . NodesCanvas . DraggedConnect ;
209+ var connect = NodesCanvas . DraggedConnect ;
197210 connect . ToConnector = this ;
198211 }
199212
200213 }
201214
202215 private void CheckConnectPointDrop ( )
203216 {
204- if ( Node . NodesCanvas . DraggedConnect . ToConnector == null )
217+ if ( NodesCanvas . DraggedConnect . ToConnector == null )
205218 {
206- Node . NodesCanvas . CommandDeleteFreeConnect . Execute ( ) ;
219+ NodesCanvas . CommandDeleteDraggedConnect . Execute ( ) ;
207220 }
208221 else
209222 {
210223 Node . CommandAddEmptyConnector . Execute ( ) ;
211- Node . NodesCanvas . CommandAddConnect . Execute ( Node . NodesCanvas . DraggedConnect ) ;
212- Node . NodesCanvas . DraggedConnect = null ;
224+ NodesCanvas . CommandAddConnectWithUndoRedo . Execute ( Node . NodesCanvas . DraggedConnect ) ;
225+ NodesCanvas . DraggedConnect = null ;
213226 }
214227 }
215228
216229 private void ConnectorDrag ( )
217230 {
218- this . NodesCanvas . ConnectorPreviewForDrop = this ;
231+ NodesCanvas . ConnectorPreviewForDrop = this ;
219232 }
220233 private void ConnectorDragEnter ( )
221234 {
222- if ( this . Node != this . NodesCanvas . ConnectorPreviewForDrop . Node )
235+ if ( Node != NodesCanvas . ConnectorPreviewForDrop . Node )
223236 return ;
224237
225- int indexTo = this . Node . Transitions . IndexOf ( this ) ;
238+ int indexTo = Node . Transitions . IndexOf ( this ) ;
226239 if ( indexTo == 0 )
227240 return ;
228241
@@ -317,7 +330,7 @@ public static ViewModelConnect FromXElement(ViewModelNodesCanvas nodesCanvas, XE
317330 }
318331 else
319332 {
320- viewModelConnect = new ViewModelConnect ( nodeFrom . CurrentConnector ) ;
333+ viewModelConnect = new ViewModelConnect ( nodeFrom . NodesCanvas , nodeFrom . CurrentConnector ) ;
321334 viewModelConnect . ToConnector = nodeTo . Input ;
322335 nodeFrom . CommandAddEmptyConnector . Execute ( ) ;
323336 }
0 commit comments