Interface IOfsHost
- Namespace
- Ofs
- Assembly
- Ofs.Api.dll
The host surface available to a plugin, organized into cohesive sub-objects.
public interface IOfsHost
Properties
Axes
Per-axis read access and edits, plus axis/project change events.
Axes Axes { get; }
Property Value
Commands
Register invocable commands (palette and/or bindable shortcuts).
Commands Commands { get; }
Property Value
Culture
ofs-ng's active UI language as a CultureInfo — feed it to your own
ResourceManager.GetString(key, Host.Culture) so the plugin follows the language the
user picked in ofs-ng (not the OS culture). English/unknown maps to the invariant culture
(i.e. your neutral .resx). Read it at OnLoad: the host reloads the plugin on a UI-language
switch, so OnLoad re-runs in the new language. Main-thread only.
CultureInfo Culture { get; }
Property Value
Dialogs
Native file/folder pickers and confirmation prompts.
Dialogs Dialogs { get; }
Property Value
Editing
Register alternate edit modes for the timeline.
Editing Editing { get; }
Property Value
IsMainThread
True when called on ofs-ng's main thread — the only thread that may touch most Host
members. Use the RunOnMainThread helpers to marshal work in from another thread.
bool IsMainThread { get; }
Property Value
Language
The BCP 47 culture tag of ofs-ng's active UI language ("en" for built-in English, else the tag the translation declares, e.g. "ja", "zh-Hant"). Main-thread only.
string Language { get; }
Property Value
Navigation
Register alternate navigators (how stepping moves the playhead).
Navigation Navigation { get; }
Property Value
Nodes
Register processing-graph nodes (generators, modifiers, combiners).
Nodes Nodes { get; }
Property Value
Player
Video playback: time, duration, transport, and playback events.
Player Player { get; }
Property Value
Project
The open project: chapters, bookmarks, regions, and project metadata.
Project Project { get; }
Property Value
Selection
Register alternate selection modes.
Selection Selection { get; }
Property Value
UnloadToken
Cancelled when this plugin is being unloaded (disabled or app shutdown). Use it to stop background threads, timers and Tasks. After cancellation, do not touch Host members. Note: OnUnload() runs BEFORE this is cancelled — OnUnload is the imperative cleanup hook; the token is for work that outlives OnUnload.
CancellationToken UnloadToken { get; }
Property Value
Methods
AppScoped<T>(string)
An AppScoped<T>(string) handle over this plugin's global settings at
key: it loads the value now and saves it back whenever it changes —
persisted in this plugin's own file under the app's settings directory, shared across all
projects (unlike Scoped<T>(string), which is per-project). Create it once
in OnLoad(); the host flushes edits once per frame and again on app close,
so there is nothing manual to call. Main-thread only.
AppScoped<T> AppScoped<T>(string key) where T : new()
Parameters
keystring
Returns
- AppScoped<T>
Type Parameters
T
Log(LogLevel, string)
Writes to the host log at the given level. Any thread.
void Log(LogLevel level, string message)
Parameters
Log(string)
Writes to the host log at Info. Any thread.
void Log(string message)
Parameters
messagestring
Notify(NotifyLevel, string)
Raises a user-facing toast at the given level, shown verbatim (the host prefixes this plugin's name). Any thread. Not throttled — do not call every frame.
void Notify(NotifyLevel level, string message)
Parameters
levelNotifyLevelmessagestring
NotifyError(string)
Shorthand for Notify(NotifyLevel, string) at Error.
void NotifyError(string message)
Parameters
messagestring
NotifyInfo(string)
Shorthand for Notify(NotifyLevel, string) at Info.
void NotifyInfo(string message)
Parameters
messagestring
NotifySuccess(string)
Shorthand for Notify(NotifyLevel, string) at Success.
void NotifySuccess(string message)
Parameters
messagestring
NotifyWarning(string)
Shorthand for Notify(NotifyLevel, string) at Warning.
void NotifyWarning(string message)
Parameters
messagestring
RunOnMainThread(Action)
Queues work to run on the main thread at the start of the next frame.
Fire-and-forget; safe to call from any thread.
void RunOnMainThread(Action work)
Parameters
workAction
RunOnMainThreadAsync(Action)
Queues work on the main thread and returns a task that completes when
it has run (or is cancelled if the plugin unloads first). Awaitable from any thread.
Task RunOnMainThreadAsync(Action work)
Parameters
workAction
Returns
RunOnMainThreadAsync<T>(Func<T>)
Queues work on the main thread and returns a task carrying its result
(or cancelled if the plugin unloads first). Awaitable from any thread.
Task<T> RunOnMainThreadAsync<T>(Func<T> work)
Parameters
workFunc<T>
Returns
- Task<T>
Type Parameters
T