mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-02 15:16:37 +08:00
修改逻辑图 动画时间可修改待处理
This commit is contained in:
@@ -231,6 +231,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="DesignItems\Customs\1.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Images\Svgs\account-book.svg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
@@ -874,10 +877,6 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="DesignItems\Customs\" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
|
||||
1
AIStudio.Wpf.DiagramApp/DesignItems/Customs/1.json
Normal file
1
AIStudio.Wpf.DiagramApp/DesignItems/Customs/1.json
Normal file
@@ -0,0 +1 @@
|
||||
{"Title":null,"DiagramType":0,"DiagramItems":[{"Name":null,"DiagramType":0,"ShowGrid":false,"GridCellSize":"0,0","CellHorizontalAlignment":0,"CellVerticalAlignment":0,"PageSizeOrientation":0,"PageSize":"0,0","PageSizeType":0,"GridMarginSize":"0,0","GridColor":"#00000000","DesignerItems":[{"ModelType":null,"ModelTypeName":"AIStudio.Wpf.DiagramDesigner.DefaultDesignerItemViewModel","SerializableType":null,"SerializableTypeName":"AIStudio.Wpf.DiagramDesigner.DesignerItemBase","SerializableString":"{\"Left\":244.0,\"Top\":144.46000022888188,\"Angle\":0.0,\"ScaleX\":1.0,\"ScaleY\":1.0,\"Margin\":0.0,\"ItemWidth\":65.0,\"ItemHeight\":65.0,\"Icon\":null,\"Reserve\":null,\"ItemTypeName\":\"AIStudio.Wpf.DiagramDesigner.DefaultDesignerItemViewModel\",\"ParentId\":\"00000000-0000-0000-0000-000000000000\",\"Id\":\"35365569-5f02-4edd-b040-2cd0150641d7\",\"ZIndex\":0,\"IsGroup\":false,\"Text\":\"AIStudio\",\"ColorItem\":{\"LineColor\":{\"BrushType\":1,\"Color\":\"#FF808080\",\"GradientStop\":null,\"Offset\":null,\"Image\":null,\"SubType\":0,\"StartPoint\":\"0,0\",\"EndPoint\":\"0,0\",\"Opacity\":1.0,\"LinearOrientation\":0,\"RadialOrientation\":0,\"Angle\":0},\"FillColor\":{\"BrushType\":1,\"Color\":\"#FFFFA500\",\"GradientStop\":null,\"Offset\":null,\"Image\":null,\"SubType\":0,\"StartPoint\":\"0,0\",\"EndPoint\":\"0,0\",\"Opacity\":1.0,\"LinearOrientation\":0,\"RadialOrientation\":0,\"Angle\":0},\"ShadowColor\":\"#00FFFFFF\",\"LineWidth\":1.0,\"LineDashStyle\":0,\"LineAnimation\":0},\"FontItem\":{\"FontWeight\":\"Normal\",\"FontStyle\":\"Normal\",\"FontStretch\":\"Normal\",\"Underline\":false,\"Strikethrough\":false,\"OverLine\":false,\"FontColor\":\"#FF000000\",\"FontFamily\":\"Arial\",\"FontSize\":12.0,\"FontObject\":\"Arial, 12pt\",\"TextEffectColor\":\"#00FFFFFF\",\"HighlightColor\":\"#00FFFFFF\",\"FontCase\":0,\"HorizontalAlignment\":1,\"VerticalAlignment\":1,\"LineHeight\":0.0},\"SharpItem\":{\"SourceMarker\":{\"Path\":\"\",\"Width\":10.0,\"PathStyle\":0,\"SizeStyle\":10},\"SinkMarker\":{\"Path\":\"M 0 -5 10 0 0 5 z\",\"Width\":10.0,\"PathStyle\":1,\"SizeStyle\":10}}}"}],"Connections":[]}]}
|
||||
@@ -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)
|
||||
|
||||
@@ -132,9 +132,9 @@
|
||||
StrokeDashArray="2"
|
||||
Fill="Transparent"
|
||||
SnapsToDevicePixels="true"/>
|
||||
<Viewbox Stretch="Uniform" DataContext="{Binding DesignerItemViewModel}">
|
||||
<Viewbox Stretch="Uniform" DataContext="{Binding DesignerItemViewModel}" Margin="2">
|
||||
<Grid Width="{Binding ItemWidth}" Height="{Binding ItemHeight}" IsHitTestVisible="False">
|
||||
<ContentControl Content="{Binding .}" Margin="2"/>
|
||||
<ContentControl Content="{Binding .}" />
|
||||
<TextBox Text="{Binding Text}"
|
||||
IsReadOnly="True"
|
||||
TextWrapping="Wrap"
|
||||
|
||||
Reference in New Issue
Block a user