Application.IsRunningOutOfBrowser Property
Silverlight
Gets a value that indicates whether the application was launched from the out-of-browser state.
Namespace: System.Windows
Assembly: System.Windows (in System.Windows.dll)
Property Value
Type: System.Booleantrue if the application was launched from the out-of-browser state; false if the application was launched from within its host Web page.
This property enables you to modify the behavior of your application when it runs outside the browser. For example, when running outside the browser, you can check for network availability and use alternate code paths to support offline mode.
For more information, see Out-of-Browser Support.
The following code example demonstrates how to use this property. This example is part of a larger example available in How to: Implement Offline Support for Out-of-Browser Applications.
private void UpdateUI() { UpdateNetworkIndicator(); installButton.Visibility = app.InstallState == InstallState.NotInstalled ? Visibility.Visible : Visibility.Collapsed; updateButton.Visibility = app.IsRunningOutOfBrowser ? Visibility.Visible : Visibility.Collapsed; isRunningOutOfBrowserTextBlock.Text = app.IsRunningOutOfBrowser.ToString(); installStateTextBlock.Text = app.InstallState.ToString(); } private void UpdateNetworkIndicator() { networkIndicator.Visibility = app.IsRunningOutOfBrowser ? Visibility.Visible : Visibility.Collapsed; bool online = NetworkInterface.GetIsNetworkAvailable(); networkIndicator.Text = online ? "ONLINE" : "OFFLINE"; updateButton.Visibility = online ? Visibility.Visible : Visibility.Collapsed; }
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.