Silverlight 5 : About Silverlight 5, Development Enviorment Setup and Silverlight Application Startup : Part 1

Silverlight is a cross platform plugin which works with all the popular browsers.

What is covered in the tutorial:

  • How to use Visual Studio and Expression Blend to create and edit your applications.
  • What’s new with XAML and how simple it has made application development with Silverlight.
  • Silverlight Panels
  • Silverlight Controls
  • How to add media and images to a Silverlight page
  • Animation and Storyboard
  • Templates
  • Dependency property and development concepts

Silverlight brings the power of the real desktop apps to browser applications. Now Microsoft is also working on the HTML5 framework keeping the future of web in mind. Silverlight can be considered as Microsoft’s platform for developing and deploying Rich internet Applications.

Silverlight 5 has

–          Great Media Support

–          Helps building Line of Business applications

–          3D support (through XNA 3D integration)

–          GPU accelerated video encoding.

–          Open Fonts type support

–          Text Improvements

–          Binding, debugging and other improvements.

–          Animation , Binding, Skinning and more

Silverlight is a native application and it runs on the computer but the default configuration is to run Silverlight as a browser plugin. It helps you write awesome cross browser application that can run either on PCs or MACs. You would be really excited to know that Silverlight is installed on 67% of the Internet connected devices (http://www.Statowl.com/custom_ria_market_penetration.php).  You can program in Silverlight using your favourite .NET language like C#, VB or Dynamic languages like python or ruby.

 

How To Get Your Development Environment Ready

–          Install Visual Studio (Professional, Premium and Ultimate). You can get it at http://www.microsoft.com/visualstudio/

–          Install Silverlight 5 Tools for Visual Studio 2010. It will configure VS for creating Silverlight 5 projects using Visual studio.  It also enables VS o use the latest WCF RIA Services (SP1). You can get it at http://www.microsoft.com/download/en/details.aspx?id=28358

–          Install Expression Blend Preview for Silverlight 5. You can get it at http://www.microsoft.com/download/en/details.aspx?id=9503

–          Install XA Game Studio 4.0 for game development. http://www.microsoft.com/download/en/details.aspx?id=23714

–          Install Microsoft Toolkit (Optional). You can get it at http://silverlight.codeplex.com

Silverlight Application Start up process for an Application

 

The key players in this case are Application manifest file and the Silverlight plugin. The steps are as follows:

  1. User requests an HTML page from the server.
  2. The Browser downloads the page and detects that there is a Silverlight content in the page. It does this by seeing that there is an <object> tag on the page.
  3. The Browser loads the Silverlight Plugin using the mime type.

Once you have built a Silverlight 5 project you will see the files in the Bin folder something like the below image:

Silverlight App Bin folder

Silverlight App Bin folder

Now when we open StartingUPTestpage.html it looks like something as below:

 

Silverlight App TestPage

Silverlight App TestPage

 

Silverlight App TestPage

Silverlight App TestPage

Now You can see the object tag (in the form section à div) that I was taking about. This will cause the Silverlight plugin to load.

Once the Silverlight Plugin is loaded the Browser goes back to the server and asks for the xap file.

Then the browser opens the xap file which is nothing but a zip file. It then reads the AppManifest.xaml file.The AppManifest.xaml file looks something like below:

 

Appmanifest.xaml

Appmanifest.xaml

You can see that the Manifest file contains the assemblies to load.

The Silverlight plugin then loads the runtime and then loads these assemblies.

Next it goes the Manifest and reads the information about the startup. As you can see in the Deployment part in the image above the EntrypointAssembly is StartingUP. Then it will find the class StartingUP.app which is mentioned as the EntryPointType. Now this Class is shown in the image below:

 

App.xaml.cs

App.xaml.cs

 

App.xaml.cs

App.xaml.cs

As you can see there is App Class in the StartingUP namespace. You can see in the Application_Startup method we have the RootVisual (Startup Page) as MainPage.

Now once this page loads the application is running and will run till either there is an unhandled exception or the user navigates away or the browser is closed.