mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-09 02:36:35 +08:00
项目结构调整
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
using AIStudio.Wpf.Flowchart.ViewModels;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using System.Xml.Serialization;
|
||||
using AIStudio.Wpf.DiagramDesigner;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Reflection;
|
||||
|
||||
namespace AIStudio.Wpf.Flowchart.Models
|
||||
{
|
||||
public class FlowNodeDesignerItem : DesignerItemBase
|
||||
{
|
||||
public FlowNodeDesignerItem()
|
||||
{
|
||||
|
||||
}
|
||||
public FlowNodeDesignerItem(FlowNode item) : base(item)
|
||||
{
|
||||
if (item is MiddleFlowNode middleFlow)
|
||||
{
|
||||
UserIds = middleFlow.UserIds;
|
||||
RoleIds = middleFlow.RoleIds;
|
||||
ActType = middleFlow.ActType;
|
||||
SimulateApprove = middleFlow.SimulateApprove;
|
||||
}
|
||||
Color = item.StatusColor;
|
||||
Kind = item.Kind;
|
||||
StateImage = item.StateImage;
|
||||
Status = item.Status;
|
||||
Remark = item.Remark;
|
||||
}
|
||||
|
||||
[XmlArray]
|
||||
public List<string> UserIds
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[XmlArray]
|
||||
public List<string> RoleIds
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public string ActType
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public bool SimulateApprove
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public int Status
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public string Remark
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public string Color
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public NodeKinds Kind
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public string StateImage
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
}
|
||||
129
Extensions/AIStudio.Wpf.Flowchart/Models/FlowchartNode.cs
Normal file
129
Extensions/AIStudio.Wpf.Flowchart/Models/FlowchartNode.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AIStudio.Wpf.DiagramDesigner;
|
||||
using AIStudio.Wpf.DiagramDesigner.Serializable;
|
||||
using AIStudio.Wpf.DiagramDesigner.Serializable.ViewModels;
|
||||
using AIStudio.Wpf.Flowchart.ViewModels;
|
||||
|
||||
namespace AIStudio.Wpf.Flowchart.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <seealso cref="AIStudio.Util.DiagramEntity.DiagramNode" />
|
||||
public class FlowchartNode : DiagramNode
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the kind.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The kind.
|
||||
/// </value>
|
||||
public NodeKinds Kind
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user ids.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The user ids.
|
||||
/// </value>
|
||||
public IEnumerable<string> UserIds
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the role ids.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The role ids.
|
||||
/// </value>
|
||||
public IEnumerable<string> RoleIds
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the act.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The type of the act.
|
||||
/// </value>
|
||||
public string ActType
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The color.
|
||||
/// </value>
|
||||
public string StatusColor
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public override DiagramItemViewModel ToNodel(IDiagramViewModel diagramViewModel)
|
||||
{
|
||||
FlowNode flowNode = null;
|
||||
switch (Kind)
|
||||
{
|
||||
case NodeKinds.Start:
|
||||
{
|
||||
flowNode = new StartFlowNode(diagramViewModel);
|
||||
break;
|
||||
}
|
||||
|
||||
case NodeKinds.End:
|
||||
{
|
||||
flowNode = new EndFlowNode(diagramViewModel);
|
||||
break;
|
||||
}
|
||||
case NodeKinds.Decide:
|
||||
{
|
||||
flowNode = new DecideFlowNode(diagramViewModel);
|
||||
break;
|
||||
}
|
||||
case NodeKinds.COBegin:
|
||||
{
|
||||
flowNode = new COBeginFlowNode(diagramViewModel);
|
||||
break;
|
||||
}
|
||||
case NodeKinds.COEnd:
|
||||
{
|
||||
flowNode = new COEndFlowNode(diagramViewModel);
|
||||
break;
|
||||
}
|
||||
case NodeKinds.Middle:
|
||||
{
|
||||
var flowchartNodelModel = new MiddleFlowNode(diagramViewModel);
|
||||
flowNode = flowchartNodelModel;
|
||||
flowchartNodelModel.UserIds = UserIds?.ToList();
|
||||
flowchartNodelModel.RoleIds = RoleIds?.ToList();
|
||||
flowchartNodelModel.ActType = ActType;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
var flowNodelModel = new FlowNode(diagramViewModel, NodeKinds.Normal);
|
||||
flowNode = flowNodelModel;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
flowNode.StatusColor = StatusColor;
|
||||
flowNode.Kind = Kind;
|
||||
|
||||
return flowNode;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using AIStudio.Wpf.DiagramDesigner;
|
||||
using AIStudio.Wpf.DiagramDesigner.Helpers;
|
||||
|
||||
namespace AIStudio.Wpf.Flowchart.Models
|
||||
{
|
||||
public class FlowchartToolBoxData : ToolBoxData
|
||||
{
|
||||
public NodeKinds Kind
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public FlowchartToolBoxData(NodeKinds kind, Type type, double width, double height, Size? desiredSize) : base(kind.GetDescription(), null, type, width, height, desiredSize)
|
||||
{
|
||||
Kind = kind;
|
||||
ColorViewModel.LineColor.Color = Colors.Black;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user