重写了触发器底层逻辑

This commit is contained in:
fengjiayi
2024-10-11 16:46:16 +08:00
parent 2d0f354895
commit aa85c907a3
27 changed files with 770 additions and 392 deletions

View File

@@ -34,25 +34,18 @@ namespace Net462DllTest.LogicControl
#region
[NodeAction(NodeType.Flipflop, "等待视图命令", ReturnType = typeof(int))]
public async Task<IFlipflopContext> WaitTask(CommandSignal command)
[NodeAction(NodeType.Flipflop, "等待视图命令")]
public async Task<IFlipflopContext<int>> WaitTask(CommandSignal command)
{
try
(var type, var result) = await ViewManagement.CreateTaskWithTimeoutAsync(command, TimeSpan.FromHours(10), 0);
if (type == TriggerType.Overtime)
{
TriggerData triggerData = await ViewManagement.CreateChannelWithTimeoutAsync(command, TimeSpan.FromHours(10), 0);
if (triggerData.Type == TriggerType.Overtime)
{
return new FlipflopContext(FlipflopStateType.Cancel, triggerData.Value);
}
return new FlipflopContext(FlipflopStateType.Succeed, triggerData.Value);
return new FlipflopContext<int>(FlipflopStateType.Cancel, result);
}
catch (FlipflopException)
else
{
throw;
}
catch (Exception)
{
return new FlipflopContext(FlipflopStateType.Error);
return new FlipflopContext<int>(FlipflopStateType.Succeed, result);
}
}