Microsoft Silverlight

From Wikipedia, the free encyclopedia

Jump to: navigation, search
Microsoft Silverlight
Maintainer: Microsoft
Stable release: 1.0.21115.0  (20 November 2007) [+/-]
Preview release: 1.1 Alpha Refresh Sept Preview  (September 5, 2007) [+/-]
OS: Microsoft Windows,
Mac OS X
Use: Web Application framework
License: MS-EULA, with MS-PL components
Website: http://silverlight.net/

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. The runtime is available for Microsoft Windows and Mac OS X, with Linux support under development via the third-party Moonlight runtime.

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.[1][2]

Version 2.0 (previously known as version 1.1[3]), which is currently under development, will include a complete version of the .NET Common Language Runtime named CoreCLR,[4] so that Silverlight applications can be written in any .NET language.

Contents

[edit] 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 WMV, WMA and MP3 media content [5] across all supported browsers without requiring Windows Media Player, the Windows Media Player ActiveX control or Windows Media browser plugins. Because Windows Media Video 9 is an implementation of the SMPTE VC-1 standard, Silverlight also supports VC-1 video, though still only in an ASF file format. Furthermore, the Software license agreement says VC-1 is only licensed for the "personal and non-commercial use of a consumer".[6]

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).[7]

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.[8] With version 2.0, the programming logic can be written in any .NET language, including some common dynamic programming languages like Ruby and Python.[9]

[edit] Compatibility

OS/Browser IE 6 SP2 IE 7 Firefox/SeaMonkey/Mozilla Safari Konqueror Opera
Windows Vista N/A 1.0, 2.0 1.0, 2.0 1.0, 2.0; via NPAPI N/A Planned[10]
Windows Server 2003 1.0, 2.0 1.0, 2.0 1.0, 2.0 1.0, 2.0; via NPAPI N/A Planned[10]
Windows XP 1.0, 2.0 1.0, 2.0 1.0, 2.0 1.0, 2.0; via NPAPI N/A Planned[10]
Windows 2000 Planned 2.0 N/A Planned 2.0 N/A N/A Planned[10]
Mac OS 10.4.8+ PPC N/A N/A 1.0 1.0 N/A
Mac OS 10.4.8+ Intel N/A N/A 1.0, 2.0 1.0, 2.0 N/A Planned[10]
Linux x86(Moonlight) N/A N/A Planned[11][12] N/A Planned[12] Planned[10][12]
Linux x86-64(Moonlight) N/A N/A Planned[11][12] N/A Planned[12] Planned[10][12]

Notes:

  • Opera will be supported with future builds[10]
  • On Linux^, the functionality will be made available via the 100% compatible, third-party Moonlight runtime.[11][12] Moonlight will be available for the major Linux distributions, with support for Firefox, Konqueror, and Opera browsers.
  • Mobile device support is planned for the future, according to Scott Guthrie.[13]
  • Additional platforms are being considered as well.[14]

[edit] Versions

Version Name Version Number Release Date
1.0 CTP 1.0.? December 2006
1.0 RTW 1.0.20816 2007-09-05
2.0 Pre-Release
(As 1.1 Alpha Preview)
1.1.20816 2007-09-05
1.0 service release 1.0.21115.0 2007-11-20
2.0 Beta[15] To Be Announced MIX 08[16]

[edit] Silverlight 1.0

A Silverlight 1.0 application hosted in Internet Explorer
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.[17] 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, WMA Standard, WMV7, WMV8 and WMV9/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.[18]

Programmatic manipulation of the UI is achieved by using scripting languages to modify the Document Object Model of the Silverlight Canvas object.[17] 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 overlaid on top of the Silverlight Canvas for user input. Support for data formats is limited to XML, POX, and JSON only.[17]

[edit] Silverlight 2.0

A Silverlight 2.0 application hosted in Internet Explorer
A Silverlight 2.0 application hosted in Internet Explorer

Silverlight 2.0 (previously referred to as version 1.1)[19] 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. [20] 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.[21] Silverlight 2.0 also adds support for DRM in media files.[17]

The version of .NET Framework in Silverlight adds[17] 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 than 20 UI controls,[15] add two-way databinding support, and automated layout management as well as data manipulation controls such as DataGrid.[22][19] Third party libraries for expanded sets of UI controls are being made available for the alpha release as well.[23]

Silverlight 2.0 Architecture
Silverlight 2.0 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 2.0 will include it. [24] 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,[25] though it will be in the next release of Silverlight 2.0.[19] Silverlight also supports asynchronous programming via the use of the threading libraries.[22]

Silverlight 2.0 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. [22]

With the integration of .NET Framework, Silverlight also allows HTML-managed code interaction, which allows manipulation of HTML DOM elements from managed code,[17] 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.[26] 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.[27] 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.[28]

A Python interpreter in Silverlight 1.1 hosted in Mozilla Firefox
A Python interpreter in Silverlight 1.1 hosted in Mozilla Firefox

Silverlight 2.0 also allows limited filesystem access to Silverlight applications.[26] 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),[26] 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.[26] 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.[29] 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.[29] 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.[30] 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.[31]

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. [32] 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. [32]

[edit] 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, Visual Studio 2008 requires the Visual Studio Tools for Silverlight (currently an alpha release) to create Silverlight projects, and let the compiler target CoreCLR.[33] 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. [34]

[edit] Licensing

An unattributed report claimed [35] that Microsoft aims to release certain parts of Silverlight source code as open source software, but Sam Ramji, director of platform technology strategy at Microsoft, said the company has no plans to do so.[36] However, portions of the Dynamic Language Runtime, included with Silverlight, have been made available on Microsoft's CodePlex website using the Microsoft Public License.

[edit] Criticism

Silverlight has received criticism for ignoring existing international standards. According to Ryan Paul of Ars Technica, Microsoft could have chosen Scalable Vector Graphics (SVG) to implement the vector graphics subset instead of Extensible Application Markup Language (XAML), described as a "limited and incompatible facsimile", to show their commitment to open standards, as well as to fix the standards problems which plague Internet Explorer. He thinks this is consistent with Microsoft's ignoring of open standards in other products, as well.[37]

However, according to David Betz, an independent .NET technologies specialist, 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." [38]

[edit] See also

[edit] References

  1. ^ Shubha Krishnappa. Sun's JavaFX may pose challenge to "Silverlight". Retrieved on 2007-05-09.
  2. ^ Andy Patrizio. Does JavaFX Spell The End Of AJAX?. Retrieved on 2007-05-09.
  3. ^ Scott Guthrie (November 29, 2007). .NET Web Product Roadmap (ASP.NET, Silverlight, IIS7). Retrieved on 2007-11-30.
  4. ^ Code Sample: Is Your Process Using the Silverlight CLR?. Retrieved on 2007-05-12.
  5. ^ Silverlight FAQs
  6. ^ Microsoft Silverlight 1.0 beta license. Retrieved on 2007-06-14.
  7. ^ Rafe Needleman. What is Silverlight, really?. Retrieved on 2007-05-05.
  8. ^ Using a Downloader Object. Retrieved on 2007-05-25.
  9. ^ Mono developers to bring Silverlight to Linux
  10. ^ a b c d e f g h Opera Watch: More details on Silverlight support in Opera. Retrieved on 2007-05-02.
  11. ^ a b c Silverlight 1.0 Released and Silverlight for Linux Announced. Retrieved on 2007-09-05.
  12. ^ a b c d e f g Microsoft/Novell Collaboration on Silverlight.. Retrieved on 2007-09-05.
  13. ^ Guthrie, Scott (2007-09-04). Silverlight 1.0 Released and Silverlight for Linux announced. Retrieved on 2007-09-04.
  14. ^ Joe Stegman. MSDN Forums Silverlight General Discussion: Linux support. Retrieved on 2007-04-29.
  15. ^ a b Quick update on Silverlight. Retrieved on 2007-11-30.
  16. ^ Silverlight 1.1 is Now Silverlight 2.0. Retrieved on 2007-11-30.
  17. ^ a b c d e f Silverlight architecture. Retrieved on 2007-06-05.
  18. ^ Silverlight 1.0 Beta QuickStart. Retrieved on 2007-06-05.
  19. ^ a b c .NET Web Product Roadmap (ASP.NET, Silverlight, IIS7). Retrieved on 2007-11-30.
  20. ^ Side by Side In Process CLRs Start with Silverlight. Retrieved on 2007-05-12.
  21. ^ Microsoft polishes the Silverlight. Retrieved on 2007-05-02.
  22. ^ a b c Silverlight. Retrieved on 2007-05-12.
  23. ^ Tim Sneath. Some Great Silverlight Controls. Retrieved on 2007-06-30.
  24. ^ Kim Hamilton. Linq Support in Silverlight 1.1 Alpha. Retrieved on 2007-06-08.
  25. ^ Kevin Hoffman. Silverlight v1.0 Beta vs. Silverlight 1.1 Alpha - Huh??. Retrieved on 2007-06-11.
  26. ^ a b c d Danny Thorpe (2007-05-02). MIX07: Extending the Browser Programming Model with Silverlight. Retrieved on 2007-05-03.
  27. ^ Tim Sneath (2007-06-07). Silverlight isn't just about presentation. Retrieved on 2007-06-13.
  28. ^ Tim Sneath (2007-06-13). Programming HTML with C#. Retrieved on 2007-06-30.
  29. ^ a b Shawn Farkas. The Silverlight Security Model. Retrieved on 2007-06-08.
  30. ^ Shawn Farkas. Silverlight Security III: Inheritance. Retrieved on 2007-06-08.
  31. ^ How to: Explore Silverlight Assemblies with the Visual Studio Object Browser. Retrieved on 2007-06-08.
  32. ^ a b Shawn Farkas. Silverlight Security II: What makes a method critical. Retrieved on 2007-06-08.
  33. ^ How to: Create a Silverlight Project. Retrieved on 2007-06-08.
  34. ^ Nigel Parker. MIX07 Your Product is a feature of the Web!. Retrieved on 2007-06-08.
  35. ^ Elizabeth Montalbano. Microsoft Goes Open Source?. Retrieved on 2007-04-29.
  36. ^ Gavin Clarke. Silverlight glow dimmed by cross-platform concerns. Retrieved on 2007-05-05.
  37. ^ Ryan Paul. Microsoft's Flash-killer Silverlight steals the show at MIX07. Retrieved on 2007-05-06.
  38. ^ David Betz. Silverlight's Adoption as Public De-Facto Standard. Retrieved on 2007-06-20.

[edit] External links


Personal tools