What are we doing we need to add some service to our application? Yes, we are looking all over the Internet to find some solution, which may be not found or work not just like we want. In that case, your starting to build your own implementation. Now, with Seesmic Desktop Platform you can do that easily. All services that are developed, will be available in plugin marketplace and available to all Seesmic Desktop users. This platform is built upon Silverlight 4 and is quite simple to extend.
The SDP (Seesmic Desktop Platform) Plugin SDK is the foundation for adding new functionality to the desktop client. The whole process of creation consist of 3 parts:
- Composition or Registration of Plugin Functionality
- Data Templates setting
- Data Proccesing
What do we need?
- Visual Studio 2010
- Silverlight 4 runtime
- Silverlight 4 SDK
- Silverlight 4 Tools for Visual Studio 2010
And, of course, you must install SDK.
Then we are creating normal Silverlight Application hosted in a web site or you can install Templates from Expression Gallery.
Configuring the AppManifest.xaml:
<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>
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.
Now, add reference to Seesmic.Sdp.Extensibility.dll , Seesmic.Sdp.Utils.dll and System.ComponentModel.Composition.dll and start building your plugin class!
You can use this sample as a startup:
using System; //We need this to compose our plugin 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; //This from SDP that you've downloaded using Seesmic.Sdp.Extensibility; namespace Seesmic.Sdp.SamplePlugin { //This directive is showing that our plugin will be exported [Export(typeof(IPlugin))] public class SamplePlugin : IPlugin { #region IPlugin Members //You will set the GUID generated by you public Guid Id { get { return new Guid("PUT_YOUR_GUID_HERE"); } } //This is data setting 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 } }
Or if you now MEF and want to use IAccountProvider interface:
[Export(typeof(IAccountProvider))] public class SamplePlugin : IAccountProvider {...}
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.
Whole platform is still in development stage. There are only 10 ore bigger plugins, but they sure are useful. Documentation and samples can be found here. “Post -build event command line” text area and then save the properties:
copy /y "$(TargetDir)\$(TargetName).xap" "%HOMEDRIVE%%HOMEPATH%\My Documents\Seesmic\See