Skip to content

ITaskDialogContext

Interface in Oadm.Sdk.Client · Oadm.Sdk.Client.dll

Server access for a task plugin dialog. Build dialogs from the shared OADM controls and theme.

public interface ITaskDialogContext

Guide: Task plugins

IReadOnlyList<IDeviceInfo> AllDevices { get; }

Default implementation

Every device of the system, e.g. to take settings from a device that is not selected (“Use configuration from: Device”). Default (older hosts): empty, the dialog then offers its selected devices only.

bool CanRunTasks { get; }

Default implementation

True when the dialog may start its task itself with ITaskDialogContext.RunTaskAsync and stay open while it runs. Default (older hosts): false, the dialog then returns its payload from ShowAsync and closes.

bool HasAllDevices { get; }

Default implementation

Whether the user may reach every device (SDK 0.4.0); false for a user limited to a device group: hide or disable what only users with all devices may do (the server refuses it anyway). Default (older hosts): true.

IMyAxisSignIn? MyAxis { get; }

Default implementation

The user’s MyAxis sign-in (SDK 0.9.0, docs/spec/myaxis.md), e.g. for downloads from axis.com. Null on older hosts.

string? StartView { get; }

Default implementation

The part of the dialog to open on (SDK 0.7.0), as the page that opened it asked (ICorePluginClientContext.RunTaskAsync): a name the dialog itself defines, e.g. “license” for the license keys of the Applications dialog. Null (the default, the context menu, older hosts): the dialog’s usual start. A dialog ignores names it does not know.

bool Has(string permission)

Default implementation

Whether the user’s role allows permission, e.g. “task:oadm.users:remove”: the dialog hides or disables the choices the role lacks (the server refuses the run anyway). Default (older hosts): true.

Task<string?> QueryAsync(Guid deviceId, string method, string? payloadJson, CancellationToken ct)

Calls the plugin’s server-side ITaskPluginQuery.QueryAsync for one device (read-only).

Task<IReadOnlyList<TaskRunState>> RunTaskAsync(IReadOnlyList<Guid> deviceIds, string? payloadJson, IProgress<IReadOnlyList<TaskRunState>>? progress, CancellationToken ct)

Default implementation

Starts the dialog’s task plugin now on deviceIds (one task per device, like a run from the menu; the tasks also show in the tasks pane) and follows them: progress gets every task’s state whenever one changes; the result is their states once all ended. Cancelling ct stops following only, the tasks go on. The server checks the permissions; a refusal throws its RpcException. A dialog that ran its task returns null from ShowAsync, so nothing runs twice. Default (older hosts): NotSupportedException.

Task<UploadedFile> UploadAsync(string localPath, IProgress<double>? progress, CancellationToken ct)

Uploads a local file to the server (256 KB chunks); put the returned id into the task payload. progress receives the fraction sent, from 0.0 to 1.0 (not a percentage).