Day #23: Silverlight Outside The Browser (Part 1 of 3)

Enabling Out Of Browser in Your Silverlight App

For the next three days in the 31 Days of Silverlight, we’re going to cover some of the intricacies of getting a Silverlight application to run outside the user’s browser. This is a relatively simple change to your app, but it also introduces new challenges, like the need to detect which mode the user is in, and whether they have network connectivity or not. The next two articles will cover these topics specifically.

Today, we’re going to show you how to get out-of-browser working. So let’s get started.

To make this a little easier, I have created a sample project for you to start with. Inside, you’ll find a simple application that has a video player, and two images. The first image indicates whether there is network connectivity, and the other is to allow the user to “Install” the application to their machine.

But before we deal with any of that, we need to get our application “enabled” for the out of browser experience. By default, Silverlight 3 applications are not enabled.

1. Go to your Silverlight project properties

Opening the properties of your Silverlight project will give you the choice to “Enable running the application out of the browser, in addition to some new configuration choices. We’ll get to those in a second. Here’s what the screens look like:

2. Customize Your Settings

Once you’ve enabled Out of Browser for your Silverlight application, you get a new button to customize the settings for your installation. It includes things like titles, descriptions, and icons of different sizes for the shortcuts on your user’s machines. Here’s my completed Settings screen:

In case you’re curious, these settings are saved in a new XML file in your project. Look for OutOfBrowserSettings.xml in your Silverlight project’s Properties folder. Here’s what my settings file looks like:

<OutOfBrowserSettings ShortName="Big Bang Theory" EnableGPUAcceleration="False" ShowInstallMenuItem="True">
<
OutOfBrowserSettings.Blurb>This application will play the theme song for the CBS television show Big Bang Theory in a video found on YouTube. You can also find the video here: http://www.youtube.com/watch?v=lhTSfOZUNLo</OutOfBrowserSettings.Blurb>
<
OutOfBrowserSettings.WindowSettings>
<
WindowSettings Title="Big Bang Theory" Height="480" Width="640" />
</
OutOfBrowserSettings.WindowSettings>
<
OutOfBrowserSettings.Icons>
<
Icon Size="16,16">globe_16.png</Icon>
<
Icon Size="32,32">globe_32.png</Icon>
<
Icon Size="48,48">globe_48.png</Icon>
<
Icon Size="128,128">globe_128.png</Icon>
</
OutOfBrowserSettings.Icons>
</
OutOfBrowserSettings>

3. Installing the Application

I’ve chosen not to embed my application below (you can launch it here), because it has audio, and I don’t want to have that playing while you’re reading this post. If you right click on the application, you should have a second choice: Installing the application. If you choose this, it will save your application down to the local sandbox on your machine, and also gives you some choices for where to install it. When you’re done, it will also launch the local version for you as well. At that point, you can close your browser, and the application still works.

Here is a screenshot of the installation dialog (with my custom icon):

And here is a screenshot of the application running in the out-of-browser window.

Summary

You can see that this is a pretty simple process to enable Out of Browser functionality for your Silverlight application. In the next two days, we’re going to work on adding to this application, detecting whether the user has installed it or not, and then whether or not they have a network connection. Yes, Virginia, your Silverlight application can now run in a disconnected mode. See you tomorrow!

If you’d like to download this starter application, you can get my Out of Browser solution here.

7 thoughts on “Day #23: Silverlight Outside The Browser (Part 1 of 3)

  1. We are getting into semantics again. If we use words, there is a very grave danger they will be misinterpreted.

  2. We are getting into semantics again. If we use words, there is a very grave danger they will be misinterpreted.

  3. They must often change who would be constant in happiness or wisdom.

  4. Cold If the thermometer had been an inch longer we'd all have frozen to death

  5. I remember being handed a score composed by Mozart at the age of eleven. What could I say I felt like de Kooning, who was asked to comment on a certain abstract painting, and answered in the negative. He was then told it was the work of a celebrated monkey. 'That's different. For a monkey, it's terrific.'

  6. The basis of a democratic state is liberty.

  7. There are people who strictly deprive themselves of each and every eatable, drinkable, and smokable which has in any way acquired a shady reputation. They pay this price for health. And health is all they get for it. How strange it is. It is like paying out your whole fortune for a cow that has gone dry.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s