Steven Nagy .NET

Sunday, 27 May 2007

Beginning with Vista Sidebar Gadgets

If you if the new version of Windows (Vista) you'll be aware of the Vista sidebar and the gadgets that sit within it. There's a few to choose from.. I like the RSS reader and the weather gadgets from Microsoft. I also have a CPU monitor that monitors both the cores in my dual core CPU.

Microsoft have made what I believe to be an extremely easy to use API. All you need is some HTML skills (or you can use Dreamweaver or Expression Web) to create your look and feel, and some javascript skills to program against the API.

Yes you heard right... no managed code. The sidebar runs kind of like a mini browser. In fact Scott Barnes mentioned that it uses some of the rendering engine from IE7. The real cool thing is that if you can run it in a browser, you can run it in a gadget. This means you can use Flash or Silverlight. That's right! Flash powered sidebar gadgets.

Ok so for people like me who are hardcore developers, we LIKE managed code. Give me C# over Javascript any day! Well I did mention Silverlight right? So you right your sidebar in Silverlight 1.1 using C#... woohoo! The only downside is that if you want to use the gadget API to save data or in some way interact with the API, you need to write javascript. Not sure how to broach this just yet, but I'll let you know if I find a post about it.

So I've gotten interested in gadgets because of a competition at Microsoft. I'm writing a gadget that displays information about the surf at your local beach (as long as your local beach is in QLD Australia, because the competition must have a QLD theme!). I've done my UI design since I believe that you have to have a nice looking gadget because people will have this on their desktop permanently. In fact, all I've done is design, and some research about where to get the wave heights from. Unfortunately I'm having no luck with the latter. If anyone knows a reliable web service or web page with this information, I'd be most greatful (and I'll let you come over and play on my XBOX when I win it).

Here's some screen shots of my UI design:






I don't really want to go into too much detail but here is the basic steps to creating and running a gadget:

1) Find your gadget folder. Mine is:
C:\Users\Steven\AppData\Local\Microsoft\Windows Sidebar\Gadgets

2) Create a new folder for your gadget, example: SurfWatch.gadget
(I think the .gadget part is essential, not totally sure)

3) Create a HTML page for your gadget (any name is fine, mines: SurfWatch.html)

4) Create a gadget.xml file, which specifies which HTML file is used for your gadget

I don't really want to say HOW to do it all, because its all readily available at this URL which is pretty useful for learning the basics. Besides, my last post was quite large so lets keep this one short, eh?

If you are in QLD Australia, you should enter the competition. Good luck with gadgets!

Labels: , , , , ,

Friday, 25 May 2007

House Keeping

Just a quick entry to let you know what happened today.

I resigned from my job at Speedwell, giving 4 weeks notice. My new position will see me using the latest technologies in an innovative environment. I'll be able to get my hands dirty in WPF and WCF amongst other things, which should also aid in my Silverlight learning. I'll be able to post about more modern MS technologies, which means you all win as well!

However my aim this weekend is to do a post on events (beginner level, creating and consuming) and if I have time, http modules. I'm trying to claw back the developer aspect of this blog!

You can suggest anything you would like me to post about in the comments of any post.
Feel free to suggest anything, not matter what the difficulty level is. If I can't find an answer, I'll talk to the industry and find out for you!

Labels: , , , ,

Thursday, 24 May 2007

Reflector for Silverlight?

Silverlight 1.1 runs managed code. This means unlike 1.0 you can not just view source and see how the app works. Normally you would have analyse the files and find out where the dll resides, request the dll manually, then use reflector to view the code.

This guy Ernie Booth has written a plugin for Reflector that lets you point at a Silverlight app, and it does the rest! Check it out here.

Labels: ,

Wednesday, 9 May 2007

My First Silverlight App

I like to learn by doing. So after watching the ScottGu video on the
Silverlight website I decided to learn Silverlight by creating a Naughts and Crosses game (Tic Tac Toe). You can see my initial attempt here.

So I suppose its pretty crappy to look at, but hey, I'm no designer. And its my first app, so what do you expect??? I didn't want to post it until I could go back and make it better. It needs serious refactoring, there's missing functionality, and its probably doing things the "wrong way".

But Scott Barnes encouraged me to publish it now so I have. The idea now is to display the flawed project, and then post each iteration as it improves. At the end of each iteration, I'll post details about the changes and what improved. The focus won't just be about Silverlight specific functionality. For example, the way the CROSS control is loaded is purely hardcoded. Ideally there should be a dynamic way to load different CROSS Xaml files depending on user selection, such that a designer could just add a new Cross object from Expression Designer into a /Cross/ folder.

Hopefully as we progress on this project we'll come to realise some new design patterns for creating functionality that is friendly to designers and developers both, something that might not be so well defined because such integration hasn't existed before now.

So I am completely open to suggestions about how we progress from here. Oh, and to contributions too.

Labels: , , ,

Monday, 7 May 2007

Silverlight Events

Just a short post about Silverlight events.

When writing Silverlight apps using Orcas and Silverlight 1.1, there are 2 key ways that you can hook up events.

The first way is to specify the event directly in the Xaml:

<canvas mouseleftbuttonup="ClickMeButton_MouseLeftButtonUp" background="Red" height="30" width="100" name="ClickMeButton">

The second way (as demonstrated in the ScottGu video on the Silverlight.net site) is to do it in code:

ClickMeButton.MouseEnter += new MouseEventHandler(ClickMeButton_MouseLeftButtonUp);

In both cases there would be a resultant method to deal with the event like in all event driven applications.

I think most people are aware of the latter approach because of the video but the former approach also lets you keep your code behind a bit more tidy.

ende

Labels: , ,

Thursday, 3 May 2007

Visual Studio Orcas Beta

I only downloaded the March CTP about 2 weeks ago. Then last week Microsoft released Beta 1.
Its not like I'm complaining... I have 20gb a month so whats the problem?

http://www.microsoft.com/downloads/details.aspx?FamilyID=5d9c6b2d-439c-4ec2-8e24-b7d9ff6a2ab2&DisplayLang=en

That's it. Download it. There's also a white paper on Orcas:
http://www.microsoft.com/downloads/details.aspx?FamilyId=17319EB4-299C-43B8-A360-A1C2BD6A421B&displaylang=en

You can find Virtual PC versions floating around for the March CTP but even more interesting is that you can also download Beta 1 of Team Foundation Server and Team Suite as Virtual PC images as well.

Personally, I'm looking forward to LINQ, XLINQ, and intellisense for Javascript amongst other things. ASP.NET Ajax is also fully integrated and supported in Orcas. Check the white paper appendix for a full list of all the new features.

Going with this release is the Beta release of .Net Framework 3.5. I must say that I am a little lost when it comes to Microsoft's version numbering. Anyway, no need to install all those extensions floating around... Just go for 3.5. Suffice to say that there are a lot of cheaper hosting companies that do not support .Net 2.0 yet (well mine anyway!) let alone, 3.0, or 3.5. The releases are coming thick and fast, although it seems an eternity since I first saw LINQ at Tech Ed last year.

Oh finally, check out the video from ScottGu on the Silverlight "Getting Started" page.
http://silverlight.net/GetStarted/

You can download the 1.1 alpha tools for building Silverlight applications in Orcas. And Expression Blend is available for 6 month trial from the Microsoft web site. You'll be able to fully recreate the integration that Scott demonstrates in the video.

I certainly will be once this 5gb download finishes...

Labels: , , , , , , ,