整理序列化

This commit is contained in:
艾竹
2023-01-24 16:20:39 +08:00
parent f39a57b3e5
commit 8dbe05636d
55 changed files with 588 additions and 464 deletions

View File

@@ -249,8 +249,8 @@ namespace AIStudio.Wpf.Flowchart
break;
case 3:
SetStatus(flowNode, status, remark);
FlowNodes[flowNode.Parent].ForEach(p => { if (p.Status == 100) p.Status = 0; });
Approve(FlowNodes[flowNode.Parent][0], 100);
FlowNodes[flowNode.Root].ForEach(p => { if (p.Status == 100) p.Status = 0; });
Approve(FlowNodes[flowNode.Root][0], 100);
MessageBox.Show("流程重新开始");
break;
case 4:
@@ -266,7 +266,7 @@ namespace AIStudio.Wpf.Flowchart
/// <param name="stepid"></param>
public static void Next(string stepid, FlowNode flowNode)
{
FlowNode nextNode = FlowNodes[flowNode.Parent].FirstOrDefault(p => p.Id.ToString() == stepid);
FlowNode nextNode = FlowNodes[flowNode.Root].FirstOrDefault(p => p.Id.ToString() == stepid);
SetStatus(nextNode, 1);
switch (nextNode.Kind)
@@ -312,7 +312,7 @@ namespace AIStudio.Wpf.Flowchart
case NodeKinds.COEnd:
foreach (var prestep in nextNode.PreStepId)
{
var step = FlowNodes[flowNode.Parent].FirstOrDefault(p => p.Id.ToString() == prestep);
var step = FlowNodes[flowNode.Root].FirstOrDefault(p => p.Id.ToString() == prestep);
if (step.Status != 100)//如果并行分支没有都完成,那么并行结束节点也未完成
{
return;
@@ -333,7 +333,7 @@ namespace AIStudio.Wpf.Flowchart
{
if (flowNode.PreStepId != null && flowNode.PreStepId.Count == 1)
{
FlowNode preNode = FlowNodes[flowNode.Parent].FirstOrDefault(p => p.Id.ToString() == flowNode.PreStepId[0]);
FlowNode preNode = FlowNodes[flowNode.Root].FirstOrDefault(p => p.Id.ToString() == flowNode.PreStepId[0]);
if (preNode.Kind == NodeKinds.Middle)
{
SetStatus(preNode, 1);

View File

@@ -54,10 +54,10 @@ namespace AIStudio.Wpf.Flowchart.Models
diagramNode.ParentId = nodeModel.ParentId.ToString();
}
diagramNode.Label = nodeModel.Text;
diagramNode.Width = nodeModel.ItemWidth * nodeModel.Parent.ScreenScale;
diagramNode.Height = nodeModel.ItemHeight * nodeModel.Parent.ScreenScale;
diagramNode.X = nodeModel.Left * nodeModel.Parent.ScreenScale;
diagramNode.Y = nodeModel.Top * nodeModel.Parent.ScreenScale;
diagramNode.Width = nodeModel.ItemWidth * nodeModel.Root.ScreenScale;
diagramNode.Height = nodeModel.ItemHeight * nodeModel.Root.ScreenScale;
diagramNode.X = nodeModel.Left * nodeModel.Root.ScreenScale;
diagramNode.Y = nodeModel.Top * nodeModel.Root.ScreenScale;
diagramNode.ZIndex = nodeModel.ZIndex;
diagramNode.Type = diagramNode.GetType().Name;
diagramNode.PortAlignmentList = nodeModel.Connectors.Select(p => p.Orientation.ToString()).ToList();
@@ -209,7 +209,7 @@ namespace AIStudio.Wpf.Flowchart.Models
{
nodeModel.ParentId = new Guid(diagramNode.ParentId);
}
nodeModel.Parent = diagram;
nodeModel.Root = diagram;
nodeModel.Text = diagramNode.Label;
nodeModel.ItemWidth = diagramNode.Width / diagram.ScreenScale;
nodeModel.ItemHeight = diagramNode.Height / diagram.ScreenScale;

View File

@@ -17,17 +17,17 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
Text = Kind.GetDescription();
}
public FlowNode(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
public FlowNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
{
}
public FlowNode(IDiagramViewModel parent, string json) : base(parent, json)
public FlowNode(IDiagramViewModel root, string json) : base(root, json)
{
}
public override SelectableDesignerItemBase ToXmlObject()
public override SelectableItemBase ToXmlObject()
{
return new FlowNodeDesignerItem(this);
}
@@ -48,9 +48,9 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
visualiserService = ApplicationServicesProvider.Instance.Provider.VisualizerService;
}
protected override void LoadDesignerItemViewModel(IDiagramViewModel parent, SelectableDesignerItemBase designerbase)
protected override void LoadDesignerItemViewModel(IDiagramViewModel root, SelectableItemBase designerbase)
{
base.LoadDesignerItemViewModel(parent, designerbase);
base.LoadDesignerItemViewModel(root, designerbase);
FlowNodeDesignerItem designer = designerbase as FlowNodeDesignerItem;
this.Color = designer.Color;
@@ -132,12 +132,12 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
}
public StartFlowNode(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
public StartFlowNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
{
}
public StartFlowNode(IDiagramViewModel parent, string json) : base(parent, json)
public StartFlowNode(IDiagramViewModel root, string json) : base(root, json)
{
}
@@ -150,12 +150,12 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
}
public EndFlowNode(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
public EndFlowNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
{
}
public EndFlowNode(IDiagramViewModel parent, string json) : base(parent, json)
public EndFlowNode(IDiagramViewModel root, string json) : base(root, json)
{
}
@@ -168,12 +168,12 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
}
public DecideFlowNode(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
public DecideFlowNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
{
}
public DecideFlowNode(IDiagramViewModel parent, string json) : base(parent, json)
public DecideFlowNode(IDiagramViewModel root, string json) : base(root, json)
{
}
@@ -186,12 +186,12 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
}
public COBeginFlowNode(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
public COBeginFlowNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
{
}
public COBeginFlowNode(IDiagramViewModel parent, string json) : base(parent, json)
public COBeginFlowNode(IDiagramViewModel root, string json) : base(root, json)
{
}
@@ -204,12 +204,12 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
}
public COEndFlowNode(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
public COEndFlowNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
{
}
public COEndFlowNode(IDiagramViewModel parent, string json) : base(parent, json)
public COEndFlowNode(IDiagramViewModel root, string json) : base(root, json)
{
}

View File

@@ -13,12 +13,12 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
}
public MiddleFlowNode(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
public MiddleFlowNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
{
}
public MiddleFlowNode(IDiagramViewModel parent, string json) : base(parent, json)
public MiddleFlowNode(IDiagramViewModel root, string json) : base(root, json)
{
}