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 ICorePluginClientContextGuide: Core plugins and pages
Properties
Section titled “Properties”DeviceWeb
Section titled “DeviceWeb”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).
Devices
Section titled “Devices”IReadOnlyList<IDeviceInfo> Devices { get; }Default implementation
All managed devices (client mirror of the device table), see ICorePluginClientContext.DevicesChanged.
LiveVideo
Section titled “LiveVideo”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.
OwnerName
Section titled “OwnerName”string OwnerName { get; }Default implementation
“user@machine” of this client, the owner shown for tasks the page starts on the server.
SelectedDevices
Section titled “SelectedDevices”IReadOnlyList<IDeviceInfo> SelectedDevices { get; }Default implementation
Devices selected in the grid of the Devices page, in selection order.
Methods
Section titled “Methods”ConfirmAsync
Section titled “ConfirmAsync”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.
InvokeAsync
Section titled “InvokeAsync”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).
OpenAsync
Section titled “OpenAsync”Task OpenAsync(string hostPage)Default implementation
Opens a host page (HostPages), e.g. Devices to watch the tasks pane.
OpenDownloadAsync
Section titled “OpenDownloadAsync”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.
ShowMessageAsync
Section titled “ShowMessageAsync”Task ShowMessageAsync(string title, string message)Default implementation
The host’s message dialog.
WatchEventsAsync
Section titled “WatchEventsAsync”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.
Events
Section titled “Events”DevicesChanged
Section titled “DevicesChanged”event EventHandler? DevicesChangedDefault implementation
A 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 (ask ICorePluginClientContext.Has again).