Skip to content

Framework

Xjph edited this page Oct 21, 2021 · 1 revision

Foundational Framework for Observatory Core and its plugins

How To Use

ObservatoryFramework will already be included with any release of ObservatoryCore or its plugins. There is nothing for end-users here.

How To Really Use

ObservatoryFramework contains a set of common interfaces used for communication between ObservatoryCore and its plugins, as well as an extensive set of supporting types to facilitate reading data from the Elite Dangerous journal without requiring a plugin developer to handle JSON deserialization or any of the journals various idiosyncrasies.

Provided interfaces and their members are:

  • IObservatoryCore - Interface through which ObservatoryCore exposes functionality to plugins.
    • void SendNotification(NotificationArgs args) - Send a notification back to Core to be displayed and distributed to notifier plugins.
    • void AddGridItem(IObservatoryWorker worker, object item) - Adds a row of data to a worker's UI grid.
    • void ClearGrid(IObservatoryWorker worker) - Clears a worker's UI grid.
    • Observatory.Framework.Files.Status GetStatus() - Returns an object representing all the data in the current status.json file.
    • string Version - Returns the version of Core that has loaded the plugin.
    • void ExecuteOnUIThread(Action action) - Executes the specified action on the main UI thread. May be necessary for more involved handling of grid results.
  • IObservatoryPlugin - Base interface containing common members used by both workers and notifiers. A plugin dll which implements only this interface will not be loaded.
    • void Load(IObservatoryCore observatoryCore) - Called by Observatory Core on startup. Perform any initialization necessary here. Also passes an IObservatoryCore object which a plugin can hold onto if it needs to use any of its provided methods.
    • string Name - Property to provide the plugin's name to Observatory Core for display in various places.
    • string ShortName - Property to provide a shorter version of the plugin's name for display in space-constrainted places. A default implementation returning Name is provided so this can be omitted if not needed by a plugin.
    • string Version - Property to provide a version string of the plugin for display and update checks.
    • Observatory.Framework.PluginUI PluginUI - Property to get a copy of the UI used by this plugin. Can return null for plugins that do not require a UI.
    • object Settings - Property to provide a set of values defined as a class within the plugin used to store plugin settings, if necessary, otherwise null.
  • IObservatoryNotifier - Interface for plugins which will handle notifications.
    • void OnNotificationEvent(NotificationArgs args) - Called by Observatory Core when any other plugin generates a notification.
  • IObservatoryWorker - Interface for plugins which will process and respond to journal and status data.
    • void JournalEvent<TJournal>(TJournal journal) - Called whenever a new line is written to the Elite Dangerous journal. TJournal can by any of the types provided in the Observatory.Framework.Files.Journal namespace which inherit from JournalBase, or in other words, any possible Elite Dangerous journal event.
    • void StatusChange(Observatory.Framework.Files.Status status) - Called for all status.json file changes for up to the moment status monitoring. An empty default implementation is provided so this can be omitted if not needed by a plugin.
    • void ReadAllStarted() - Called when a user begins a Read All operation. Plugin authors are encouraged to suppress notifications during Read All operations, and may also find it necessary to change behaviour in other ways. An empty default implementation is provided so this can be omitted if not needed by a plugin.
    • void ReadAllFinished() - Called when a Read All operation completes. An empty default implementation is provided so this can be omitted if not needed by a plugin.

To begin creating a plugin either clone this repository and add it as a project reference for your plugin, or download the compiled dll and use it as an assembly reference. If using the repository as a project reference ensure you are using the same commit version as the version of Observatory Core you are targeting. Then simply implement one or more of the above interfaces.

Clone this wiki locally