Silverlight adventures
By admin on 12/07/2007
After my initial enthusiasms about Silverlight along came proper work and other such distractions and I somewhat halted my research. However I'm doing a brief presentation on it at a new tech user group in Southampton (12th July) and so thought best to brush up on the latest - nothing like last minute preparation!
I thought it might be interesting to blog the order of research from start to finish and a few thoughts along the way (interesting to whom I have no idea!). I'm just going to document my findings as I go and not edit the post other than corrections to highlight how easy/difficult it is to get into this stuff. I hope by the end of this post to have created at the very least an extremely basic Silverlight app, be in a position to impart a basic understanding to others as to what Silverlight is and to be able to field a reasonable amount of questions. Here at the start of the post I have no idea where this will go and apologies if this becomes a long one.
1 - GoogleI like Google. When interviewing potential employees I am always more interested in how people would find out what they don't know than what they already do know. I'm well aware I could just go straight to silverlight.net or hunt around on microsoft.com but I prefer to see what Google comes up with...
My first Google... okay I could have just gone there in the first place (told you I wasn't going to change this post). After a quick scan through the results most seem like press release type things and silverlight.net looks like the best place to start. 2 - Silverlight.netThis looks like it will be a useful starting point. To begin, "Introducing Silverlight":
Microsoft® Silverlight™ is a cross-browser, cross-platform plug-in for delivering the next generation of .NET based media experiences and rich interactive applications for the Web. Silverlight offers a flexible programming model that supports AJAX, VB, C#, Python, and Ruby, and integrates with existing Web applications. Silverlight supports fast, cost-effective delivery of high-quality video to all major browsers running on the Mac OS or Windows.
First few thoughts that spring to my mind after reading the above:
- "cross-browser" - which browsers? Guess: IE (duh), Firefox, Safari(?)
- "cross-platform" - which platforms? [educated]Guess: not linux. Does this include devices?
- ".Net based" - I'm aware the Silverlight plugin doesnt support full on .net, how much does it support? Which version?
- "AJAX, VB, C#, Python, and Ruby" - sounds good
- "and integrates with existing Web applications" - hmm I'd be interested in seeing an example of this that makes it mean more than just marketing talk
- "fast, cost-effective delivery of high-quality video" - I think this is where they will get one up on FMS due to licensing costs (more research needed) and video quality (although I've read recently about the latest Flash update including an improved video codec (comparisons needed)
- "all major browsers running on the Mac OS or Windows." - ha Mac first, is that to make a point or was it in alphabetical order? :P
So far so good, but that's really just summarised what I already knew, time to look at some of the examples and see if I have the latest player...
3 - example: Zero Gravity GameFirst thing I'm looking at is a game linked from the silverlight.net homepage, Zero Gravity. First thoughts were: "ooh a preloader, well i expected as such but I wonder if there will be a resurgence in the 'preloaders ruin the web' crowd as there was (still is) with Flash". The game loaded fine, played it for a couple of minutes, it looked pretty good and ran well, not the best game in the world but thats probably a good thing for me considering I need to get through a lot still and its getting late.
A point that I think will come up alot will be "well I can already do that in Flash what's the point of it?", which is fair comment and if you can do it in Flash already then why bother? However, if you do manage to learn some Silverlight it may (or may not) become apparent that certain types of developments are better suited to Silverlight and others to Flash, if you don't try it don't knock it, which is why I'm giving this a go here and why I was happy to agree to giving a presentation on it.
2.5 - Plugin installationOkay so I have blatently tried Silverlight things out before now which is why I had the plugin all ready to go. Well, not wanting to cut corners I'm going to try uninstalling and reinstalling the Silverlight plugin... Where to look, first stop Add/Remove programs... It's there amoungst a million other Microsoft things and the uninstall was fairly smooth, although I did have to close down Firefox for it to complete.
Now to try the game again, first thing of note is the plugin detection. I now see a nice glowing "Get Microsoft Silverlight (beta)" button... click. I'm taken to an MSDN download page offering me the Mac or Windows version of Silverlight. The windows version shows it's compatible on Windows XP and Vista and IE6, IE7, Firefox 1.5 and 2.0. Mac version is Firefox 1.5, 2.0 and Safari. Not bad, but looking at my site stats, were I to put a Silverlight app on this site I would be instantly eliminating 3-4% of my visitors without giving consideration to whether they would want to install the plugin. I click the download for the windows version. I'm now at an MS licence page which "I accept", save the file, run installer, DONE! I'm impressed, after actually getting to the download the install couldn't have been smoother, didn't even have to restart the browser... oh no, after trying the game again turns out on Firefox you DO need to restart the browser (couldn't it have told me that after install?). But still, browser restarts I can handle compared to system restarts, tried again and the game runs fine.
4 - Do somethingNow we sort of know what Silverlight is and what it can do, I want to actually create something myself. The "Get Started" Link on the silverlight.net homepage looks good...
Getting Started VideoThe video itself is running in Silverlight, it starts straight up and there's an option for full-screen, again this can all be done in Flash but either way this is how video should be and not waiting ages to install, open, buffer then watch with some other external plugin.
The initial demonstration in the video uses Visual Studio Orcas (MS codename for VS 2008), I guess I'll be downloading that next. It demonstrates a very simple create project, write some XAML (the UI markup language) and adds a C# event handler to create a basic Hello World. Looks easy, I think I can handle that.
It then goes on to demonstrate some simple functionality of Expression Blend which is the interaction design tool for Silverlight. Basically Blend allows you to drag & drop elements, manage timelines, create effects and design elements for your application much like you would with the stage and tools in Flash. In the video, Blend is launched from Orcas and instantly loads all of the project assets and displays the currently created simple xaml file in design view. He then goes on to animate a basic textbox by rotating and moving it.
The cool thing is he then switches straight back to Orcas and the xaml is updated, in the code view he can then invoke the animation he just created in Blend through C# in code-behind file. The workflow looks amazing! (watch the video - it's hard to explain)
Next the video shows an example of integrating a Silverlight Project within an existing asp.net web project by dumping the Silverlight app onto an asp.net webpage. Again Orcas makes this look very easy but we don't really know what's going on behind the scenes. An interesting point that is being demonstrated is that Silverlight can directly call asp.net web services (or any standard REST or JSON web service).
The video takes a rapid couple of steps forward and imports some custom controls into the project which then procedes to create a nice Flight Schedule tool - okay the end result is impressive but I think a few too many steps were skipped for it to be of any real value, although it does show you the potential.
Overall the video was a very good introduction to Silverlight. To begin with I'm going to look at using the expected Visual Studio Orcas (a new beta is to be released soon I believe) and an evaluation version of Expression Blend. This great workflow is what helps MS sell their products, I can already tell that whilst not using these tools would be possible, using anything else is going to cost alot of time.
5 - The toolsThe next section on the silverlight.net site offers downloads to the tools you'll need, the first is the Silverlight runtime which we already have, the next is Visual Studio Orcas. Yikes, that's alot of downloading, eight 700 meg files to get!
As well as the standard Orcas package we need the Silverlight tools for Orcas.
And if we're to be doing some funky designery interactiony stuff, we need Expression Blend (there is also the option of Expression Design which can be used for creating assets for Silverlight, but i'm going to leave that for now).
To install Blend you also need the .Net Framework 3.0.
To be continued...Whilst all this downloads I'm going to post where I've got so far to break up the post and to get this out before all the information is out of date! So far I've spent about 3 or so hours researching this across my limited spare time over the past couple of days. I'm pretty impressed how easy everything has been to discover, largely down to the Silverlight.net site so far. I'm also pretty confident I'll be able to get up and running with Silverlight relatively quickly.
Oh and if anyone reads this and has any questions/pointers they think I should cover in the next post leave a message in the comments and I'll see what I can do...
- Tags:
- Uncategorized