| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using TeamAAS.FlowEditor;
- using TeamAAS.FlowEditor.Models;
- namespace TeamAAS.FlowEngine.Execution
- {
- [System.Serializable]
- /// <summary>
- /// 流程 Tab 项
- /// </summary>
- public class FlowTabItem : TeamAAS.BindableBase
- {
- private string _name;
- [System.ComponentModel.DisplayName("1.流程名称")]
- [System.ComponentModel.Category("I.基本信息")]
- [System.ComponentModel.Description("流程的显示名称")]
- public string Name
- {
- get => _name;
- set => SetProperty(ref _name, value);
- }
- private bool _isActive;
- [System.ComponentModel.Browsable(false)]
- public bool IsActive
- {
- get => _isActive;
- set => SetProperty(ref _isActive, value);
- }
- [System.ComponentModel.Browsable(false)]
- [field: NonSerialized]
- public FlowGraph Graph { get; set; }
- [System.ComponentModel.Browsable(false)]
- [field: NonSerialized]
- public FlowEditorViewModel EditorVm { get; set; }
- private int _loopCount = 1;
- [System.ComponentModel.DisplayName("2.循环次数")]
- [System.ComponentModel.Category("I.基本信息")]
- [System.ComponentModel.Description("循环次数。-1=无限循环, 0=跳过不执行, 其他=按次数执行")]
- public int LoopCount
- {
- get => _loopCount;
- set => SetProperty(ref _loopCount, value);
- }
- private TriggerType _triggerType = TriggerType.MainFlow;
- [System.ComponentModel.DisplayName("3.触发类型")]
- [System.ComponentModel.Category("I.基本信息")]
- [System.ComponentModel.Description("主流程触发:随主流程自动执行。事件触发:需外部事件触发。")]
- public TriggerType TriggerType
- {
- get => _triggerType;
- set => SetProperty(ref _triggerType, value);
- }
- private int _loopIntervalMs = 10;
- [System.ComponentModel.DisplayName("4.循环间隔(ms)")]
- [System.ComponentModel.Category("I.基本信息")]
- [System.ComponentModel.Description("循环运行模式下,单轮流程结束后等待多少毫秒再开始下一轮。最小1ms,防止空流程卡CPU。")]
- public int LoopIntervalMs
- {
- get => _loopIntervalMs;
- set => SetProperty(ref _loopIntervalMs, value < 1 ? 1 : value);
- }
- [System.ComponentModel.Browsable(false)]
- [field: NonSerialized]
- public Dictionary<string, string> ModuleOutputs { get; set; } = new Dictionary<string, string>();
- private double _canvasWidth = 5000;
- [System.ComponentModel.DisplayName("1.画布宽度")]
- [System.ComponentModel.Category("II.画布设置")]
- [System.ComponentModel.Description("画布的宽度(像素)")]
- public double CanvasWidth
- {
- get => _canvasWidth;
- set
- {
- if (SetProperty(ref _canvasWidth, value))
- EditorVm.CanvasWidth = value;
- }
- }
- private double _canvasHeight = 3500;
- [System.ComponentModel.DisplayName("2.画布高度")]
- [System.ComponentModel.Category("II.画布设置")]
- [System.ComponentModel.Description("画布的高度(像素)")]
- public double CanvasHeight
- {
- get => _canvasHeight;
- set
- {
- if (SetProperty(ref _canvasHeight, value))
- EditorVm.CanvasHeight = value;
- }
- }
- public FlowTabItem(string name)
- {
- _name = name;
- Graph = new FlowGraph { GraphName = name };
- EditorVm = new FlowEditorViewModel(Graph);
- EditorVm.CanvasWidth = _canvasWidth;
- EditorVm.CanvasHeight = _canvasHeight;
- }
- }
- }
|