Table of Contents

Interface IUiRegistry

Namespace
AcDream.Plugin.Abstractions
Assembly
AcDream.Plugin.Abstractions.dll

Registers a plugin's own windows, described in the host's panel markup, and drives the client's own windows. A host that draws nothing accepts the registrations and answers every query with false.

public interface IUiRegistry

Properties

Images

The images this plugin may draw with: client art, composed icons and the plugin's own decoded art, held to a per-plugin budget. Inert on a host that draws nothing.

IPluginImages Images { get; }

Property Value

IPluginImages

Methods

AddMarkupPanel(string, object)

void AddMarkupPanel(string markupPath, object binding)

Parameters

markupPath string

Absolute path to the plugin's panel markup file.

binding object

Object whose properties the markup's {Bindings} resolve against.

AddPanel(PluginPanelDescriptor, string, object)

Registers a window for the plugin's lifetime, with a descriptor giving its id, title and shelf button.

void AddPanel(PluginPanelDescriptor descriptor, string markupPath, object binding)

Parameters

descriptor PluginPanelDescriptor

How the window is identified and presented.

markupPath string

Absolute path to the plugin's panel markup file.

binding object

Object whose properties the markup's {Bindings} resolve against.

ControlExists(string, string)

Whether one of this plugin's own windows contains a named control. False when the window or the control is not found.

bool ControlExists(string viewName, string controlName)

Parameters

viewName string
controlName string

Returns

bool

FocusControl(string, string)

Moves keyboard focus to a named input control.

bool FocusControl(string viewName, string controlName)

Parameters

viewName string
controlName string

Returns

bool

HideClientWindow(PluginClientWindow)

Hides one of the client's own windows. Returns whether the host recognized it.

bool HideClientWindow(PluginClientWindow window)

Parameters

window PluginClientWindow

Returns

bool

HidePanel(string)

Hides one of this plugin's own windows, as closing it does: it stays registered and ShowPanel(string) or its shelf button brings it back. A window already hidden by its own bound visibility is left as it is, as a close would leave it: it shows again when the binding turns true.

bool HidePanel(string viewName)

Parameters

viewName string

The window's id or title.

Returns

bool

False when this plugin has no such window, before the window has been put on screen, and on a host that draws nothing -- which is what the default implementation does.

InvalidateView(string, string?)

Requests binding reevaluation for a plugin view.

bool InvalidateView(string viewName, string? propertyName = null)

Parameters

viewName string
propertyName string

Returns

bool

IsClientWindowVisible(PluginClientWindow)

Whether one of the client's own windows is currently visible.

bool IsClientWindowVisible(PluginClientWindow window)

Parameters

window PluginClientWindow

Returns

bool

IsViewVisible(string)

Whether one of this plugin's own windows is currently shown. False when no such window is registered.

bool IsViewVisible(string viewName)

Parameters

viewName string

Returns

bool

RegisterCanvas(PluginCanvasDescriptor, Action<IPluginPainter>)

Registers a canvas the plugin paints, shown over the world and under every window. The paint callback runs on the tick thread, at most once per frame, only after Invalidate(), with a painter valid only for the duration of the call. Disposing the returned canvas removes it. On a host that draws nothing the canvas is accepted and the callback is never called.

IPluginCanvas RegisterCanvas(PluginCanvasDescriptor descriptor, Action<IPluginPainter> paint)

Parameters

descriptor PluginCanvasDescriptor

The canvas's id, size and placement.

paint Action<IPluginPainter>

What to draw when the canvas is repainted.

Returns

IPluginCanvas

The canvas, which the plugin shows, moves, invalidates and disposes.

Exceptions

InvalidOperationException

The plugin already has a canvas with this id, or as many canvases as it may have.

RegisterPanel(PluginPanelDescriptor, string, object)

Registers a window whose lifetime may be ended independently while the plugin keeps running. Disposing the token removes the retained window and its sidepanel entry.

IDisposable RegisterPanel(PluginPanelDescriptor descriptor, string markupPath, object binding)

Parameters

descriptor PluginPanelDescriptor
markupPath string
binding object

Returns

IDisposable

RegisterPanelContent(PluginPanelDescriptor, string, object)

Same as RegisterPanel(PluginPanelDescriptor, string, object), but the markup is passed as text instead of read from a file.

IDisposable RegisterPanelContent(PluginPanelDescriptor descriptor, string markupContent, object binding)

Parameters

descriptor PluginPanelDescriptor

How the window is identified and presented.

markupContent string

The panel markup itself.

binding object

Object whose properties the markup's {Bindings} resolve against.

Returns

IDisposable

SetControlLabel(string, string, string)

Replaces the text of a named button, toggle or label in one of this plugin's own windows, dropping whatever binding the markup gave it. Returns false when the control is not found or carries no text.

bool SetControlLabel(string viewName, string controlName, string label)

Parameters

viewName string
controlName string
label string

Returns

bool

SetControlVisible(string, string, bool)

Shows or hides a named control in one of this plugin's own windows, dropping whatever binding the markup gave its visibility. Returns false when the control is not found.

bool SetControlVisible(string viewName, string controlName, bool visible)

Parameters

viewName string
controlName string
visible bool

Returns

bool

ShowClientWindow(PluginClientWindow)

Shows one of the client's own windows. Returns whether it is now visible.

bool ShowClientWindow(PluginClientWindow window)

Parameters

window PluginClientWindow

Returns

bool

ShowPanel(string)

Shows one of this plugin's own windows, as its shelf button does -- including one the player closed with its close button, which the plugin setting its own bound visibility back to true does not undo. A window whose markup binds its visibility to something the plugin has set false stays hidden until that is true again; this lifts only the player's close. Read IsViewVisible(string) for the result.

bool ShowPanel(string viewName)

Parameters

viewName string

The window's id or title.

Returns

bool

False when this plugin has no such window, before the window has been put on screen, and on a host that draws nothing -- which is what the default implementation does.

ToggleClientWindow(PluginClientWindow)

Shows one of the client's own windows if it is hidden, hides it if shown. Returns whether the window ended up visible; a no-window host or a window this build does not mount always returns false.

bool ToggleClientWindow(PluginClientWindow window)

Parameters

window PluginClientWindow

Returns

bool

ViewExists(string)

Queries this plugin's own registered view by title or stable id.

bool ViewExists(string viewName)

Parameters

viewName string

Returns

bool