Home > Microsoft .Net Development Tips > ASP.NET Development
Win Development Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ASP.NET DEVELOPMENT

How to write an out-of-browser Silverlight 3 application in 3 steps


Steven Porter, Contributor
04.17.2009
Rating: -4.50- (out of 5)


.NET Essentials Channel
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


With the release of Silverlight 3 Beta 1, Microsoft introduced the ability for Silverlight applications to run out of the browser. These "out of browser", or OOB for short, Silverlight applications are installed and have associated shortcuts just like traditional Windows applications. OOB Silverlight applications are still limited by the same security sandbox as their "in browser" counterparts, so all the security and local access rules still apply as if they were running inside of a browser.

As cool as the ability to run Silverlight application out of the browser is, Microsoft went one better by introducing functionality to run OOB applications offline. There are several different implementations and options for OOB disconnected Silverlight applications, but updating an existing Silverlight 3 application to run disconnected can be achieved in just three easy steps.

Step one: Configure the Silverlight application to enable OOB

Users can't install and run your application out-of-browser unless you allow it, so your first step is to configure the application to enable OOB. You do this by making some small updates to the application manifest XML file that's part of your Silverlight project. These updates include, but are not limited to, values for the name of the application, which shows in the title bar of the application window and a list of icons to display in various places.

That's it for step one; now the user will be able to right click on the running application and choose to install it locally. Alternatively, you could code your application adding an event, such as one triggered by a button click, to programmatically spawn the install dialog. This is done by calling Application.Current.Detach().

Step two: Test to see if you have an active network connection

OOB applications can run with or without an active network connection, so step two is to check the state of the user's network connection. You...


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
ASP.NET Development
How to use jQuery to solve Javascript browser compatibility problems
Silverlight 3 beta SDK download lets developers try new RIA features
Visual Studio's IntelliSense for jQuery doesn't autocomplete correctly
Dundas Map for .NET kicks up geographic visualization
Return to CodePlex: Into the Sandcastle…
VBScript Tutorial
Use PHP with Visual Studio to create Web sites
Visual Studio Team System Add-ins: Conchango Scrum for Team System and Scrum Dashboard
Visual Studio 2008 and .NET Framework 3.5 SP1 introduces ADO .NET Entity Designer
XAML as an everywhere presentation format

Silverlight and Expression application development
Trusted and sandboxed applications in Silverlight 4
Silverlight 4 overview: Ready for prime time
Inside Visual Studio 2010
Microsoft lightens up to Eclipse for PHP, Azure related application building
How to encode video markers for consumption in Silverlight and WPF
How to access cross domain Web services from Silverlight without a policy file
How to develop applications targeting both Silverlight and WPF
Microsoft takes on Adobe with Silverlight 3
Silverlight 3 beta SDK download lets developers try new RIA features
Silverlight plug-in for Eclipse highlights Microsoft's work on interop

.NET Framework development with XML and XAML
Embarcadero RAD Studio 2010
Ajax Learning Guide
Ajax Learning Guide
Open XML SDK ready for the road
XAML as an everywhere presentation format
Silverlight Spy scans XAML objects, eases JavaScript debugging
Java presentation tool outputs XAML files
Microsoft, Cisco et al. to partner on modeling language
Microsoft's XAML recasts UI development
XAML Learning Guide: Forums and Community

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Expression  (SearchWinDevelopment.com)
Expression Graphic Designer  (SearchWinDevelopment.com)
Expression Interactive Designer  (SearchWinDevelopment.com)
Expression Web Designer  (SearchWinDevelopment.com)
Moonlight  (SearchWinDevelopment.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


do this by calling the NetworkInterface.GetIsNetworkAvailable() method. This is a check to perform before making any Web service calls, since they would fail without a valid network connection. In addition to the GetIsNetworkAvailable method, you can also subscribe to the NetworkChange .NetworkAddressChanged event of the class. This event will fire anytime there is a change in a network connection's status.

Step three: Save data locally or remotely in Silverlight

The third and final step is to update your application to load and save data locally or remotely, depending on the state of the user's network connection. If your application is running with an active network connection, you should load and save as you would normally. In the case where your application is running disconnected, there are a couple of options for loading and saving data. One is to provide the user with a manual option for loading and saving data using the OpenFileDialog and SaveFileDialog classes, respectively.

A much better option, in order to give the users a seamless experience whether they're connected or not, is to use isolated storage to cache data. Caching data allows the application to load and save data using isolated storage when running disconnected. This option allows the user experience to remain seamless regardless of the connected or disconnected state of your application.

That's all it takes to implement a disconnected, out-of-browser (OOB) Silverlight 3 application.

Steven Porter is a Senior Consultant and Project Manager for Wintellect, a consulting/debugging and training firm founded by industry experts Jeff Prosise, Jeffrey Richter, and John Robbins. He specializes in technologies such as ASP.NET, ASP.NET AJAX, Silverlight, and WPF. Steve is a Microsoft MVP in Client Application Development and a frequent speaker at events such as user groups and code camps on topics ranging from Silverlight to Windows Workflow Foundation.

Rate this Tip
To rate tips, you must be a member of SearchWinDevelopment.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Database Programming Solutions - .NET XML, Visual Studio LINQ, ORM .NET
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts