mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-11 19:56:36 +08:00
修改内部使用方法,不需要使用页面绑定的命令
This commit is contained in:
@@ -300,7 +300,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
rectangleBounds.Bottom + (rectangleBounds.Height / 2));
|
||||
partialConnection = new ConnectionViewModel(_viewModel, sourceDataItem, new PartCreatedConnectorInfo(point.X, point.Y), DrawMode, RouterMode);
|
||||
|
||||
_viewModel.DirectAddItemCommand.Execute(partialConnection);
|
||||
_viewModel.Add(partialConnection);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -324,7 +324,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
Point point = new Point(rectangleBounds.Left + (rectangleBounds.Width / 2),
|
||||
rectangleBounds.Bottom + (rectangleBounds.Height / 2));
|
||||
partialConnection = new ConnectionViewModel(_viewModel, sourceConnectorInfo, new PartCreatedConnectorInfo(point.X, point.Y), DrawMode, RouterMode);
|
||||
_viewModel.DirectAddItemCommand.Execute(partialConnection);
|
||||
_viewModel.Add(partialConnection);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -375,7 +375,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
if (connectorsHit.Count == 0)
|
||||
{
|
||||
LinkPointDesignerItemViewModel pointItemView = new LinkPointDesignerItemViewModel(rubberbandSelectionStartPoint.Value);
|
||||
_viewModel.DirectAddItemCommand.Execute(pointItemView);
|
||||
_viewModel.Add(pointItemView);
|
||||
SourceConnectorInfo = pointItemView.Connectors.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
@@ -472,7 +472,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
FullyCreatedConnectorInfo sinkDataItem = sinkConnector.Info;
|
||||
|
||||
int indexOfLastTempConnection = sinkDataItem.DataItem.Root.Items.Count - 1;
|
||||
sinkDataItem.DataItem.Root.DirectRemoveItemCommand.Execute(
|
||||
sinkDataItem.DataItem.Root.Remove(
|
||||
sinkDataItem.DataItem.Root.Items[indexOfLastTempConnection]);
|
||||
sinkDataItem.DataItem.Root.AddItemCommand.Execute(new ConnectionViewModel(_viewModel, sourceDataItem, sinkDataItem, DrawMode, RouterMode));
|
||||
}
|
||||
@@ -486,8 +486,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
FullyCreatedConnectorInfo sinkDataItem = pointItemView.TopConnector;
|
||||
|
||||
int indexOfLastTempConnection = _viewModel.Items.Count - 1;
|
||||
_viewModel.DirectRemoveItemCommand.Execute(_viewModel.Items[indexOfLastTempConnection]);
|
||||
_viewModel.DirectAddItemCommand.Execute(pointItemView);
|
||||
_viewModel.Remove(_viewModel.Items[indexOfLastTempConnection]);
|
||||
_viewModel.Add(pointItemView);
|
||||
|
||||
var connector = new ConnectionViewModel(_viewModel, sourceDataItem, sinkDataItem, DrawMode, RouterMode);
|
||||
_viewModel.AddItemCommand.Execute(connector);
|
||||
@@ -499,7 +499,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
//Need to remove last item as we did not finish drawing the path
|
||||
int indexOfLastTempConnection = sourceDataItem.DataItem.Root.Items.Count - 1;
|
||||
sourceDataItem.DataItem.Root.DirectRemoveItemCommand.Execute(
|
||||
sourceDataItem.DataItem.Root.Remove(
|
||||
sourceDataItem.DataItem.Root.Items[indexOfLastTempConnection]);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user