How to implement offline support for browser applications in Silverlight

Source: Internet
Author: User
Tags configuration settings silverlight visual studio

This topic shows how to implement the following common scenarios for Silverlight browser applications:

Determines whether the application is installed outside the browser or running outside the browser. This way, you can perform content such as display branding that should normally be displayed using HTML. The instances in this topic use this information to hide the Install button or to display the network status LEDs.

Determine if the network connection is available. This allows you to disable network-dependent functionality or provide alternatives to web-based or browser-based resources. The examples in this topic use this information to update the network connection LEDs and to show or hide the update buttons.

Determines whether an application update is provided. If the connection is available, you can check for and download a new version of the application and prompt the user to reboot. The examples in this topic provide a basic demonstration of this functionality.

When an application runs outside of a browser, you can change its appearance and behavior at any time. However, in most cases, you should change your application as little as possible. This ensures that users do not need to learn a new user interface. However, if your application uses network resources, you should always display the network connection status in the user interface.

In this example, XAML specifies a user interface that displays network status indicators, installation buttons and update buttons, and several TextBlock controls. The text block is bound to the browser configuration settings, which are described in the XML at the end of this topic. You can copy these settings to the Browser Settings dialog box in Visual Studio. In addition, you can enable browser support in Visual Studio and then copy the XML to the project's Outofbrowsersettings.xml file. For more information, see How to configure applications outside of the browser.

Code-behind settings are DataContext used by bindings and handle the various events required to update the user interface.

When you run this example, either click the Install button or use the right-click menu option to install it. Note that after installation, the Install button will disappear. You can uninstall by right-clicking an external application or a web-based application. However, the Install button is not displayed again until you uninstall from a web-based application. This is because there is no longer any connection between an external browser application and a web-based version. If you uninstall from a browser application, the Install button will not be displayed again until you refresh the page.

You can test network connection indicators in external applications by disconnecting from the network and reconnecting. Note that the Update button disappears when the connection is not available.

In order to test the Update button, you should include the WEB application project in the Silverlight solution. After installing the application, modify and rebuild the solution in Visual Studio, and then click the Install button to download the update.

Run this example: Http://go.microsoft.com/fwlink/?LinkId=139798&sref=OutOfBrowser

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.