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: , , , , ,

Sunday, 20 May 2007

Silverlight: TicTacToe final

I've posted version 3 (final) of TicTacToe for your reference. Demo and source code is all available.

I've tidied up the UI so it doesn't like totally n00bish. I've removed the winning line and incorporated some animations (otherwise, what's the point right?) .

It's been a good experience and a good tool for learning the new framework and capabilities. Here's a summary:
  • Not all XAML elements will work in Silverlight. For example, in Expression Design I created a CROSS and gave it a bevel. This renders with a Bitmap render expression in the Xaml but it causes runtime exceptions in silverlight... so no bevels!
  • Grouping your objects into canvas' helps management of those objects. In TicTacToe, once I started grouping and hooking up events on the canvas that groups the objects rather than the objects themselves, things became easier.
  • If trying to accomplish something in managed code, checkout the WPF reference on MS site. Although the code won't be identical for Silverlight, it will open up your eyes how to approach your problems.

My next Silverlight project will be something more interactive, flamboyant, and functional. This means it will be a bigger project as well; hopefully my trial versions of Blend and Design won't expire! Any suggestions welcome.

In the meantime, I'll also look at writing a Vista gadget and posting that code as well. I attended a demo from Scott Barnes the other night. He had some technical difficulties, but it looks extremely easy to create gadgets.

Labels: , , , , ,

Sunday, 6 May 2007

Vista: The View from Here

I wanted to post a little bit about my experiences with Vista.

Ok so I had a duel boot transition period while I set myself up on Vista. I didn't want any downtime so I kept XP running on one partition, and I decided to install Vista on another.

XP was ALREADY duel booting: I had a trial of Windows Media Centre 2005 running on another partition already and so was receiving the usual boot menu at startup. Since I bought Vista Ultimate which includes Media Centre, I decided to blow away that partition and use it for Vista.

Anyway after the install, my machine now asks me at boot up if I want to run:
1) Windows Vista
2) An earlier version of windows

Because I was still running my life from XP, choosing option 2 then presents me with my OLD bootup menu:
1) Windows XP
2) Windows Media Centre

Weird! Media centre is gone because of the Vista install. I guess its not very good at tidying up the MBR. What's worse is that I later decided to merge 2 partitions into 1 to install Vista again. I don't own partition magic, so was forced to blow away the partitions and start again. Now I get the following menu at startup:
1) Windows Vista
2) Windows Vista
3) An earlier version of windows
... and if you press 3, you get my old boot menu.

Naturally all this is not a big deal, but rather silly none-the-less. No doubt there are suitable records to edit to fix this. I'll find them sooner or later.

All in all, I quite like Vista. I especially like the sidebar and associated gadgets. There is an RSS reader that shows the feeds you have setup in IE7. There's a nice little picture show that cycles continuously, and there's also a weather gadget that shows Brisbane weather and temperature (although yesterday it said it was 22 degrees when I was sweating like a pig). You can download more gadgets as well... I found a nice simple CPU metre which is designed for dual core CPUs; it shows both cores, as well as RAM usage.

It's worth mentioning here that my RAM usage is sitting at over 1gb... and that's with only this IE window open. Vista is damn hungry!

One final thing. The commercial's that MAC have been showing on TV; you know the ones, with the 2 guys talking. Well there's one where PC comes to a "sad realisation" about how annoying his security software is. I can tell you that it is quite true... the amount of times during install that I got asked "Cancel or Allow" was amazing; having said that everytime it happened I was quite entertained, simply because of those Mac commercials. For me, it seems that those commercials softened the blow.

All up, I'm pretty happy. I'm still learning how to get around the OS and options. Naturally some software doesn't work, but nothing too stressful.

Labels: , , ,