Don’t get me wrong; I love the Twitter Notify plugin that you can download for Live Writer (which is itself the most amazing piece of software in existence today). However, I track almost all of my stuff through a bit.ly account and I tweet about every blog post. I want the option to use bit.ly instead of tinyurl. So, a new plugin must be created!
Looking for more tips on Writer plugin development? Check out the Top Tips for Writer Plug-in Developers at Scott Lovegrove’s blog.
Right now, Writer supports plugins that run on the .NET Framework 1.1 or 2.0. You can still use VS2010, just target the project to the 2.0 framework to ensure that it will compile.
Before we start, make sure that you have Windows Live Writer installed. The API is installed by default in the C:\Program Files\Windows Live\Writer.
Let’s go ahead and get started!
using System.Windows.Forms;using WindowsLive.Writer.Api;
1: using System;
2: using System.Collections.Generic;
3: using System.Text;
4: using System.Windows.Forms;
5: using WindowsLive.Writer.Api;
6:
7: namespace MyBitlyTweeter
8: {
9: public class MyBitlyTweeterPlugin : PublishNotificationHook
10: {
11: public override void OnPostPublish(IWin32Window dialogOwner, IProperties properties, IPublishingContext publishingContext, bool publish)
12: {
13: base.OnPostPublish(dialogOwner, properties, publishingContext, publish);
14: }
15: }
16: }
[WriterPlugin("CD0182F3-54DC-42FA-8330-469CA1E7EE58", "bit.ly + twitter plugin", Description="Allows you to send a tweet with a bit.ly url tied to your account.", PublisherUrl="http://www.danwaters.com")]
public class MyBitlyTweeterPlugin : PublishNotificationHook
...