DevelopmentAny developer can create his own plugin and share it with others.
To create plugin you need connect 4 libraries: Interface, Common, WPFControls, WPFWinForms
Simple plugin You should create new class and inherit it from:
public interface IPlugin {
void Init(IPluginContext context); // Initialization method.
UMenuItem[] Menu{get;}; // Method to get plugin menu.
Icon Icon { get; } // Method to get plugin icon.
}
Method Init is called only once: when plugin is created. It accept next parameter:
public interface IPluginContext {
IDataProvider DataProvider { get; } // Data provider - provide paths.
void RebuildMenu(); // Call it to rebuild menu
Icon GetIcon(string path, int id); // Method to get icon from file (result is cached for all plugins).
Icon GetSystemIcon(int id); // Method to get system icon (result is cached for all plugins).
void AddTypeToWarmingUp(Type t); // Method to add class to warming up queue (to improve startup speed). Result is cached for all plugins, type is created only once in STA thread.
}
Where
public interface IDataProvider {
string DataPath { get; } // Path to folder with plugin data.
string ToolsPath { get; } // Path to folder with tools.
}
Configurable plugin. If you need save settings for plugin, you should inherit from:
public interface IConfigurablePlugin : IPlugin, IConfigurable {
void Load(); // Method is called on plugin Load or when user pressed Reload button.
void Save(bool autoSaveOnExit); // Method is called on plugins save. autoSaveOnExit=true, on exit.
Func<Control> SettingsGetter{ get; }// Returns dialog control, if null, then dialog have no settings. Best practice is to use lazy initialization.
}
Attributes. Plugin should have 2 attributes:
PluginName - name of the plugin (should be unique),
PluginDescription - description of the plugin (you can see it on the page when you enable/disable plugins).
Exist base classes: * SimplePlugin - simplest implementation.
* SimpleConfigurablePlugin<TConfig> - Implementation with config file.
* ConfigurablePlugin<TSettings, TConfig> - Implementation with config file and settings dialog.
Installation. After plugin is ready, you should place it to the folder with plugins and put depends libririest to Library folder.