I’d like to provide you with a SilverBullet™, a small snippet of Silverlight, a class or namespace hidden in the silverlight .NET framework, to help you out in times of need. It’s not to learn, but something to keep in your pocket. Just remember it’s there and you’re safe.
When running Silverlight outside the browser, there’s the possibility that the computer that is running the applications is disconnected. This is where the System.Windows.ApplicationServiceContext class comes in. This class represents the initial state when the application is started. It has no methods of any significance, only two read only properties.
- ApplicationInitParams : Gets the parameters specified by the page where the silverlight plug-in is embedded in.
- RunningOffline: Indicated if the application is running in offline mode
The ApplicationInitParams property is a Dictionary of a string/string key/value pair and contains parameters with their values. On MSDN is a detailed article about how to define the HTML for using init parameters and query parameters and how to read them in Silverlight.
The RunningOffline property is a bool. It is True if the application is running offline and False when the application is running online. If you have enabled you application to run out of the browser, you can check this property to see if you can access any online services which may not be available when running offline.
Tags van Technorati: Silverlight