Silverlight: TicTacToe final
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: Design, gadget, Orcas, ScottBarnes, Silverlight Blend, TicTacToe
4 Comments:
Nice work Snagy. It would be interesting to refactor it to remove as much as possible from the xaml code-behind. eg. Treat the xaml + xaml.cs as a dumb view in a MVP pattern.. That way you could get test coverage over your core game mechanics.
By adam11235, At 29 May 2007 20:10
You're right. I only half achieved it really. Now there's better controls available as well which makes some code redundant. Any advice for testing Silverlight apps? Also, get a chance to reply to my email yet? :)
By Steven Nagy, At 30 May 2007 07:01
I've had a quick look at testing possibilities for Silverlight - it is a hostable runtime so I'm sure support will arrive. That being said, I still think it's best to treat it as a tradional 'View' and thus move as much as possible away from it into POCO for easier testability (and just good design practice). You could image getting your Flash coding buddies re re-implement the 'View' in flash by simply telling them the interface methods the presenter expects.
By adam11235, At 1 June 2007 14:30
The feedback I've had at MS is that testing support will come. Also, given that Silverlight is here for a richer web experience and not to revolutionise development, I'd say you're right about MVP
By Steven Nagy, At 1 June 2007 20:57
Post a Comment
<< Home