using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AIStudio.Wpf.DiagramModels;
using AIStudio.Wpf.DiagramModels.ViewModels;
using AIStudio.Wpf.Flowchart.ViewModels;
namespace AIStudio.Wpf.Flowchart.Models
{
///
///
///
///
public class FlowchartNode : DiagramNode
{
///
/// Gets or sets the kind.
///
///
/// The kind.
///
public NodeKinds Kind
{
get; set;
}
///
/// Gets or sets the user ids.
///
///
/// The user ids.
///
public IEnumerable UserIds
{
get; set;
}
///
/// Gets or sets the role ids.
///
///
/// The role ids.
///
public IEnumerable RoleIds
{
get; set;
}
///
/// Gets or sets the type of the act.
///
///
/// The type of the act.
///
public string ActType
{
get; set;
}
public override DiagramItemViewModel ToNodel()
{
FlowNode flowNode = null;
switch (Kind)
{
case NodeKinds.Start:
{
flowNode = new StartFlowNode();
break;
}
case NodeKinds.End:
{
flowNode = new EndFlowNode();
break;
}
case NodeKinds.Decide:
{
flowNode = new DecideFlowNode();
break;
}
case NodeKinds.COBegin:
{
flowNode = new COBeginFlowNode();
break;
}
case NodeKinds.COEnd:
{
flowNode = new COEndFlowNode();
break;
}
case NodeKinds.Middle:
{
var flowchartNodelModel = new MiddleFlowNode();
flowNode = flowchartNodelModel;
flowchartNodelModel.UserIds = UserIds?.ToList();
flowchartNodelModel.RoleIds = RoleIds?.ToList();
flowchartNodelModel.ActType = ActType;
break;
}
default:
{
var flowNodelModel = new FlowNode(NodeKinds.Normal);
flowNode = flowNodelModel;
break;
}
}
flowNode.Name = Name;
flowNode.Color = Color;
flowNode.Kind = Kind;
return flowNode;
}
}
}