Before you can start developing your first plugin, please make sure your system is configured correctly, and you have installed all the required software.
Required Software
Install the SDP Developer Preview
- Follow these instructions to install the latest version of the Seesmic Desktop Platform Developer Preview
Creating a Plugin Project
SDP plugins are basically Silverlight 4 applications that are bundled as XAP files. They consist of a manifest that describes the plugin, one or more assemblies, and additional resources.
To create a new plugin project, follow these steps:
- Start VS2010
- Run File > New > Project...
- Select "Silverlight" from the "Visual C#" category on the left, then "Silverlight Application" from the list of templates
- Enter a name for the project at the bottom
- Click on "Ok" to create the project
- On the next dialog, disable the checkbox for "Host the Silverlight application in a new Web site"
- Make sure that "Silverlight 4" is selected as Silverlight version
- Click "Ok"
Visual Studio now creates a new project and adds two XAML files by default - these can be removed from the plugin, as they won't be used. The next step is to add the meta-information for the plugin to the AppManifest.xml file, which can be found under Properties for the new project in the Solution Explorer.
Configuring AppManifest.xml
A typical AppManifest.xml file looks like this:
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sdp="http://schemas.seesmic.com/sdp/2010/deployment">
<sdp:Plugin>
<sdp:Id>INSERT_YOUR_GUID_HERE</sdp:Id>
<sdp:Name>Sample SDP Plugin</sdp:Name>
<sdp:Description>This is a sample SDP plugin.</sdp:Description>
<sdp:Version>1.0.0.0</sdp:Version>
<sdp:Vendor>Seesmic</sdp:Vendor>
<sdp:Copyright>2010 Seesmic Inc.</sdp:Copyright>
<sdp:HomepageUrl>http://www.seesmic.com</sdp:HomepageUrl>
<sdp:PlatformVersion>0.8</sdp:PlatformVersion>
</sdp:Plugin>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>
(Please note that you have to generate your own GUID for the plugin, and insert it into the XML above. The shell application won't load a plugin with a malformatted ID)
Add References to the SDP SDK
The last step to prepare your project is to add references to the Extensibility and (optional) the Seesmic.Utils assemblies that come as part of the SDK.
- Open the context menu for "References" in your project in the Solution Explorer and select "Add Reference...."
- In the dialog, switch to "Browse" tab and find the "Seesmic.Sdp.Extensibility.dll" from the SDK
- In Solution Explorer, expand the project node and under References right click on Seesmic.Sdp.Extensibility, then click Properties, then on the property grid set Copy Local to False
- Also add "Seesmic.Sdp.Utils.dll" like this if you want to use some of the utility classes it provides (make sure you set Copy Local for this reference too)
- Add a reference to System.ComponentModel.Composition.dll
Add Your Plugin Classes
While your project is now set up to be recognized properly by the shell application, it won't do anything yet. The next step is to add you own classes and implement the plugin's functionality. A good way to start is to add a class that implements the IPlugin interface, which will ensure the plugin is called to initilaize after it was loaded. (This is not a requirement, though - a plugin that isn't interested in running initialization code doesn't need to provide an implementation for IPlugin).
using System;
using System.ComponentModel.Composition;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Seesmic.Sdp.Extensibility;
namespace Seesmic.Sdp.SamplePlugin
{
[Export(typeof(IPlugin))]
public class SamplePlugin : IPlugin
{
#region IPlugin Members
public Guid Id
{
get
{
return new Guid("PUT_YOUR_GUID_HERE");
}
}
public DataTemplate SettingsTemplate
{
get
{
// TODO - if your plugin provides a settings UI, return the DataTemplate from here
return null;
}
}
public void Initialize()
{
//TODO - fill in initialization code here
}
public void CommitSettings()
{
//TODO - if your plugin provides a settings UI, here you can persist your settings
}
public void RevertSettings()
{
//TODO - if your plugin provides a settings UI, here you can revert your settings
}
#endregion
}
}
Please note the [Export(typeof(IPlugin))] for the plugin class. SDP is using MEF to compose plugins with the shell application, and this directive is required to tell MEF that this class exports the IPlugin contract. As the shell application imports all parts that export IPlugin, this allows MEF to wire up the plugin with the shell correctly.
Copying the Plugin to Your Plugin Folder
After you have built your plugin, you can copy the XAP to the app's plugin folder. If you want to automate this, you can also add a post-build event to your project that will do it for you:
- Open the plugin project "Properties" view
- Select the "Build Events" tab on the left
- Paste the following code into the "Post -build event command line" text area and then save the properties:
copy /y "$(TargetDir)\$(TargetName).xap" "%HOMEDRIVE%%HOMEPATH%\My Documents\Seesmic\Seesmic Desktop 2\Plugins"
After a successful build, the plugin XAP will now be copied to the plugins folder automatically.
That's it!
You should now ave a plugin that is ready to be loaded. Once it's copied to your plugins folder, just restart the application, and it should now show up in the list of plugins in the settings dialog. Congratulations, you've just written your first plugin!
Next, you should learn about the core concepts of the SDK.
Comments (2)
PetterKun said
at 4:32 am on Apr 26, 2010
Hello.
I have some doubts that I would like to discuss.
I followed these steps to create the test plugin but can not get this to work on Seesmic desktop.
I compiled the code that is written here and copy the file. XAP in My Documents / Seesmic / Seesmic Desktop 2/Plugins and I do not appear on the application.
Any suggestions?
Thank you.
George said
at 2:56 am on May 3, 2010
Hi Petter,
You can check the log file (My Documents / Seesmic / Seesmic Desktop 2 / Logs) for more details. You should see there the reason why your plugin was not loaded.
Also, feel free to join our plugin development group at http://groups.google.com/group/seesmic-desktop-dev where you could find helpful information or ask any questions about the platform.
Thanks,
George
You don't have permission to comment on this page.