Non UI learning’s about SilverLight 3.0

I liked the following non user interface aspects of SilverLight 3.0 .

  • No dependency of .net framework on target box.
  • No need of pipeline, no need of pages and page life cycle.
  • out of Browser experience. A Silverlight application can be. Always connected, Always disconnected and Occasionally disconnected.
  • Support for hardware acceleration. performance of complex animations and video playback depended heavily on the capabilities of the host PC.

I am summarizing my learning’s and limitations of SilverLight 3 out of browser applications(OOB) for my reference Please look at this tutorial for detailed steps.  Upon user consent, a Silverlight app running in the browser can be detached and pinned on the user’s desktop. On Windows this can be through Start menu and/or Desktop shortcuts. On the Mac the user can drag and drop the application bundle to a location of their choice. The application can be removed by right-clicking on the out-of-browser application and choosing Remove Application from the popup menu. This can be done from either the out-of-browser application or from the same version running in the browser.there is no entry as of today in Add/Remove programs of Control Panel. Bookmarking this blog.

  • SilverLight Execution Model: when the browser client request the entry HTML page, the browser downloads the HTML file and the linked.js file.while processing the HTML page, the client browser executes the javascript code that creates the SilverLight content region. Now the client side browser downloads the linked XAML file.
  • sllauncher.exe : when  the Silverlight 3 application is detached, it can be run from the Start menu or from a desktop icon. Out-of-browser applications run on the desktop inside a window that is hosted from the sllauncher.exe process. The out-of-browser applications can still access the network and use all of the .NET framework libraries available to Silverlight while they are detached. when installed on a client’s machine, launching the Silverlight application actually launches an application which hosts the Browser control. The Browser control then hosts the Silverlight application.
  • Isolated Storage: SilverLight applications can persist data in  the file system using the Isolated Storage mechanism to store client side cache data. Every silverLight application is allocated 25 MB of data for it use from isolated storage by default. The size of storage space can be increased.
  • Application Updates: when a out of browser application on its launch checks with the server for updates. If an update is available, an event fires so the app can notify the user that a  newer version is available. The newer version is automatically downloaded and then executed the next time the OOB is started.
  • AppManifest.xml file : This file has settings to determine whether the silverlight application cannot be detached and run out of browser.Effectively  manifest file helps you to enable or disable the out of browser experience for a silverlight application.
  • Application.Current.RunningOffline property. This property returns a Boolean value that indicates whether the Silverlight application is running online (in browser) or offline (out of browser). For example, when you application runs online, the application can communicate with the browser’s DOM. when the applications runs offline, the application is hosted in the sllauncher.exe process and does not have a DOM (since it is not a browser). Before interacting with browser’s DOM , one could check the RunningOffline property.
  • Network Connectivity: It is possible to detect whether a network connection is available, using NetworkInterface.GetIsNetworkAvailable() method in the System.Net namespace. This check is essential when running an out-of-browser application that must communicate with Web services.
  • Network address change :A silverlight application can subscribe to NetworkChange.NetworkAddressChanged event (also part of the System.Net.NetworkInformation class) to detects a network address change
  • Execution States  Silverlight notifies the app on momentous events throughout its lifetime and transition from in-browser to out-of-browser, allowing the app to model its UI accordingly.Application is notified by an event (ExecutionStateChanged) whenever the execution state of the application changes.

Known Limitations as of today

  1. SOAP web requests have no cookie support
  2. No ASP.Net Session state available for SilverLight applications. We can try to make use of WCF session to pass the user profile on multiple calls.
  3. No printing capability
  4. No mechanisms limit the number of instances to single instance
  5. No support for windows mobile
  6. No HTML DOM bridge access or xml http
  7. Debugging offline instances is not directly supported  by VS 2008 like the debugging support for online instances . You should attach sllauncher.exe manually to debug offline instances.There is no way to distinguish between multiple, simultaneous off-browser Silverlight apps.
  8. when you uninstall the out of browser application, isolated storage is not removed by default.
  9. There is no option for declining the update of an application when the deployed application has been upgraded.
  10. No infrastructure support to handle scenario where the data model of the existing OOB application does not match with data model of the upgraded application. If your data model changes require a restart . Be good to your users, show UI for major updates..

Let me end with a question to ponder and search answers in future updates: Is SilverLight going to replace a lot of web and Winforms applications? is there any relation between SilverLight and ASP.NET MVC?