Geeks With Blogs
RizwanSharp; Sharp Technology with RizwanSharp

The day I read about what’s new in Silverlight 3 on Tim’s Blog, I got really amazed to know that what amazing features this new version has to offer Sigh…

Among all the cool features, Silverlight 3 provides developers the ability to enable offline application execution. In other words, a developer can provide a few settings in Application Manifest which will make an application be able to save on user’s computer.

So lets see how it works.

Create a Silverlight 3 Application in Visual Studio and open the manifest file “AppManifest.xml” which can be found under Properties folder in Solution explorer.

Contents of the file look like this:

<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
        xmlns:x="
http://schemas.microsoft.com/winfx/2006/xaml">
    <Deployment.Parts>
    </Deployment.Parts>

    <!-- Uncomment the markup and update the fields below to make your application offline enabled
    <Deployment.ApplicationIdentity>
        <ApplicationIdentity
            ShortName="Out of Browser Silverlight Application"
            Title="Window Title of Your Silverlight Application">
            <ApplicationIdentity.Blurb>Description of your Silverlight application</ApplicationIdentity.Blurb>
        </ApplicationIdentity>
    </Deployment.ApplicationIdentity>
    -->
</Deployment>

Ok Simply uncomment the

<Deployment.ApplicationIdentity>

……………
</Deployment.ApplicationIdentity>
Provide application name in ShortName attribute. Title of application host when this application is running out of the browser. Provide Description in <ApplicationIdentity.Blurb>Description of your Silverlight application</ApplicationIdentity.Blurb>

Whoops! Application is ready for out of browser execution.

Simply run the application:

image

In the context menu, you have the “Install” option enabled now. Let’s click the install and see what happens?

 

image

Select the Shortcuts locations and Click “OK”. Application is now installed on local machine and can be executed by clicking the created shortcuts.

image  image

 

You can optionally use Detach() method of Application class under user click to popup the install screen if application not currently installed.

Application.Current.Detach()


You can check if application is running out of the browser by checking value RunningOffline property of Application class.

bool offline = Application.Current.RunningOffline;

You can also provide a set of icons for your application using:

<ApplicationIdentity.Icons>
            <Icon Size="16x16">AppIcon16.png</Icon>
            <Icon Size="32x32">AppIcon32.png</Icon>
            <Icon Size="64x64">AppIcon64.png</Icon>
            <Icon Size="128x128">AppIcon128.png</Icon>
</ApplicationIdentity.Icons>

But make sure to add these images to your project with Build action set to “Content”.

That was it :) and here is the Source Code of Sample Application.

Happy Silverlighting :D.

Rizwan a.k.a RizwanSharp

Posted on Tuesday, March 24, 2009 11:26 PM C# , Silverlight , Silverlight 3 | Back to top


Comments on this post: Silverlight 3 Out of Browser Experience (Wow Starts Now)

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © RizwanSharp | Powered by: GeeksWithBlogs.net