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.
HasAllDevices
Section titled “HasAllDevices”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). Changes come with PermissionsChanged. Default (older hosts): true.
Window? Owner { get; }The main window, as owner for the plugin’s own dialogs; null before it is shown.
SelectedCount
Section titled “SelectedCount”int SelectedCount { get; }Default implementation
How many devices are selected, without a copy of the selection (enable a button with it).
SelectedDevices
Section titled “SelectedDevices”IReadOnlyList<IDeviceInfo> SelectedDevices { get; }Selected devices of the grid, in selection order (a new list per call: read it once per change).
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.
CorePluginContext
Section titled “CorePluginContext”ICorePluginClientContext? CorePluginContext(string pluginId)Default implementation
SDK 0.15.0: the context a page of the core plugin pluginId would get (its server calls, live events, dialogs, the host’s reveal of a stored password), for a toolbar entry of a core plugin without a page (Provisioning) that opens dialogs of that plugin. A new context per call: keep it as long as the entry lives. Default (older hosts): null.
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.