Skip to content

Commit 4c0b204

Browse files
💾 Feat(Event): 新增 WorkflowRenamedEventArgs 和 WorkflowSavedEventArgs 事件参数类,用于处理工作流重命名和数据保存事件
1 parent 88f7e0a commit 4c0b204

3 files changed

Lines changed: 56 additions & 9 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System;
2+
3+
namespace KitX.Core.Contract.Event;
4+
5+
/// <summary>
6+
/// Event arguments for workflow rename events
7+
/// </summary>
8+
public class WorkflowRenamedEventArgs : EventArgs
9+
{
10+
/// <summary>
11+
/// The workflow ID that was renamed
12+
/// </summary>
13+
public string WorkflowId { get; }
14+
15+
/// <summary>
16+
/// The new name of the workflow
17+
/// </summary>
18+
public string NewName { get; }
19+
20+
public WorkflowRenamedEventArgs(string workflowId, string newName)
21+
{
22+
WorkflowId = workflowId;
23+
NewName = newName;
24+
}
25+
}
26+
27+
/// <summary>
28+
/// Event arguments for workflow data saved events
29+
/// </summary>
30+
public class WorkflowSavedEventArgs : EventArgs
31+
{
32+
/// <summary>
33+
/// The workflow ID that was saved
34+
/// </summary>
35+
public string WorkflowId { get; }
36+
37+
/// <summary>
38+
/// The workflow name at time of save
39+
/// </summary>
40+
public string WorkflowName { get; }
41+
42+
public WorkflowSavedEventArgs(string workflowId, string workflowName)
43+
{
44+
WorkflowId = workflowId;
45+
WorkflowName = workflowName;
46+
}
47+
}

KitX Core Contracts/KitX.Core.Contract/Workflow/BlockScriptModels.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public class BlockDefinition
6666

6767
/// <summary>
6868
/// Name of the next block to execute when this block ends naturally
69-
/// (i.e., not ended by Branch/Loop/LoopBodyEnd)
69+
/// (i.e., not ended by Branch/Loop/ToLoopCond)
7070
/// </summary>
7171
public string? NextBlockName { get; set; }
7272

@@ -166,9 +166,9 @@ public enum FlowControlType
166166
Break,
167167

168168
/// <summary>
169-
/// Loop body end - marks the end of a loop body and returns to loop condition
169+
/// To loop condition - marks the end of a loop body and returns to loop condition
170170
/// </summary>
171-
LoopBodyEnd
171+
ToLoopCond
172172
}
173173

174174
/// <summary>
@@ -198,9 +198,9 @@ public class FlowControlStatement : BlockStatement
198198
public string FalseBlockName { get; set; } = string.Empty;
199199

200200
/// <summary>
201-
/// For LoopBodyEnd: the block name containing the Loop statement to return to
201+
/// For ToLoopCond: the block name containing the Loop statement to return to
202202
/// </summary>
203-
public string? LoopBodyEndReturnTo { get; set; }
203+
public string? ToLoopCondReturnTo { get; set; }
204204

205205
/// <summary>
206206
/// Regenerates SourceCode from current field values.
@@ -212,9 +212,9 @@ public void RegenerateSourceCode()
212212
{
213213
FlowControlType.Branch => $"NextBlock = Branch({ConditionExpression}, \"{TrueBlockName}\", \"{FalseBlockName}\");",
214214
FlowControlType.Loop => $"NextBlock = Loop({ConditionExpression}, \"{TrueBlockName}\", \"{FalseBlockName}\");",
215-
FlowControlType.LoopBodyEnd => LoopBodyEndReturnTo != null
216-
? $"NextBlock = LoopBodyEnd(\"{LoopBodyEndReturnTo}\");"
217-
: "LoopBodyEnd();",
215+
FlowControlType.ToLoopCond => ToLoopCondReturnTo != null
216+
? $"NextBlock = ToLoopCond(\"{ToLoopCondReturnTo}\");"
217+
: "ToLoopCond();",
218218
FlowControlType.Break => "Break();",
219219
_ => SourceCode
220220
};

KitX Core Contracts/KitX.Core.Contract/Workflow/BlueprintModels.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ public class BlueprintBlockScope
757757

758758
/// <summary>
759759
/// Name of the next block to execute when this block ends naturally
760-
/// (i.e., not ended by Branch/Loop/LoopBodyEnd). Null if the block ends
760+
/// (i.e., not ended by Branch/Loop/ToLoopCond). Null if the block ends
761761
/// with a control-flow statement or is terminal.
762762
/// </summary>
763763
public string? NextBlockName { get; set; }

0 commit comments

Comments
 (0)