You are here: Plugin API > Plugin API

.

MadCap Software plugin API

Following is the internal documentation for the MadCap plugin API.

What You Need

Here is what you need before you begin.

Getting Started

Complete the following steps.

  1. Create a new “Class Library” project in Visual Studio.
  2. In the new project dialog, select .Net Framework 4.0.
  3. Add a library reference to the B3.PluginAPIKit.dll assembly.
  4. Implement the IPlugin interface.

    Here is a basic example where the function of the plugin is to simply show a MessageBox whenever the plugin is activated or deactivated.

    using System;

    using System.Windows.Forms;

    using B3.PluginAPIKit;

    namespace DemoPlugin

    {

    public class DemoPlugin : IPlugin

    {

    private IHost mHost;

    private bool mActivated;

    public bool IsActivated

    {

    get { return mActivated; }

    }

    public string GetVersion()

    {

    return "1.0";

    }

    public string GetAuthor()

    {

    return "Bob Smith";

    }

    public string GetDescription()

    {

    return "Displays a message box.";

    }

     

    public string GetName()

    {

    return "DemoPlugin";

    }

    public void Initialize(IHost host)

    {

    mHost = host;

    }

    public void Execute()

    {

    mActivated = true;

    MessageBox.Show(GetName() + " activated!");

    }

    public void Stop()

    {

    MessageBox.Show(GetName() + " deactivated!");

    mHost.Dispose();

    mActivated = false;

    }

    }

    }

Integration with Flare

Flare monitors the Plugins folder under its root application directory. Any valid plugin it detects inside the Plugins folder will be listed in the Plugins dialog under Options.

Within the Plugins directory, create a new folder named after your plugin. For the example above, the plugin directory is named “DemoPlugin." After creating the folder, add your built plugin assemblies and resource files into that directory. The directory hierarchy should look as follows:

Flare.App

Plugins

DemoPlugin

Plugin Assemblies+ Resource Files

Enable Plugin in Flare

Do the following to enable the plugin for Flare.

  1. In Flare, open a project.
  2. Open up the Plugins dialog.

    Using the Ribbon interface, this is under File>Options>Plugins.

    Using the Toolstrip interface, this is under Tools>Options>Plugins.

  3. In the list of the plugins, locate your plugin and click Enable.

Note: For the plugin to take full effect, an application restart is highly recommended.