Skip to content

ICorePluginClientContext

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

What a core plugin page can see and do. Members are called and raise their events on the UI thread. Everything except ICorePluginClientContext.InvokeAsync has a default so older hosts keep working.

public interface ICorePluginClientContext

Guide: Core plugins and pages

IDeviceWebAccess? DeviceWeb { get; }

Default implementation

The web interface of managed devices for an embedded browser, relayed by the server with the stored login (Web View plugin). Null when the host has none (older hosts).

IReadOnlyList<IDeviceInfo> Devices { get; }

Default implementation

All managed devices (client mirror of the device table), see ICorePluginClientContext.DevicesChanged.

ILiveVideoAccess? LiveVideo { get; }

Default implementation

The host’s live video component for the page (Live View plugin): the server streams the camera with the stored login. Null when the host has none (older hosts). The role needs “Live view” (devices.liveView) to see a picture.

Window? Owner { get; }

Default implementation

Main window, owner for the plugin’s own dialogs and file pickers.

string OwnerName { get; }

Default implementation

“user@machine” of this client, the owner shown for tasks the page starts on the server.

IReadOnlyList<IDeviceInfo> SelectedDevices { get; }

Default implementation

Devices selected in the grid of the Devices page, in selection order.

Task<bool> ConfirmAsync(string title, string message, string confirmText)

Default implementation

The host’s confirmation dialog; true when confirmed. Without a host dialog nothing is confirmed.

bool Has(string permission)

Default implementation

Whether the user’s role allows permission, e.g. “oadm.dhcp-server:manage”: the page hides or disables what the role lacks (the server refuses the call anyway). Default (older hosts): true.

Task<string?> InvokeAsync(string method, string? payloadJson, CancellationToken ct)

Calls ICorePlugin.InvokeAsync on the server. Errors arrive as Grpc.Core.RpcException (Status.Detail is the message).

Task OpenAsync(string hostPage)

Default implementation

Opens a host page (HostPages), e.g. Devices to watch the tasks pane.

Task<PluginDownload> OpenDownloadAsync(string method, string? payloadJson, CancellationToken ct)

Default implementation

A file the server part sends (ICorePluginDownloads, gRPC PluginService.Download): the suggested name, the length when known and the bytes as a stream. Read PluginDownload.Content with your own token and dispose the download (that ends the call). Errors arrive as RpcException like ICorePluginClientContext.InvokeAsync. Default (older hosts): NotSupportedException.

Task ShowMessageAsync(string title, string message)

Default implementation

The host’s message dialog.

IAsyncEnumerable<PluginEvent> WatchEventsAsync(CancellationToken ct)

Default implementation

Live events the server part publishes (ICorePluginContext.Events, gRPC PluginService.Watch), from now until ct is cancelled; items arrive on the caller’s synchronization context. The sequence ends or throws RpcException when the connection drops: re-read the state with ICorePluginClientContext.InvokeAsync and watch again after a short delay. Default (older hosts, fake mode): an empty sequence, so the page polls.

event EventHandler? DevicesChanged

Default implementation

A device was added, removed or changed.

event EventHandler? PermissionsChanged

Default implementation

Raised on the UI thread after the user’s role or its permissions changed (ask ICorePluginClientContext.Has again).