Skip to content

Commit 32a0749

Browse files
committed
feat: IMaaContext.IsCancellationRequested
1 parent ceb191e commit 32a0749

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/MaaFramework.Binding.Native/MaaContext.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ public MaaContext(MaaContextHandle contextHandle)
2727
Tasker = NativeBindingContext.IsStatelessMode ? new MaaTasker(taskerHandle) : MaaTasker.Instances[taskerHandle];
2828
}
2929

30+
/// <inheritdoc/>
31+
public bool IsCancellationRequested => Tasker.IsStopping;
32+
3033
/// <inheritdoc/>
3134
/// <remarks>
3235
/// Wrapper of <see cref="MaaContextRunTask"/>.

src/MaaFramework.Binding/IMaaContext.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ public interface IMaaContext<T> : IMaaContext
2020
/// </summary>
2121
public interface IMaaContext : ICloneable
2222
{
23+
/// <summary>
24+
/// Gets whether cancellation has been requested for this context.
25+
/// </summary>
26+
/// <returns><see langword="true"/> if cancellation has been requested; otherwise, <see langword="false"/>.</returns>
27+
bool IsCancellationRequested { get; }
28+
2329
/// <summary>
2430
/// Runs a task.
2531
/// </summary>

0 commit comments

Comments
 (0)