Second Stanza

February 5, 2008

Silverlight 1.0 Source Code Viewer

Filed under: Silverlight — Tags: , , — dfbaskin @ 8:48 pm

One of the purposes for this blog is to post source code that might be helpful to the development community. I wanted to create a simple viewer for the source code I will be posting (I get tired of downloading .zip files just to look at the two lines of code I’m interested in).

Also, being interested in Microsoft’s Silverlight platform, implementing a source code viewer using this new technology would be a good introduction to this platform.

So here’s a first whack at the viewer implemented in Silverlight 1.0. Unfortunately, it requires Internet Explorer at this point. FireFox has an issue with the <!DOCTYPE> statement and I need to update the javascript event handling and DOM methods to support FireFox. Opera, at this point, doesn’t support Silverlight.

Of course, Silverlight 1.0 is pretty basic. It doesn’t contain any form-type controls (like a text box control) and I ended up writing a lot more Javascript than I wanted to. I’m looking forward to the feature set of Silverlight 2.0, including making use of .NET languages and having a wrapper around the DOM object model.

However, the bottom line is that Silverlight 1.0 is still pretty capable. The implementation requires downloading a single zip file from the server, which contains the HTML-formatted source code and an index file. The formatted code is generated off-line using GeSHi. A separate zip file contains the original source code.

I hope to improve this with Silverlight 2.0 by eliminating the HTML-formated zip file and perform the syntax highlighting at the client.

Download / View Source Code
(View requires Microsoft Silverlight 1.0 and Internet Explorer)


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: