Category Archives: Silverlight

Out of Browser feature of Silverlight

Out of Browser is one of the great features of Silverlight. This is the feature that allows us to take our Silverlight application and run it like a desktop application. An Out of Browser application can run without a network connection also and if our application uses network resources then we can show some indicator saying “Connection is unavailable”,

We can use isolated storage as an offline cache that we can synchronize with online database when connection is available.

To make the application Out of Browser we have to follow few steps

1. Configuration

Right click on the Silverlight Application

1

Click Properties

2

Check “Enable running application out of the browser”

Click “Out-of-Browser Settings…” button.

3

Enter Window Title (Give proper Window Title this will be shown in the title bar of the Application)

Enter Shortcut Name, Description of the application and select icon for the application.

Let check “Show install menu” be checked. (It will show Install/Uninstall options to user when user right clicks on the application)

That’s it.

2. Installation

Now run the application. You will find an option to install the application by right clicking.

We can have our own button for installing the application also as shown in the picture.

5

Once if we click on “Install ……………….” Install application dialog will appear.

6

Check both the checkboxes –> Click ok

7

Application is installed and you can find an icon on the desktop as well as in Start Menu.

Run the application.

 9 

Here we can see the status saying “Application is running out of browser” and Install button is invisible because application is already installed.

3. Uninstall

If we right click on the application, “Remove this application” option will be present for uninstalling the application. Just click it.

10

We can uninstall from “Add or Remove Programs” tool also

8

 

Code to install the application manually

Application.Current.Install();

 

We can check the InstallState of the application like this

if (Application.Current.InstallState == InstallState.NotInstalled)
{
    btnInstall.Visibility = Visibility.Visible;
}
else
{
    btnInstall.Visibility = Visibility.Collapsed;
}

 

To check whether application is running out of browser or inside the browser we can write this code.

if (Application.Current.IsRunningOutOfBrowser)
{
    lblMode.Content = "Application is running out of browser";
}
else
{
    lblMode.Content = "Application is running in browser";
}

Important points about Out of Browser ->

Q – When Silverlight application runs as Out of Browser Mode, will it be able to access local resources?

A. – No, Application run with the same security policies as in the browser.

Q. – Does it create a shortcut to access the Application?

A. Yes, While installing it asks whether Shortcuts to be created or not.

Q. – Does this application list in the Add/Remove Program after installing?

A. – Yes, It lists in the add/Remove program list

Q. – How can I uninstall the application?

A. – Application can be uninstalled from add/remove program or we can uninstall it from application itself (Open application right click -> Uninstall)

For more detail view this video

http://www.silverlight.net/learn/videos/silverlight-videos/out-of-browser-experiences/