mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-19 16:06:33 +08:00
重写了Script的解释器代码,使其更加直观。重写了流程控制的部分代码,分离运行环境IOC与流程IOC。
This commit is contained in:
@@ -1,70 +0,0 @@
|
||||
|
||||
using Net462DllTest.Signal;
|
||||
using Net462DllTest.Trigger;
|
||||
using Serein.Library;
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library.Utils;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Net462DllTest.LogicControl
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
[AutoRegister]
|
||||
[DynamicFlow("[View]")]
|
||||
public class ViewLogicControl
|
||||
{
|
||||
private readonly ViewManagement ViewManagement;
|
||||
public ViewLogicControl(ViewManagement ViewManagement)
|
||||
{
|
||||
this.ViewManagement = ViewManagement;
|
||||
}
|
||||
|
||||
|
||||
#region 触发器节点
|
||||
|
||||
[NodeAction(NodeType.Flipflop, "等待视图命令")]
|
||||
public async Task<IFlipflopContext<int>> WaitTask(CommandSignal command)
|
||||
{
|
||||
var result = await ViewManagement.WaitTriggerWithTimeoutAsync<int>(command, TimeSpan.FromHours(10));
|
||||
if (result.Type == TriggerDescription.Overtime)
|
||||
{
|
||||
return new FlipflopContext<int>(FlipflopStateType.Cancel, result.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new FlipflopContext<int>(FlipflopStateType.Succeed, result.Value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
[NodeAction(NodeType.Action, "打开窗体(转换器)")]
|
||||
public void OpenForm2([EnumTypeConvertor(typeof(FromValue))] Form form, bool isTop = true)
|
||||
{
|
||||
// 枚举转换为对应的Type并自动实例化
|
||||
ViewManagement.OpenView(form, isTop);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[NodeAction(NodeType.Action, "关闭指定类型的所有窗体")]
|
||||
public void CloseForm(IDynamicContext context, FromValue fromId = FromValue.FromWorkBenchView)
|
||||
{
|
||||
var fromType = EnumHelper.GetBoundValue<FromValue, Type>(fromId, attr => attr.Value);
|
||||
if (fromType is null) return;
|
||||
ViewManagement.CloseView(fromType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user