How to Create a Plugin

Top Previous Topic Next Topic  Print this topic

Requirements:

 

For creating a new plugin for Ecrion.Silverlight we need to install the following :

       Silverlight version 2 or 3

       Silverlight Tools for Visual Studio 2010

       Visual Studio 2010 SP1

 

 

Step 1: Create a new plugin project

 

An Ecrion.Silverlight plugin can be created by using the Silverlight Class Library project template.

 

Use the following steps to create a new Silverlight Class Library project:

Start Visual Studio 2010.
On the File menu, click New > Project. The New Project dialog box opens.
In the Project types pane, expand the Visual C# or the Visual Basic node and select Silverlight.
In the Templates pane select Silverlight Class Library.
Specify a name and a location for the class library and then click OK.

 

 

Step 2: Add a reference to Ecrion.Silverlight

 

Now we must add a reference to the Ecrion.Silverlight project. Expand the newly created project in Solution Explorer and right-click on References and select Add Reference.

 

Add Reference

 

Select Browse in the Add Reference box and navigate to Ecrion.Silverlight.dll in the Ecrion.Silverlight installation folder.

 

Add dll

 

Now we have access to the Ecrion.Silverlight classes and interfaces.

 

 

Step 3: Write the code to implement the plugin

 

We must implement the mandatory IAddin interface even if both methods return null.
The IVisualObjectFactory and IActionHandler interfaces are not mandatory but they will have to be implemented to add actual functionality to the new plugin.

 

 

Step 4: Register the new plugin to the main application

 

Build plugin solution in the Release configuration to create the dynamic libraries.
Copy all the dynamic libraries to the Ecrion.Silverlight XAP file.

 

Note: A XAP file is a Zip archive which can be opened with any archiving utility.

 

Edit the AppManifest.xaml file from the Ecrion.Silverlight XAP archive. We must add an AssemblyPart tag for every DLL file that we export. For example, if our plugin is called Plugin.dll, we must add this line of code:

 

<AssemblyPart Source="Plugin.dll" />

 

Note: If the plugin name is incorrect, the plugin will not work.

 

 

That's it. The new plugin should be integrated inside the Ecrion.Silverlight XAP.

For a full example with source code included, please see our Plugin Sample.