To update this blog I use Windows Live Writer. After playing around for a while I discovered that this application can be extended with plugins. So I decided to spend my sunday afternoon on trying to make my own plugin. And it turned out that this is actually pretty easy and interesting as well.
To create your own plugin, just open up Visual Studio, create a new class library and add a reference to the Windows Live Writer API. This API can be found in c:\program files\Windows Live\Writer.
After that you can specify what kind of plugin you'd like to create. There are several types.
Example:
Because code says more than words, a short example.
1: Imports WindowsLive.Writer.Api
2: Imports System.Windows.Forms
3:
4: <InsertableContentSource("PluginName"), _
5: WriterPlugin("310A4D7F-97F4-4db7-9A4A-DF6E88A4AF3D", _
6: "PluginName", _
7: PublisherUrl:="http://blogs.windowsclient.net/MathieuRoseboom", _
8: Description:="Description", _
9: ImagePath:="Image.png")> _
10: Public Class MyPluginContent
11: Inherits ContentSource
12: ' Methods
13: Public Overrides Function CreateContent(ByVal dialogOwner As IWin32Window, ByRef content As String) As DialogResult
14: Dim frm As New frmMain
15:
16: frm.ShowDialog()
17: If (frm.DialogResult = DialogResult.OK) Then
18: content = form.Code
19: Return DialogResult.OK
20: End If
21: Return DialogResult.Cancel
22: End Function
23: End Class
24:
25:
The pluginarchitecture uses attributes to determine the plugins. The InsertableContentSource attribute defines the plugintype. The WriterPlugin attribute defines that this class is a Windows Live Writer plugin and Windows Live Writer will automatically register this plugin.
The class inherits from ContentSource. This basically means that this plugin inserts content. (what's in the name)
The content parameter which is given By Reference can be filled with the end HTML code.
Resources:
Recently I 'discovered' this nice add-on for Visual Studio. I know, it's out for a while, but I think it's a very nice tool which helps you doing several standard tasks just a little bit quicker.
This add-in integrates into Visual Studio 2008 and will add several menu items on several places like opening a command prompt or open the folder containing the current project.
For more information: http://code.msdn.microsoft.com/PowerCommands. You can download the latest version there as well.