Tag Archive: Out Of Browser Silverlight


In this blog post I will show you how to manage custom window and it’s events like Minimizing Window, Maximizing Window etc… , while running the application Out Of Browser. We will also use IsolatedStorageSettings API that requires the application to be trusted.

 

First of all I have added a new “CustomWindowPage” and then changed the RootVisual of my application as throughout this series of blog posts I will use the same solution so I have do it in App.xaml.cs file as shown in the image below.

Click the image to show in full view.

Now go to, => Silverlight Project ==> Properties ==> Silverlight Tab ==> Check the checkbox “Enable running application out of the browser” ==> Click “Out-of-Browser Settings…” button ==>check the checkbox “Require elevated trust when running outside the browser” and select the “No Border” from Window Style drop down menu as shown in the image below…

This will make changes in “OutOfBrowserSettings.xml” file as shown in the image below.

Now I have added some UI elements and wired up some events with them in the “CustomWindowPage.xaml” file as shown in the image below…

This will render the page in browser as shown in the image below…

Clicking on the “Install App” button will open the InstallWindow in the browser as shown in the Image below…

Now here one must notice couple of things,

1.> This Install Window is somehow different then in the first blog post (Check the image below).

2.> Second thing is the window in the image above is actually showing security warning to the user, who is trying to install the app on the local system.

It is because in Silverlight 4 wishlist, one thing users have been asking for is to enable Silverlight out-of-browser (OOB) applications to have more privileges.  And so now with this option we can now alter the OOB manifest to request more elevated permissions for our application. So this is the install window which actually warns the user that this application can access your system more then in compare of non trusted application.

We actually need to sign the xap file here that the user does not get such security warning and I will cover that part in my future blog post in this series.

In silverlight OOB app this elevated trust is required for many functionalities like to access local files on user’s machine, for COM interoperability and lot more. I will go through all this topics particularly in my upcoming blog posts in this blog series.

Now clicking on “Install” button in install window will open the app Out of Browser as shown in the image below…

You can minimize, maximize, resize, relocate and close this window because of the code shown here in the following image…

Here in the bottom of this image, there is the code to save window height and width into local system’s isolated storage. and finally following image contains the code which actually requires the elevated trust to run in our case.

In this code we are just retrieving the height and width of the window which was saved last time when window was closed.

So it was the second part of silverlight OOB blog series. Hope you find it interesting and fill free to put comments and questions below.

For more info on silverlight, just go to, http://www.silverlight.net

For more on silverlight 4, click here, http://www.silverlight.net/getstarted/silverlight-4/

For more details on Silverlight 4.0, you can also browse through following blogs………

http://timheuer.com/blog/          —  Tim Heuer Blog – Silverlight Program Manager

http://blogs.silverlight.net/blogs/jesseliberty/       — Jesse Liberty Blog – Silverlight Program Manager

http://johnpapa.net/              —  John Papa website

http://adamkinney.wordpress.com/          — Adam Kinney Blog — For Silverlight graphics, interface and Expression Blend

First of all sorry for being late on starting this multipart blog series.

In this first part I will show you how to configure silverlight app for running OOB and also show you some basics of checking network availability and update availability from silverlight OOB application.

To configure silverlight app for running OOB,

Right Click Silverlight Project => Properties => Silverlight tab => check the checkbox “Enable running application out of browser” => Click the “Out of Browser Settings” button which will open new window with the same name.

Click the following image for larger view.

In this window some OOB settings can be configured and it will also add one “OutOfBrowserSettings.xml” file at Silverlight Project => Properties => OutOfBrowserSettings.xml.

This xml file reflects the settings made in “OutOfBrowserSettings” window and this settings can be written directly from xml file instead of window as shown in the image below.

Now I have created a simple UI as in image below for checking that application is running OOB or in browser and to chech whether network is available or not. Here “Install” button will be visible only if application is running In Browser.

Now to check network, I am using System.Net.NetworkInformation API and to check application mode (In Browser or Out of Browser), I am using System.Windows.Application API as shown in the code below.

Now clicking on “Install” button will open the Install Window as shown in the image below.

Clicking on “OK” button will install the silverlight app OOB on local system and then the app can be opened as normal windows application from desktop shortcut or from start menu.

Now if we open the application simultaneously in browser and OOB, then we can see the code running successfully as shown in the image below.

Code in the image shown below takes care of updates made in the application. This code checks for update in application and then together downloads the update as well for OOB application.

If any update (I have changed the Background colour here) found we can show the messagebox as shown below. To see the updates in OOB app, it needs to be restarted.

So this was the first part of silverlight OOB blog series. Hope you find it interesting and fill free to put comments and questions below.

For more info on silverlight, just go to, http://www.silverlight.net

For more on silverlight 4, click here, http://www.silverlight.net/getstarted/silverlight-4/

For more details on Silverlight 4.0, you can also browse through following blogs………

http://timheuer.com/blog/          —  Tim Heuer Blog – Silverlight Program Manager

http://blogs.silverlight.net/blogs/jesseliberty/       — Jesse Liberty Blog – Silverlight Program Manager

http://johnpapa.net/              —  John Papa website

http://adamkinney.wordpress.com/          — Adam Kinney Blog — For Silverlight graphics, interface and Expression Blend

I am planning for a multi part blog series on Silverlight Out Of Browser Capabilities using Silverlight 4.

Recently I have explored the silverlight’s capabilities as an Out Of Browser application and I found it’s very much sound and interesting.

But what I have noticed is all the features of silverlight OOB (Out Of Browser) capabilities are not available at one place or not really available in proper order to explore for any developer like me. So I have decided to write a multi part blog series on Silverlight’s Out Of Browser capabilities.

So in next couple of months I will write around 8 blogs on the topic and the current list of  blogs is as following……

1.> Getting Started with Silverlight’s Out of Browser Capabilities

2.> OOB Custom window and events

3.> OOB Notification API

4.> OOB Trusted File Access

5.> OOB Trusted Network Access

6.> OOB Trusted COM API

7.> OOB XAP signing for trusted Applications

8.> OOB Using Isolated Storage

I will try to publish these blogs on time and in given order.

As I will write the blog, I will link that blog with the list given here that anyone can simply browse through any blog on the topic from here only.

I will use Windows 7 Ultimate 64 bit, Visual Studio 2010 and Silverlight 4.0 throghout the blog series.