When Written: Dec 2010
So the rumours of the demise of Silverlight seem to have been exaggerated to paraphrase Oscar Wilde. The other day the next version of Silverlight was previewed at the Silverlight Firestarter event (http://www.silverlight.net/news/events/firestarter )with a keynote by Scott Guthrie. This Version 4 is still in beta and due for release mid 2011. Silverlight is fast becoming Microsoft’s preferred way to develop desktop windows applications as well as building rich browser-based web applications. Whilst Silverlight will run on Macs it seems to me that Microsoft are targeting it mainly to the Windows operating system, because no doubt this is where their customers are. Should Silverlight be able to provide the same functionality on other platforms then that is a bonus, but current development seems to be very much driven by the needs of the Windows operating system.
In the past web based technologies for building applications have been limited as to how much access the code has to the hardware that it is running on because of security. Silverlight, like Flash normally runs from within its own ‘sandbox’ and so cannot access the file system nor the hardware of the host device. This does limit what an application is able to do. For example if you built a Silverlight word processor it would be severely limited if it could not access files on the computer or have control over how it can print out the data. An application may also want access to the camera on a mobile device or the GPS location services. Without this ability Silverlight would be unable to fulfil its intended role as an environment for the building of desktop applications. So version 4 now has both the previous ‘sandbox’ mode and a new ‘trusted’ mode. In this latter mode the application has full access to the ‘my’ area of the file system, that is ‘mydocuments’ , ‘mypictures’, ‘myvideos’ etc.
The first announcements of Silverlight 4 were at the firestarter event
The plan for version 5 of Silverlight will apparently extend this further and have full access to the host machine but the application will be digitally signed and if the digital certificate is from a trusted source then the application will have a greater level of access to the host device. I use the term ‘host device’ rather than computer as Silverlight will run on other devices like mobile phones; in fact the new Windows Phone 7 uses Silverlight as one of its main frameworks for application development. I had hoped to cover Windows Phone 7 development in a little more depth in this article but there have been some problems.
I currently have a loan phone from Microsoft and have been building a simple application for it. The purpose of this application is a little more than a ‘Hello World’ but not much more. I built it in Visual Studio 2010 and tested it using the built in phone emulator. All seemed to be fine, so whilst I still have this loan phone which is a HTC HD7 I thought it would be interesting to put my application onto it to test it further. The first hurdle to doing this is that your phone needs to be unlocked for developing purposes; to do this, there is a small application that is installed with the development tools that should allow you to do this. I say should, because two weeks later I am still waiting. The problem is the several layers of registration you have to go through before it will allow you to put your own application on your own phone. First you have to log in with your Windows Live account to a web page, no problem there.
Next you have to register at the Microsoft App Hub, here there are several steps that you have to go through. The first is verification of your email address, this is simple enough, they send you an email with a link in it, you click on this link and this then proves that you are the one who has access to that email address, all fairly standard stuff so far. Next a company called GeoTrust verifies your information and may contact you, I say may because it is at this point things have ground to a halt. Reading through the small print it seems this validation process is a simple one if you happen to live in the United States as they can use an on-line validation system. For the other 6.45 billion of us then we have to complete a Geotrust form complete with photo ID and a signature.
I have not yet received any such form from Geotrust although I did get so far as to have to pay £69 for a year’s development licence after which I got another confirmation email to approve this order which I did. After that, nothing and I am still waiting. Assuming that I get past this registration process, I should be able to unlock up to three Windows Phone 7s for development and put my applications on them without having to submit the applications to certification on Microsoft’s App store. It would be useful if Microsoft allowed a greater number of phones so that companies could write their own apps for internal use and roll them out to their users without the possible issues caused by submitting them to Microsoft for approval.
I had a little moan at Microsoft UK during a visit there the other day about these registration problems that I was having and a few days later the form from GeoTrust turned up where I had to supply a scan of my passport, which I had to return within three days. This was followed shortly by an email from Microsoft PR saying that a number of ‘fixes and enhancements’ have been made to streamline this registration process, so good news there then! They claim that 86% of the 1000 developers who are registering every week have their account vetted within 10 days, I obviously was in that other 14%, I wonder if that makes me special? Once registered and your application has be submitted and approved you can check how many downloads and payments you are due using the App Performance Reporting system.
Not quite the app to end all apps but it works!
Whilst I was creating this ‘killer app’ things changed in the development environment for the Windows Phone 7.Previously the only language supported was C# but now VB has been added which should open up development to a wider number of developers. A feature pack for Visual Studio also added debugging in XAML which has caused some excitement. Silverlight applications are coded in XAML in addition to which the whole look of the display objects are defined in XAML.
This combining of display and functionally within the same code normally makes debugging tricky as it is not possible to set a breakpoint within the code that renders the objects on the page, only the code that runs based on events that fire on the objects could have breakpoints added. True you could try breakpoint and debugging the resultant JavaScript from within the browser but this JavaScript is often generated by the server side objects and bears little resemblance to your original code and so it can be very difficult to find your way round things.
Now with this enhancement to Visual Studio it is possible to place breakpoints within the XAML and examine exactly the data values being passed to and generated by the XAML objects. This very worthwhile addition makes debugging Silverlight code so much easier and should speed up development considerably. Silverlight 4 has a number of other enhancements of previous versions, these allow greater control over text flow and printing, so that a Silverlight version of Office will not be far away one would guess.
Article by: Mark Newton
Published in: Mark Newton