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

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