mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-19 16:06:35 +08:00
修改逻辑图 动画时间可修改待处理
This commit is contained in:
@@ -13,7 +13,7 @@ namespace AIStudio.Wpf.Logical
|
||||
{
|
||||
public LogicalViewModel(string title, string status, DiagramType diagramType) : base(title, status, diagramType)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
public LogicalViewModel(string filename, DiagramDocument diagramDocument) : base(filename, diagramDocument)
|
||||
{
|
||||
@@ -38,65 +38,83 @@ namespace AIStudio.Wpf.Logical
|
||||
{
|
||||
base.Init();
|
||||
|
||||
TimerDesignerItemViewModel timer = new TimerDesignerItemViewModel() { Left = 0, Top = 10 };
|
||||
TimerDesignerItemViewModel timer = new TimerDesignerItemViewModel() { Left = 28, Top = 28 };
|
||||
timer.Value = 0.5;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(timer);
|
||||
|
||||
InputItemViewModel in1 = new InputItemViewModel() { Left = 0, Top = 50 };
|
||||
InputItemViewModel in1 = new InputItemViewModel() { Left = 28, Top = 110 };
|
||||
in1.LinkPoint = LogicalService.LinkPoint[0];
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(in1);
|
||||
|
||||
InputItemViewModel in2 = new InputItemViewModel() { Left = 0, Top = 80 };
|
||||
InputItemViewModel in2 = new InputItemViewModel() { Left = 28, Top = 300 };
|
||||
in2.LinkPoint = LogicalService.LinkPoint[1];
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(in2);
|
||||
|
||||
AddGateItemViewModel item1 = new AddGateItemViewModel() { Left = 150, Top = 50 };
|
||||
AddGateItemViewModel item1 = new AddGateItemViewModel() { Left = 178, Top = 160 };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(item1);
|
||||
|
||||
ConstantDesignerItemViewModel constant = new ConstantDesignerItemViewModel() { Left = 150, Top = 118 };
|
||||
ConstantDesignerItemViewModel constant = new ConstantDesignerItemViewModel() { Left = 178, Top = 300, Value = 10 };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(constant);
|
||||
|
||||
GTGateItemViewModel gTGate = new GTGateItemViewModel() { Left = 300, Top = 50 };
|
||||
GTGateItemViewModel gTGate = new GTGateItemViewModel() { Left = 328, Top = 110 };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(gTGate);
|
||||
|
||||
InputItemViewModel in3 = new InputItemViewModel() { Left = 300, Top = 118 };
|
||||
InputItemViewModel in3 = new InputItemViewModel() { Left = 328, Top = 210 };
|
||||
in3.LinkPoint = LogicalService.LinkPoint[2];
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(in3);
|
||||
|
||||
InputItemViewModel in4 = new InputItemViewModel() { Left = 300, Top = 148 };
|
||||
InputItemViewModel in4 = new InputItemViewModel() { Left = 328, Top = 300 };
|
||||
in4.LinkPoint = LogicalService.LinkPoint[3];
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(in4);
|
||||
|
||||
SELGateItemViewModel sELGate = new SELGateItemViewModel() { Left = 450, Top = 50 };
|
||||
SELGateItemViewModel sELGate = new SELGateItemViewModel() { Left = 478, Top = 160 };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(sELGate);
|
||||
|
||||
OutputItemViewModel out1 = new OutputItemViewModel() { Left = 600, Top = 50 };
|
||||
OutputItemViewModel out1 = new OutputItemViewModel() { Left = 628, Top = 110 };
|
||||
out1.LinkPoint = LogicalService.LinkPoint[4];
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(out1);
|
||||
|
||||
ConnectionViewModel connector1 = new ConnectionViewModel(in1.Output[0], item1.Input[0], _service.DrawModeViewModel.LineDrawMode, _service.DrawModeViewModel.LineRouterMode);
|
||||
connector1.ColorViewModel.FillColor.Color = Colors.Green;
|
||||
connector1.ColorViewModel.LineAnimation = LineAnimation.PathAnimation;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector1);
|
||||
|
||||
ConnectionViewModel connector2 = new ConnectionViewModel(in2.Output[0], item1.Input[1], _service.DrawModeViewModel.LineDrawMode, _service.DrawModeViewModel.LineRouterMode);
|
||||
connector2.ColorViewModel.FillColor.Color = Colors.Green;
|
||||
connector2.ColorViewModel.LineAnimation = LineAnimation.PathAnimation;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector2);
|
||||
|
||||
ConnectionViewModel connector3 = new ConnectionViewModel(item1.Output[0], gTGate.Input[0], _service.DrawModeViewModel.LineDrawMode, _service.DrawModeViewModel.LineRouterMode);
|
||||
connector3.ColorViewModel.FillColor.Color = Colors.Green;
|
||||
connector3.ColorViewModel.LineAnimation = LineAnimation.PathAnimation;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector3);
|
||||
|
||||
ConnectionViewModel connector4 = new ConnectionViewModel(constant.Output[0], gTGate.Input[1], _service.DrawModeViewModel.LineDrawMode, _service.DrawModeViewModel.LineRouterMode);
|
||||
connector4.ColorViewModel.FillColor.Color = Colors.Green;
|
||||
connector4.ColorViewModel.LineAnimation = LineAnimation.PathAnimation;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector4);
|
||||
|
||||
ConnectionViewModel connector5 = new ConnectionViewModel(gTGate.Output[0], sELGate.Input[0], _service.DrawModeViewModel.LineDrawMode, _service.DrawModeViewModel.LineRouterMode);
|
||||
connector5.ColorViewModel.FillColor.Color = Colors.Green;
|
||||
connector5.ColorViewModel.LineAnimation = LineAnimation.PathAnimation;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector5);
|
||||
|
||||
ConnectionViewModel connector6 = new ConnectionViewModel(in3.Output[0], sELGate.Input[1], _service.DrawModeViewModel.LineDrawMode, _service.DrawModeViewModel.LineRouterMode);
|
||||
connector6.ColorViewModel.FillColor.Color = Colors.Green;
|
||||
connector6.ColorViewModel.LineAnimation = LineAnimation.PathAnimation;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector6);
|
||||
|
||||
ConnectionViewModel connector7 = new ConnectionViewModel(in4.Output[0], sELGate.Input[2], _service.DrawModeViewModel.LineDrawMode, _service.DrawModeViewModel.LineRouterMode);
|
||||
connector7.ColorViewModel.FillColor.Color = Colors.Green;
|
||||
connector7.ColorViewModel.LineAnimation = LineAnimation.PathAnimation;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector7);
|
||||
|
||||
ConnectionViewModel connector8 = new ConnectionViewModel(sELGate.Output[0], out1.Input[0], _service.DrawModeViewModel.LineDrawMode, _service.DrawModeViewModel.LineRouterMode);
|
||||
connector8.ColorViewModel.FillColor.Color = Colors.Green;
|
||||
connector8.ColorViewModel.LineAnimation = LineAnimation.PathAnimation;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector8);
|
||||
|
||||
DiagramViewModel.ClearSelectedItemsCommand.Execute(null);
|
||||
}
|
||||
|
||||
private void Items_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||
@@ -148,6 +166,11 @@ namespace AIStudio.Wpf.Logical
|
||||
|
||||
private void Do()
|
||||
{
|
||||
Random rd = new Random();
|
||||
foreach (var link in LogicalService.LinkPoint)
|
||||
{
|
||||
link.Value = rd.NextDouble() * 10;
|
||||
}
|
||||
foreach (var item in DiagramViewModel.Items.OfType<ConstantDesignerItemViewModel>())
|
||||
{
|
||||
foreach (var output in item.Output)
|
||||
|
||||
Reference in New Issue
Block a user