I am recently working on the AddIn model for the .Net Framework. There are many Hosts, AddIns, and Pipelines written internally to test our current model. One day, this idea popped out. How about adding AddIn model to a real-life project and see how good (or bad) our current model is. The ideal project has to be extensible by adding new modules and be written in managed code. I picked Paint.Net. Paint.Net supports pluggable module for creating Effects. It is an ideal project to support AddIn model.
There are three goals that I am trying to achieve here
1. Port one or two Effect code to AddIn
2. Add AddIn hosting, discovery, activation code to Paint.Net
3. Make no change for existing Paint.Net source file
The last goal is to make sure that future change in Paint.Net won’t break AddIn mode and vice versa. The lazy way to do this is to wrap up the AddIn hosting code in a Paint.Net (PDN) Effect code. That would save me lots of time figuring out how to pass parameters to AddIn. Therefore I created a new PDN effect called AddInHostEffect
public class AddInHostEffect : Effect
public static string StaticName
public static Image StaticImage
public override EffectConfigDialog CreateConfigDialog()
AddInSelectorConfigDialog Selector = new AddInSelectorConfigDialog();
public override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle rois, int startIndex, int length)
The AddInSelectorConfigDialog is going to have AddIn discovery code and it will also help user to pick which AddIn to use.
One thing to notice is that all AddIn hosting APIs are in System.AddIn.dll. We need to add a reference to this dll before we go ahead writing host code.
Our next topic will be about AddIn discovery.