PluginEventWatch
Static class in Oadm.Sdk.Client · Oadm.Sdk.Client.dll
The live events of a plugin page, watched again after the connection drops.
public static class PluginEventWatchMethods
Section titled “Methods”RunAsync
Section titled “RunAsync”static Task RunAsync(this ICorePluginClientContext ctx, Action<PluginEvent> handle, TimeSpan? retryDelay, CancellationToken ct)Hands every event of ICorePluginClientContext.WatchEventsAsync to handle (on the calling thread’s context, usually the UI thread) until ct is cancelled; a broken stream is watched again after retryDelay. Never throws (cancellation ends it).
RunAsync
Section titled “RunAsync”static Task RunAsync(this ICorePluginClientContext ctx, Func<CancellationToken, Task>? read, Action<PluginEvent> handle, PluginEventWatchOptions? options, CancellationToken ct)Keeps a page in step with the server: subscribes to the events first, then runs read (the page’s full state, so nothing published during the read is lost), then hands every event to handle. When the read fails or the stream ends or breaks, it waits (PluginEventWatchOptions.RetryDelay) and does all of it again, so the page reads again after every reconnect; a host without events is read at that pace. Runs on the calling thread’s context (usually the UI thread) until ct is cancelled: cancel it when the page is hidden or disposed. Never throws (cancellation ends it).
Parameters
ctx: The page’s context.read: Reads the page’s state; null for a page that only applies events.handle: Applies one event.options: The waits and the clock; null: 2 s on the system clock.ct: Ends the watch.
RunAsync
Section titled “RunAsync”static Task RunAsync(this ICorePluginClientContext ctx, Func<CancellationToken, Task>? read, Func<PluginEvent, Task> handle, PluginEventWatchOptions? options, CancellationToken ct)PluginEventWatch.RunAsync for a page whose events need a call of their own: the next event waits until handle ended.
Fields
Section titled “Fields”DefaultRetryDelay
Section titled “DefaultRetryDelay”static readonly TimeSpan DefaultRetryDelayWait before watching again after the stream broke.