2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-07-01 08:23:42 -04:00

Add initial API & Configuration

This commit is contained in:
2024-04-17 22:03:28 +10:00
parent 0ade7b8b1f
commit aa368471fe
13 changed files with 119 additions and 138 deletions

View File

@ -1,17 +1,18 @@
using System.Text.Json.Serialization;
using Observatory.Framework.Files.Journal.Combat;
using Observatory.Framework.Files.Journal.Exploration;
using Observatory.Framework.Files.Journal.FleetCarrier;
using Observatory.Framework.Files.Journal.Odyssey;
using Observatory.Framework.Files.Journal.Other;
using Observatory.Framework.Files.Journal.Powerplay;
using Observatory.Framework.Files.Journal.Squadron;
using Observatory.Framework.Files.Journal.Startup;
using Observatory.Framework.Files.Journal.StationServices;
using Observatory.Framework.Files.Journal.Trade;
using Observatory.Framework.Files.Journal.Travel;
namespace Observatory.Framework.Files.Journal;
using System.Text.Json.Serialization;
using Combat;
using Exploration;
using FleetCarrier;
using Odyssey;
using Other;
using Powerplay;
using Squadron;
using Startup;
using StationServices;
using Trade;
using Travel;
namespace Observatory.Framework.Files.Journal;
[JsonDerivedType(typeof(BackpackFile))]
[JsonDerivedType(typeof(CargoFile))]
[JsonDerivedType(typeof(FCMaterialsFile))]

View File

@ -33,11 +33,6 @@ public interface IObservatoryPlugin
/// </summary>
public string Version { get; }
/// <summary>
/// Reference to plugin UI to display within its tab.
/// </summary>
public PluginUI PluginUI { get; }
/// <summary>
/// Receives data sent by other plugins.
/// </summary>

View File

@ -1,74 +0,0 @@
using System.Collections.ObjectModel;
namespace Observatory.Framework;
/// <summary>
/// Class permitting plugins to provide their UI, if any, to Observatory Core.
/// </summary>
public class PluginUI
{
/// <summary>
/// Type of UI used by plugin.
/// </summary>
public readonly UIType PluginUIType;
/// <summary>
/// <para>UI object used by plugins with UIType.Panel.</para>
/// </summary>
public object UI;
/// <summary>
/// <para>Collection bound to DataGrid used by plugins with UIType.Basic.</para>
/// <para>Objects in collection should be of a class defined within the plugin consisting of string properties.<br/>Each object is a single row, and the property names are used as column headers.</para>
/// </summary>
public ObservableCollection<object> DataGrid;
/// <summary>
/// Instantiate PluginUI of UIType.Basic.
/// </summary>
/// <param name="DataGrid">
/// <para>Collection bound to DataGrid used by plugins with UIType.Basic.</para>
/// <para>Objects in collection should be of a class defined within the plugin consisting of string properties.<br/>Each object is a single row, and the property names are used as column headers.</para>
/// </param>
public PluginUI(ObservableCollection<object> DataGrid)
{
PluginUIType = UIType.Basic;
this.DataGrid = DataGrid;
}
/// <summary>
/// Instantiate PluginUI of specified UIType.
/// <para>(Untested/not implemented)</para>
/// </summary>
/// <param name="uiType">UIType for plugin.</param>
/// <param name="UI">Avalonia control to place in plugin tab.</param>
public PluginUI(UIType uiType, object UI)
{
PluginUIType = uiType;
this.UI = UI;
}
/// <summary>
/// Options for plugin UI types.
/// </summary>
public enum UIType
{
/// <summary>
/// No UI. Tab will not be added to list.
/// </summary>
None = 0,
/// <summary>
/// Simple listview, to which items can be added or removed.
/// </summary>
Basic = 1,
/// <summary>
/// Panel control which is placed in plugin tab.
/// </summary>
Panel = 2,
/// <summary>
/// UI used by Observatory Core settings tab.<br/>
/// Not intended for use by plugins.
/// </summary>
Core = 3
}
}