Jump to content

Microsoft Silverlight

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Soumyasch (talk | contribs) at 08:56, 30 June 2007 (→‎Silverlight 1.1: SIL third party controls). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Template:Beta software

Microsoft Silverlight
Developer(s)Microsoft
Stable release
1.0 Beta / 1.1 Alpha / April 30 2007
Preview releaseNone [±]
Operating systemMicrosoft Windows, Mac OS X
TypeWeb Application framework
LicenseEULA
WebsiteSilverlight Homepage

Microsoft Silverlight (code-named Windows Presentation Foundation/Everywhere or WPF/E) is a proprietary runtime for browser-based Rich Internet Applications, providing a subset of the animation, vector graphics, and video playback capabilities of Windows Presentation Foundation. Version 1.1 also includes a complete version of the .NET Common Language Runtime, named CoreCLR,[1][2] so that Silverlight applications can be written in any .NET language.

The latest release is version 1.0 beta, with an alpha release of version 1.1 made available as well. The runtime is available for Windows XP, Windows Server 2003, Windows Vista and Mac OS X 10.4, with browser plugins available for Internet Explorer 6.0/7.0, Firefox 1.5/2.0 and Safari 2.0; Opera is not supported in the current releases but will be supported with future builds,[3] as will be Windows 2000.[4] Additional platforms are being considered as well.[5]

Silverlight aims to compete with Adobe Flash and the presentation components of Ajax. It also competes with Sun Microsystems' JavaFX, which was launched a few days after Silverlight.[6][7] The first CTP of Silverlight was released in December 2006. Microsoft aims to have a final release by mid-2007. An unattributed report claimed[8] that Microsoft aims to release certain parts of Silverlight source code as open source software, but the claim has been denied by Microsoft. Sam Ramji, Microsoft director of platform technology strategy, said Microsoft has no plans to open source Silverlight.[9] However, portions of the Dynamic Language Runtime, included with Silverlight, have been made available on Microsoft's CodePlex website using the Microsoft Permissive License.

Overview

Silverlight provides a retained mode graphics system, similar to WPF and integrates multimedia, graphics, animations and interactivity into a single runtime. It is being designed to work in concert with XAML and is scriptable with JavaScript. XAML can be used for marking up the vector graphics and animations. Silverlight supports playback of VC-1 video content across all supported browsers without requiring the Windows Media Player ActiveX control or Windows Media browser plugins. However, the EULA says VC-1 is only licensed for the "personal and non-commercial use of a consumer".[10] Content created with Silverlight would be more searchable and indexable than that created with Flash as it is not compiled, but represented as text (XAML).[11] Silverlight makes it possible to dynamically load XML content that can be manipulated through a DOM interface, a technique that is consistent with conventional Ajax techniques. Silverlight exposes a Downloader object which can be used to download content, like scripts, media assets or other data, as is required by the application.[12] It also supports common dynamic programming languages like Ruby and Python, which are more flexible and syntactically expressive than JavaScript or ActionScript. [13]

Silverlight 1.0

File:SilverlightGame.PNG
A Silverlight 1.0 application hosted in Internet Explorer

Silverlight 1.0 consists of the core presentation framework, which is responsible for UI, interactivity and user input, basic UI controls, graphics and animation, media playback, DRM support, and DOM integration.[14] It is made up of the following components:

  • Input - handling input from devices like keyboard, mouse, stylus etc.
  • UI core - managing rendering of bitmap images (including compressed raster images like JPEG), vector graphics, text and animations.
  • Media - playback of MP3, Windows Media and VC-1 streams.
  • XAML - to allow the UI layout to be created using XAML markup language.

A Silverlight application starts by invoking the Silverlight control from the HTML page, which then loads up a XAML file. The XAML file contains a Canvas object, which acts as placeholder for other elements. Silverlight provides various geometrical primitives like lines, ellipses and other shapes, to elements like text, images, and media etc. The elements are properly positioned to achieve the desired layout. Any arbitrary shape can be created as well. These elements can be animated using Event triggers; some animation effects are predefined, others can be created as composite of the pre-defined effects. Events like keyboard or mouse movements can also raise Events which can be handled by custom scripts.[15]

Programmatic manipulation of the UI is achieved by using scripting languages to modify the Document Object Model of the Silverlight Canvas object.[14] To facilitate this, Silverlight exposes a DOM API, accessible from any scripting language supported by Silverlight, which in version 1.0 release is limited only to JavaScript running in the browser. However, there are no UI widgets built in. The native widgets of the browser must be overlayed on top of the Silverlight Canvas for user input. Support for data formats is limited to XML, POX and JSON only.[14]

Silverlight 1.1

File:SilverLight.PNG
A Silverlight 1.1 application hosted in Internet Explorer

Silverlight 1.1 includes a version of the .NET Framework, with the full Common Language Runtime as .NET Framework 3.0; so it can execute any .NET language including VB.NET and C# code. Unlike the CLR included with .NET Framework, multiple instances of the CoreCLR included in Silverlight can be hosted in one process.[16] With this, the XAML layout markup file (.xaml file) can be augmented by code-behind code, written in any .NET language, which contains the programming logic. It can be used to programmatically manipulate both the Silverlight application and the HTML page which hosts the Silverlight control. Silverlight ships with a lightweight class library which features, among others, extensible controls, XML Web Services, networking components and LINQ APIs. This class library is a subset of and is considerably smaller than .NET Framework's Base Class Library. Silverlight code runs in a sandbox which prevents invoking platform APIs.[17] Silverlight 1.1 also adds support for DRM in media files.[14]

The version of .NET Framework in Silverlight adds[14] a subset of WPF UI programming model, including support for shapes, documents, media and animation objects of WPF. However, the set of UI controls Silverlight ships with in the current release is limited. Also, in the current release, the UI controls do not have support for databinding to any data source. But, Microsoft has clarified that the limitations are due to this being an early preview release. Future releases will add more UI controls, add databinding support, and automated layout management.[18] However, third party libraries for expanded sets of UI controls are being made available for the current alpha release as well.[19]

Silverlight 1.1 Architecture

The included Base Class Library (BCL) provides classes for collections, reflection, regular expressions, string handling and data access. It also supports LINQ, with the full support for LINQ to Objects and expression trees. Almost all of the System.LINQ and System.LINQ.Expression namespaces are exposed. However, LINQ to XML is not present in the Silverlight 1.1 Alpha release, though further releases of Silverlight 1.1 will include it.[20] It also supports serialization of objects, for data persistence. Silverlight can handle data in either RSS, POX, and JSON formats, in addition to XML. The BCL provides enhanced support for working with XML data, including the XMLReader and XMLWriter classes. Silverlight also includes classes for data access over XML-based Web services (POX), REST and WCF Services. The networking support in Silverlight can be used by Silverlight applications to communicate over HTTP. However, in the current release of Silverlight 1.1, cross domain communication is not allowed.[21] Silverlight also supports asynchronous programming via the use of the threading libraries.[18]

Silverlight 1.1 is distributed with the Dynamic Language Runtime which allows dynamic compilation and execution of dynamic (scripting) languages. The first available languages written for the DLR are Managed JScript and IronPython 2.0. Microsoft is also building IronRuby and Dynamic Visual Basic (VBx) languages. All four languages share the same infrastructure to allow Silverlight to compile and execute the language source. Conversely, other .NET languages must be compiled ahead of time and delivered to Silverlight as .NET assemblies. The implementation of Managed JScript conforms to the ECMAScript 3.0 specification, and Microsoft claims that it is 250 times faster than interpreted JScript.[18]

With the integration of .NET Framework, Silverlight also allows HTML-managed code interaction, which allows manipulation of HTML DOM elements from managed code,[14] as well as allow JavaScript code to call managed code and use objects instantiated by managed code. Silverlight encloses JavaScript objects and DOM elements in managed wrappers to make them available from managed code.[22] However, in the 1.1 alpha release directly calling JavaScript code is not implemented, but managed code events can fire JavaScript handlers. A Silverlight instance does not need to have a UI component in order to manipulate the HTML DOM from managed code.[23] It is done by creating a XAML Canvas with its width and height set to zero, and using its code-behind code to modify the Document Object Model of the HTML page via the APIs in the System.Browser namespace.[24]

File:SilverLightMS.PNG
A Python interpreter in Silverlight 1.1 hosted in Mozilla Firefox

Silverlight 1.1 also allows limited filesystem access to Silverlight applications.[22] It can use the operating system's native Open file dialog box to browse to any file (which the user has access to). The file will be sanitized of path information to prevent the application from getting access to information like user name. It will be opened in read-only mode. For local storage of data, Silverlight provides isolated local storage (isostorage),[22] which is stored, outside the browser cache, in a hidden folder inside the user profile's private folder. In the current releases, isostorage is limited to 1 MB per URL, though this limit will later be made configurable.[22] Data stored by a Silverlight application, identified by the URL that it loads from, can be accessed by that application only. All instances of Silverlight share the same isostorage, so all instances of a Silverlight application can share the saved data, even if they are running on different browsers.

Silverlight CoreCLR uses an attribute based security model, as opposed to the Code Access Security (CAS) model of the desktop version of .NET Framework.[25] All assemblies are marked with a security attribute, which can be either transparent (SecurityTransparentAttribute), safecritical (SecuritySafeCriticalAttribute) or critical (SecurityCriticalAttribute). Methods in transparent assemblies runs with partial trust, and any code in such assemblies cannot call critical methods. They also cannot contain unverifiable code (use the unsafe C# keyword or use pointers) or invoke system functions by means of P/Invoke. Code in both critical and safecritical assemblies run with full trust, and are not subject to such limitations. However, critical methods can only be called from safecritical methods and not transparent methods. Thus transparent methods are prevented from using methods that can cause system wide changes. Instead, they have to call safecritical methods which will verify that the call is safe and within the limited rights of the caller, and then proxy it to the critical methods. In fact, the IsoStorage APIs are exposed as safecritical methods.[25] An assembly that does not have any attribute set is run as a transparent method. The limitations also apply for type inheritance, virtual method calls and interface method calls as well.[26] Silverlight assemblies can contain members that are not usable by CoreCLR but can be by .NET Framework CLR; such methods will not be loaded when the assembly is being executed by CoreCLR.[27]

However, only platform code is allowed to be marked as Critical or SafeCritical. The Silverlight runtime ensures that platform assemblies are loaded only from the Silverlight installation directory, and are signed by Microsoft. This effectively means that all user application assemblies can only be transparent code and run under partial trust and limited rights.[28] Platform code can be marked with either attribute. The BCL methods of the .NET Framework, which have the Internet attribute set allowing them to be called from untrusted code originating from Internet, are exposed in Silverlight BCL as transparent methods.[28]

Development tools

Silverlight applications can be written in any .NET programming language. As such, any development tools which can be used with .NET languages can work with Silverlight, provided they can target the Silverlight CoreCLR for hosting the application, instead of the .NET Framework CLR. Microsoft has positioned Expression Blend 2.0 for designing the UI of Silverlight applications. Visual Studio 2008 can be used to develop and debug Silverlight applications. However, the current beta release of Visual Studio 2008 requires the Visual Studio Tools for Silverlight (currently an alpha release) to create Silverlight projects, and let the compiler target CoreCLR.[29] A Silverlight project contains the Silverlight.js and CreateSilverlight.js files which initializes the Silverlight plugin for use in HTML pages, a XAML file for the UI, and code-behind files for the application code. Silverlight applications are debugged in a manner similar to ASP.NET applications. Visual Studio's CLR Remote Cross Platform Debugging feature can be used to debug Silverlight applications running on a different platform as well.[30]

Moonlight

The developers of Mono Framework, a free and open source equivalent of .NET Framework, are developing an equivalent open source implementation, with Linux support, under the temporary name Moonlight.[31] It is reported as expecting to offer a feasibility "alpha" demo in mid-June 2007, with support for Firefox on Linux by the end of the year.[32] A public demo was shown at Microsoft ReMIX conference in Paris, France on June 21, 2007.[33]

Criticism

Silverlight has been criticized for lack of Linux support - or indeed any platform other than Windows and Mac OS X, citing it as a factor that could limit the widespread adoption of Silverlight.[9][34][35] However, according to Mike Harsh, a program manager for Silverlight, Microsoft will eventually port Silverlight to Linux after the work has been completed on the Windows and OSX platforms. Microsoft will probably not do it in-house, but rather choose to contract it out.[36] Even though the runtime itself spans two client platforms, lack of any cross-platform development tools have also come up as a point of concern.

It has also received criticism for ignoring existing international standards. According to Ryan Paul of Ars Technica, Microsoft could have chosen SVG to implement the vector graphics subset instead of a "limited and incompatible facsimile", to show their commitment to open standards and also fix the standards problems that plagues Internet Explorer. He thinks this is consistent with Microsoft's ignoring of open standards in other products as well.[34] However, according to David Betz, a standards advocate, Microsoft would have needed to alter the SVG specification to add .NET integration and UI constructs on top of SVG. Consequently, the "choice by Microsoft to use XAML over SVG, served to retain the SVG standard by not adding proprietary technology." He further says,

"Silverlight can be viewed as a web extension of the Windows Presentation Foundation (WPF), a .NET 3.0 technology and not simply as a new web technology. As such, it makes sense that Silverlight uses XAML, not SVG. If Silverlight were based on SVG, then there would be a chasm between Silverlight and the .NET Framework, but as it stands Silverlight's use of XAML makes it part of the .NET family. In fact, it’s important to note that elements in XAML usually represent objects in the .NET Framework; this would simply not be possible in SVG."[37]

See also

References

  1. ^ "Code Sample: Is Your Process Using the Silverlight CLR?". Retrieved 2007-05-12.
  2. ^ "Rounding up DLR questions". Retrieved 2007-05-12.
  3. ^ "Opera Watch: More details on Silverlight support in Opera". Retrieved 2007-05-02.
  4. ^ "Microsoft Silverlight 1.1 Developer Reference". Retrieved 2007-05-06.
  5. ^ Joe Stegman. "MSDN Forums Silverlight General Discussion: Linux support". Retrieved 2007-04-29.
  6. ^ Shubha Krishnappa. "Sun's JavaFX may pose challenge to "Silverlight"". Retrieved 2007-05-09.
  7. ^ Andy Patrizio. "Does JavaFX Spell The End Of AJAX?". Retrieved 2007-05-09.
  8. ^ Elizabeth Montalbano. "Microsoft Goes Open Source?". Retrieved 2007-04-29.
  9. ^ a b Gavin Clarke. "Silverlight glow dimmed by cross-platform concerns". Retrieved 2007-05-05.
  10. ^ "Microsoft Silverlight 1.0 beta license". Retrieved 2007-06-14.
  11. ^ Rafe Needleman. "What is Silverlight, really?". Retrieved 2007-05-05.
  12. ^ "Using a Downloader Object". Retrieved 2007-05-25.
  13. ^ Mono developers to bring Silverlight to Linux
  14. ^ a b c d e f "Silverlight architecture". Retrieved 2007-06-05.
  15. ^ "Silverlight 1.0 Beta QuickStart". Retrieved 2007-06-05.
  16. ^ "Side by Side In Process CLRs Start with Silverlight". Retrieved 2007-05-12.
  17. ^ "Microsoft polishes the Silverlight". Retrieved 2007-05-02.
  18. ^ a b c "Silverlight". Retrieved 2007-05-12.
  19. ^ Tim Sneath. "Some Great Silverlight Controls". Retrieved 2007-06-30.
  20. ^ Kim Hamilton. "Linq Support in Silverlight 1.1 Alpha". Retrieved 2007-06-08.
  21. ^ Kevin Hoffman. "Silverlight v1.0 Beta vs. Silverlight 1.1 Alpha - Huh??". Retrieved 2007-06-11.
  22. ^ a b c d "MIX07: Extending the Browser Programming Model with Silverlight". Retrieved 2007-05-03.
  23. ^ "Silverlight isn't just about presentation". Retrieved 2007-06-13.
  24. ^ Tim Sneath. "Programming HTML with C#". Retrieved 2007-06-30.
  25. ^ a b Shaun Farkas. "The Silverlight Security Model". Retrieved 2007-06-08.
  26. ^ Shaun Farkas. "Silverlight Security III: Inheritance". Retrieved 2007-06-08.
  27. ^ "How to: Explore Silverlight Assemblies with the Visual Studio Object Browser". Retrieved 2007-06-08.
  28. ^ a b Shaun Farkas. "Silverlight Security II: What makes a method critical". Retrieved 2007-06-08.
  29. ^ "How to: Create a Silverlight Project". Retrieved 2007-06-08.
  30. ^ Nigel Parker. "MIX07 Your Product is a feature of the Web!". Retrieved 2007-06-08.
  31. ^ "Moonlight - Mono". Retrieved 2007-06-07.
  32. ^ Dana Gardner. "the FASTforward blog: Expect a June demo of Silverlight on Linux, sans browser". Retrieved 2007-06-06.
  33. ^ "Implementing Silverlight in 21 Days". Retrieved 2007-06-22.
  34. ^ a b Ryan Paul. "Microsoft's Flash-killer Silverlight steals the show at MIX07". Retrieved 2007-05-06.
  35. ^ Chris Duckett. "builderau: Mixed Emotions". Retrieved 2007-06-06.
  36. ^ Microsoft. "Silverlight Video Library (Silverlight required)". Retrieved 2007-06-13.
  37. ^ David Betz. "Silverlight's Adoption as Public De-Facto Standard". Retrieved 2007-06-20.

Template:MSNav