Blog

Silverlight 3.0 Application Out of Browser

By David Espino
 

Silverlight is a great plug-in that enables web programmers / web designers to create rich interface applications. However, it could be nicer to have our own copy of Silverlight application as a local application, maybe have a desktop icon to take a look to an important financial chart from our running business, maybe a local photo album, or any kind of gadget we want.

This is where the “Out of Browser” feature of Silverlight 3.0 comes into play. First we need to create a Silverlight Application project:

1

With our application created, we right click our Silverlight project and choose “Properties”. In the Silverlight tab, there is a checkbox which enables to the application to run out of browser.

2

The button next to it allows configure other properties about the window containing our Silverlight application when it runs out of browser like: Size, Icons, Title, etc.

3

With these settings established, Visual Studio creates an xml file with the entire configuration we just selected. The file is located within de Properties folder in our Silverlight project.

<OutOfBrowserSettings ShortName="MapaSitio Application" EnableGPUAcceleration="False" ShowInstallMenuItem="True">

  <OutOfBrowserSettings.Blurb>MapaSitio Application on your desktop; at home, at work or on the go.</OutOfBrowserSettings.Blurb>

  <OutOfBrowserSettings.WindowSettings>

    <WindowSettings Title="MapaSitio Application" />

  </OutOfBrowserSettings.WindowSettings>

  <OutOfBrowserSettings.Icons />

</OutOfBrowserSettings>

Finally we need to run or application to test the changes we just made. When the application is running and we right click to the Silverlight control inside the page, the browser shows a menu to install the application.

4

This option will open a popup menu with the installation shortcuts we want to add.

5

When you install the application, it downloads the Content (xap package) and generates the html file to host silverlight along with some metadata. Everything is generated at isolated storage, which will be the followings in Windows XP and 2003bi

<systemdrive>:\Documents and Settings\<username>\Local Settings\Application Data\Microsoft\Silverlight\OutOfBrowser\<appid>

For Windows Vista  and Windows 7 should be:

<systemdrive>:\Users\<username>\AppData\LocalLow\Microsoft\Silverlight\OutOfBrowser\<appid>

AppId is generated at runtime which includes some random number along with domain name so for example, if you are browsing it on a localhost, AppId could be something like “2748978495.localhost”.

Out of Browser is not really out of browser because you do need a host to host silverlight xap package so Silverlight Team did a clever implementation to load html file using SLLAUNCHER.exe and of course sllauncher uses the same infrastructure as real browser does by loading silverlight plugin(npctrl.dll-com dll)  to bootstrap silverlight core clr. It still uses an html with the Silverlight object, just as normal browser does.

With the link just created we can click on it and review our local Silverlight Application.

I hope it will be useful for your projects

See you later.

 

 

Comments

Leave a comment

 
 
 
 
CAPTCHA Image Validation