Weekend Activities...

Although I feel like I haven't accomplished much this weekend, I guess I actually did.  ;o)

Friday, I went to a Foo Fighters show with my girlfriend.  It was actually a lot of fun.  They had a special accoustic performance including "accoustic'ized" versions of a lot of their old songs as well as some new stuff.  They also plugged their upcoming accoustic album In Your Honor

Saturday, I went to a friend's birthday party at the Grotto on State.  It was actually fairly interesting.  I had a great time, don't get me wrong and it was fun to see my friend - but as the night wore on, I realized two things:

  1. The patrons that showed up around midnight were part of the trendy crowd.  The see and be seen type of people.
  2. I'm really not one of those people.  ;o)

I was probably as dressed up as I get outside of work - in a pair of jeans and a button down shirt, and I was clearly underdressed.  <sigh>  Around 1:30am, it was getting too packed and I was getting tired so I took off and waited for the stupid "L" to pick me up.  I knew I should have cabbed it home - it took entirely TOO long for the "L" to ferry me home.  Grrrrr....

In other news, I've discovered the joys of using Windows Live Writer to do my blogging instead of the web-based Community Server interface.  If you're not familiar with it, it's pretty slick.  You simply point the application to where your blog is hosted, set a user id/password combination and it will download the styles associated with your blog and then allow you to preview your entry as you type it.  It reminds me of a mix of MS Word and a simple HTML Editor. 

Perhaps the best thing about it (since I am a card carrying geek) is the fact that it comes with its own API for Developers with too much time on their hands to create an add-in.  As I appearantly had too much time on my hands on Saturday, I created a very simple add-in to get acclimated to the API.  My add-in is very simple and allows you to insert your current mood into your blog posting.  This is an activity that other blogs like LiveJournal allow you to do natively, but (sadly?) Community Server does not.  The installer for the plug-in can be downloaded from here.

The code is written in VB.net, which provided its own challenges as most examples are written in C#.  The code itself is fairly straight-forward.  You start by creating a new Class project and add the WindowsLive.Writer.Api assembly to your project references.  Then you create a new class that inherits from the WindowsLive.Writer.Api.ContentSource class.  You must also add some tags in front of your class declaration that will enable the Windows Live Writer application to use your new plug-in.  In the end, the class should look something like:

 
   1:      <WriterPlugin("605EEA63-B54B-4e6d-A290-F5E9E8229FC1", "Insert Your Current Mood", _
   2:          Description:="Insert your current mood into your blog post.", _
   3:          PublisherUrl:="http://www.samuraiprogrammer.com"), _
   4:      InsertableContentSource("Insert Your Current Mood", SidebarText:="Your Current Mood.")> _
   5:      Public Class MoodPlugin
   6:          Inherits ContentSource
   7:   
   8:          Public Sub New()
   9:   
  10:          End Sub
  11:   
  12:          Public Overrides Function CreateContent(ByVal dialogOwner As System.Windows.Forms.IWin32Window, ByRef newContent As String) As System.Windows.Forms.DialogResult
  13:              Dim insertForm As New MoodInsertForm
  14:              Dim result As DialogResult
  15:              Dim mood As String
  16:              Dim moodURL As String
  17:              result = insertForm.ShowDialog()
  18:              If result = DialogResult.OK AndAlso insertForm.MoodSelected Then
  19:                  mood = insertForm.Mood
  20:                  moodURL = insertForm.MoodUrl
  21:                  newContent = String.Format("Current Mood: &nbsp;<IMG src=""{0}""> &nbsp;{1}", moodURL, mood)
  22:              End If
  23:              Return result
  24:          End Function
  25:      End Class

That's really all there is to it.  There's another class that provides the UI for the selection of the Mood and a preview pane, but that's all pretty standard Windows Forms application code and doesn't really touch Windows Live Writer.

All in all, it was a good learning experience and shows the extensibility model that all applications should follow, IMHO.

 Current Mood:    accomplished

Published 27 August 06 11:58 by Greg

Comments

No Comments
Anonymous comments are disabled