Steven Nagy .NET

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

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