IToolbarContext
Interface in Oadm.Sdk.Client · Oadm.Sdk.Client.dll
What a toolbar plugin can see and do: the devices and the selection (with change events), the task plugins, the host pages and dialogs, and the same server access as a task plugin dialog. All members are called and raise their events on the UI thread.
public interface IToolbarContextGuide: Core plugins and pages
Properties
Section titled “Properties”Devices
Section titled “Devices”IReadOnlyList<IDeviceInfo> Devices { get; }All managed devices.
Window? Owner { get; }The main window, as owner for the plugin’s own dialogs; null before it is shown.
SelectedDevices
Section titled “SelectedDevices”IReadOnlyList<IDeviceInfo> SelectedDevices { get; }Selected devices of the grid, in selection order.
TaskPlugins
Section titled “TaskPlugins”IReadOnlyList<ToolbarTaskPlugin> TaskPlugins { get; }Task plugins of the server.
Methods
Section titled “Methods”CanRunTask
Section titled “CanRunTask”bool CanRunTask(string pluginId)True when the task plugin can run on every selected device (and something is selected).
CannotRunTaskReason
Section titled “CannotRunTaskReason”string? CannotRunTaskReason(string pluginId)Default implementation
Why the task plugin cannot run on the selection, in plain language (the context menu tooltip of the greyed entry, e.g. “Needs AXIS OS 11.11 or later: 3 of 5 selected devices”); null when it can or nothing is selected. Default (older hosts): null.
ConfirmAsync
Section titled “ConfirmAsync”Task<bool> ConfirmAsync(string title, string message, string confirmText)The host’s confirmation dialog; true when confirmed.
bool Has(string permission)Default implementation
Whether the user’s role allows permission (“devices.refresh”). Default (older hosts): true.
InvokePluginAsync
Section titled “InvokePluginAsync”Task<string?> InvokePluginAsync(string pluginId, string method, string? payloadJson, CancellationToken ct)Default implementation
Calls a core plugin’s server part (ICorePlugin.InvokeAsync through gRPC PluginService.Invoke), e.g. the backend of a toolbar-only core plugin (ICorePlugin.HasPage false). Failures are Grpc.Core.RpcException (Status.Detail is the message). Hosts without it throw NotSupportedException.
OpenAsync
Section titled “OpenAsync”Task OpenAsync(string hostPage)Opens a host page, see HostPages. Completes when a dialog page closes.
QueryAsync
Section titled “QueryAsync”Task<string?> QueryAsync(string pluginId, Guid deviceId, string method, string? payloadJson, CancellationToken ct)Calls a task plugin’s server-side ITaskPluginQuery.QueryAsync for one device (read-only).
RefreshDevicesAsync
Section titled “RefreshDevicesAsync”Task RefreshDevicesAsync(IReadOnlyCollection<Guid> deviceIds, CancellationToken ct)Default implementation
Reads devices again now (full refresh on the server: status, firmware, network settings, API list, certificate); returns when the refresh is queued, the grid updates as the results arrive. Read-only for the devices.
RemoveDevicesAsync
Section titled “RemoveDevicesAsync”Task RemoveDevicesAsync(IReadOnlyCollection<Guid> deviceIds, CancellationToken ct)Removes devices from OADM (the devices themselves are not changed). No confirmation.
RunTaskAsync
Section titled “RunTaskAsync”Task<IReadOnlyList<string>?> RunTaskAsync(string pluginId, CancellationToken ct)Runs a task plugin on the selection like the context menu does: its dialog first when it has one, then one task per device. Returns the task ids, or null when nothing was started.
ShowMessageAsync
Section titled “ShowMessageAsync”Task ShowMessageAsync(string title, string message)The host’s message dialog.
UploadAsync
Section titled “UploadAsync”Task<UploadedFile> UploadAsync(string localPath, IProgress<double>? progress, CancellationToken ct)Uploads a local file to the server; progress receives 0.0 to 1.0.
Events
Section titled “Events”DevicesChanged
Section titled “DevicesChanged”event EventHandler? DevicesChangedA device was added, removed or changed.
PermissionsChanged
Section titled “PermissionsChanged”event EventHandler? PermissionsChangedDefault implementation
Raised on the UI thread after the user’s role or its permissions changed.
SelectionChanged
Section titled “SelectionChanged”event EventHandler? SelectionChangedThe grid selection changed.
TaskPluginsChanged
Section titled “TaskPluginsChanged”event EventHandler? TaskPluginsChangedIToolbarContext.TaskPlugins or what they can run on changed.