/Shos.PluginSample

.NET Plugin Sample (Windows Forms)

Primary LanguageC#MIT LicenseMIT

Shos.PluginSample

Sample to dynamically add plug-ins from C# source code.

(The GUI is based on Windows Forms.)

Image

  1. In the left text box, write a class or struct with a public string Name property, a char Shortcut property, and a void argumentless Run method.

ex.

    public class Foo
    {
        public string Name   => "Foo";
        public char Shortcut => 'F';
        public void Run() => System.Windows.Forms.MessageBox.Show($"{Name} is running.", Name);
    }
  1. Click the "Add Plugins" button to dynamically create plug-ins, add them to the menu, and make them executable.

The plug-ins are saved as DLLs in the "AppData" folder and will be added the next time it is launched.