ITaskStep
Interface in Oadm.Sdk.Plugins · Oadm.Sdk.dll
One named step of a task, started with ITaskExecutionContext.BeginStep. Every device request and every wait of a task plugin is its own step, so the user always sees what the task is doing (“Upload firmware”, “Wait for the device to come back”).
End a step with exactly one of ITaskStep.Complete, ITaskStep.Warn, ITaskStep.Skip or ITaskStep.Fail; later calls are ignored. IDisposable.Dispose without an explicit end completes the step (Done). Beginning the next step completes a still running one the same way. When an exception escapes the plugin, the step that was running (or the one just ended by Dispose while the exception propagated out of its using block) is marked Failed with the exception message.
using (var step = ctx.BeginStep("Send restart")){ await ctx.Vapix.RestartAsync(ct); // throws: the step ends Failed} // returns: the step ends Done
var info = await ctx.StepAsync("Read device info", async step => await ReadAsync(ct));public interface ITaskStep : IDisposableExtends IDisposable
Guide: Task plugins
Properties
Section titled “Properties”string Name { get; }The step name.
TaskStepState State { get; }The current state.
Methods
Section titled “Methods”Complete
Section titled “Complete”void Complete(string? detail = null)Ends the step as Done, with an optional result detail (“AXIS OS 12.11.77”).
void Fail(string message)Ends the step as Failed with message. This only records the failure: throw afterwards to fail the task (an exception escaping the step marks it Failed by itself).
ReportProgress
Section titled “ReportProgress”void ReportProgress(int percent, string? detail = null)Progress of this step (0-100) and an optional detail shown next to it, e.g. “12 of 80 MB”.
void Skip(string reason)Ends the step as Skipped (it did not apply), e.g. “Host name: keep unchanged”.
void Warn(string message)Ends the step as Warning and reports message as a task warning (ITaskExecutionContext.ReportWarning), so the task ends “Done with warnings”.