Sunteți pe pagina 1din 75

Acknowledgements

I would like to take this opportunity to express my sincere gratitude to all those people without whose support, encouragement and co-operation this paper would not have been a success. I would like to thank my guide of this seminar topic sir to help me prepare this topic. I would also appreciate their guidance and technical know-how they gave me regarding this subject. Last but not least, I am grateful to my colleagues in the college who helped me throughout.

Index
1.0 Introduction..05

2.0 Versions of Silverlight ....08 2.1 Silverlight 1.0 ...08 2.2 Silverlight 1.1 ...11 2.3 Silverlight 1.0 Beta / 1.1 Alpha.....16 2.4 Silverlight 1.1 Update....18 2.5 Silverlight 2.0.....20 3.0 Silverlight release condidates .23 3.1 Expression Encoder 1.0 Released .....24 3.2 Deployed Silverlight 1.0 Customer....26 3.3 Silverlight for Linux Support.....27 3.4 Silverlight Assemblies...39 4.0 Rendering Pipeline...45 4.1 Integration with compiz.45 4.2 Plugin Loading...47 4.3 Hosting API47 5.0 Silverlight SDKs.48 5.1 Providing the Missing pieces...58

5.2 Moonlight IDE.....58 5.3 Debugging JIT issues...49 6.0 How Silverlight Update Works?...........................................50 7.0 Silverlight vs. Flash....52 8.0 Why Silverlight is an Important?.........................................58 9.0 Build a Silverlight Media Player......59 9.1 Design......59 9.2 Refine Design..62 10.0 Advantages and Drawbacks of the Silverlight65 10.1 Uses of Silverlight......65 10.2 Limitations of Silverlight...68 11.0 Silverlight Compatibility.....69 11.1 Development Tools....71 11.2 License...73 12.0 Silverlight Security......74

1. Introduction
Microsoft Silver light is a browser plug-in that allows web applications to be developed with features like animation, vector graphics, and audio-video
3

playback - features that characterize a rich internet application. Silverlight competes with products such as Adobe Flash, Adobe Shockwave, Java FX, and Apple QuickTime. Version 2.0 of Silverlight provides additional capabilities, including advanced interactivity features. Significantly, version 2.0 allows developers to use .NET languages and development tools when authoring Silverlight applications. Silverlight was developed under the codename Windows Presentation Foundation/Everywhere (WPF/E). It is compatible with multiple web browser products used on Microsoft Windows and Mac OS X operating systems. Support for the Linux operating system by the third-party Moonlight runtime is under development. Silverlight is a cross platform, cross browser .NET plug-in that enables designers and developers to build rich media experiences and RIAs for browsers. The preview builds we released this week currently support Firefox, Safari and IE browsers on both the Mac and Windows. To get a sense of the types of rich browser applications you will be able to build using Silverlight, please check out this 7 minute video of the Metaliq "Top Banana" video editor sample application:

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. Textual content created with Silverlight would be

more searchable and index able than that created with Flash as it is not compiled, but represented as text (XAML). Silverlight supports playback of WMV, WMA and MP3 media content[2] across all supported browsers without requiring Windows Media Player, the Windows Media Player ActiveX control or Windows Media browser plugin. 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".[3] Silverlight is currently the only browser plug in to support HD and it does so up to 1080p. 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 may be required by the application. With version 2.0, the programming logic can be written in any .NET language, including some common dynamic programming languages like Ruby and Python. A few days back there were many questions about Microsoft WPF/E technology and very few answers. Everyone was talking about WPF Vs Flex/Flash. We have now started to get all answers for questions which we had in our mind as MIX07 unveils everything bit by bit. Months of Microsofts effort are clearly visible. In the last 24+ hours lot of talk has gone in about Silverlight and how it is flash killer. My concern or any developer/designer concern would be that what exactly Silverlight is. I will try to answer that here.

Silverlight is a new cross-browser, cross-platform implementation of the .NET Framework for building and delivering the next generation of media experiences and Rich Interactive Applications (RIA) for the web. It runs in all popular browsers, including Microsoft Internet Explorer, Mozilla Firefox, Apple Safari, Opera. The plug-in required to run Silverlight is very small in size hence gets installed very quickly. It is combination of different technologies into a single development platform that allows you to select tools and the programming language you
5

want to use. Silverlight integrates seamlessly with your existing JavaScript and ASP.NET AJAX code to complement functionality which you have already created. If you are a Developer and want to continue using Visual Studio for web development. You can use the power of Visual Studio Code Name Orcas Beta1. Visual Studio provides the same tools for Silverlight, such as powerful editors, project management and debugging. If you are a Designer you can use Expression Studio to design. You can create Silverlight applications using Expression Blend. Talking about designer and developer integration we can say that since Expression Blend generates XAML output which can be easily opened in Visual Studio, hence developers and designers can share the same file without disturbing each others work

2.0 Versions of the Silverlight


Silverlight 1.0:

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.[13] 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. Programmatic manipulation of the UI is achieved by using scripting languages to modify the Document Object Model of the Silverlight Canvas object.[13] 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 POX (Plain Old XML) and JSON only. We are going to ship the first release of Silverlight this summer. It is focused on enabling rich media scenarios, and will be a ~1.2MB download. Some of its features include:
7

Built-in codec support for playing VC-1 and WMV video, and MP3 and WMA audio within a browser. The VC-1 codec in particular is a big step forward for incorporating media within a web experience since it supports playing high-quality video up to 720p (high definition). It is also the same codec format supported in all HDDVD and Blueray DVD players, and is supported by hundreds of millions of mobile devices, XBOX 360, Windows Media Centers, and Windows Media Players (enabling someone to encode content once and run it on all of these devices + Silverlight unmodified). This enables you to use a huge library of existing video content and rich editing tools to generate video content with Silverlight. Silverlight supports the ability to progressively download and play media content from any web-server. You can point Silverlight at any URL containing video/audio media content, and it will download it and enable you to play it within the browser. No special server software is required, and Silverlight can work with any web-server (including Apache on Linux). We'll also be releasing a set of IIS modules that enable useful media control and bandwidth throttling features that you can enable on your server for free. Silverlight also optionally supports built-in media streaming. This enables you to use a streaming server like Windows Media Server on the backend to stream video/audio (note: Windows Media Server is a free product that runs on Windows Server). Streaming brings some significant benefits in that: 1) it can improve the end-user's experience when they seek around in a large video stream, and 2) it can dramatically lower your bandwidth costs (most users don't watch entire videos - and so you waste bandwidth if they navigate away before the end of the video with progressive downloading). Silverlight enables you to create rich UI and animations, and blend vector graphics with HTML to create compelling content experiences. It supports a JavaScript programming model to develop these. One benefit of this is that it makes it really easy to integrate these experiences within AJAX web-pages (since you can write JavaScript code to update both the HTML and XAML elements together). Silverlight makes it easy to build rich video player interactive experiences. You can blend together its media capabilities with the vector graphic support to create any type of media playing experience
8

you want. Silverlight includes the ability to "go full screen" to create a completely immersive experience, as well as to overlay menus/content/controls/text directly on top of running video content (allowing you to enable DVD like experiences). Silverlight also provides the ability to resize running video on the fly without requiring the video stream to be stopped or restarted. You can develop Silverlight applications using any standard text editor (no custom tool is required). Microsoft will also be shipping support for targeting Silverlight 1.0 applications with our Expression Studio suite of products (including rich tool support for media management and video encoding support). You can download preview CTP builds of Expression Blend and Expression Media Encoder that support Silverlight today from here. To learn more about the Silverlight 1.0 feature-set, as well as how to start building experiences that target it, I highly recommend watching some of the great "How do I?" videos that have recently been posted on the new www.silverlight.net community site here. I'd also recommend watching these (free) conference sessions from the MIX conference that cover Silverlight 1.0 and media scenarios:

Building Rich Web Experiences using Silverlight and JavaScript for Developers Deep Dive on Silverlight Media Integration Developing ASP.NET AJAX Controls with Silverlight Creating and Delivering Rich Media and Video on the Web with Silverlight, Expression Studio, and Windows Server

2.2 Silverlight 1.1


Silverlight 1.1 includes a version of the .NET Framework, with the full CLR as .NET Framework 3.0. So it can execute now 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. 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. Silverlight 1.1 also adds support for DRM in media files. 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. 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. Silverlight also supports asynchronous programming via the use of the threading libraries. 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
10

Managed JScript conforms to the ECMAScript 3.0 specification, and Microsoft claims that it is 250 times faster than interpreted JScript. With the integration of .NET Framework, Silverlight also allows HTMLmanaged code interaction, which allows manipulation of HTML DOM elements from managed code, 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. A Silverlight instance does not need to have a UI component in order to manipulate the HTML DOM from managed code. 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. A Python interpreter in Silverlight 1.1 hosted in Mozilla Firefox Silverlight 1.1 also allows limited filesystem access to Silverlight applications. 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), 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. 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. 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

11

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. 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. 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. 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. 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. At MIX we shipped both a beta version of Silverlight 1.0 (which will ship in final release form this summer), as well as delivered an alpha version of Silverlight 1.1. Silverlight 1.1 includes a cross platform version of the .NET Framework, and enables a rich .NET development experience within a browser. The total download size of the Silverlight 1.1 package (including all of the 1.0 features + CLR + a WPF and .NET FX library API subset + dynamic language support) is ~4MB - and it takes less than 20 seconds to install on a machine. Some of the Silverlight V1.1 features include:

A built-in CLR engine that delivers a super high performance execution environment for the browser. Silverlight uses the same core CLR engine that we ship with the full .NET Framework today (we build it from a single source tree). It delivers the same type-system,
12

garbage collector, and JIT code generation engine that your .NET code uses today. This means that you can write .NET code that can now run in Silverlight, ASP.NET, and a WinForms/WPF Windows application. It also means you can now execute code within the browser that runs more than 250x faster than interpreted Javascript.

Silverlight includes a rich framework library of built-in classes that you can use to develop browser-based applications. This framework library is a subset of the full .NET Framework class library you use today, and enables you to easily re-use your existing skills and knowledge. It includes support for collections, generics, IO, threading, globalization, networking, and LINQ. Silverlight includes support for a WPF UI programming model. The Silverlight 1.1 Alpha enables you to program your UI with managed code/event handlers, and supports the ability to define and use encapsulated UI controls (built with any managed .NET language). The first Silverlight Alpha doesn't yet ship with a rich set of built-in UI controls -- we've been busy at work building the core UI infrastructure first. Don't worry, though, a rich set of high-level controls will definitely be included in the future (in the meantime you can download some nice samples of controls here). WPF for Silverlight will also ultimately ship with support for core WPF constructs like layout managers and data-binding (these features are not yet implemented in the current alpha - but are coming). Silverlight provides a managed HTML DOM API that enables you to program the HTML of a browser using any .NET language (this means you can now wire-up an event handler to an HTML button using C# or VB). Silverlight also provides the ability to have Javascript code within an HTML page call into .NET methods you expose from within your Silverlight control/application. Silverlight includes a JSON serializer that supports automatic marshalling of .NET datatypes to/from Javascript (meaning you can have standard browser Javascript code call a C# method within Silverlight, and have the C# method return a .NET collection which is then serialized by Silverlight into a Javascript collection for your browser Javascript to use).

13

Silverlight doesn't require ASP.NET to be used on the backend webserver (meaning you could use Silverlight with with PHP on Linux if you wanted to). However, we've naturally added some pretty nice features that enable you to easily integrate Silverlight on the client and ASP.NET on the server together. Silverlight can use the standard ASP.NET application services (membership, roles, profile, etc), and can call either WCF or ASMX web-services hosted within ASP.NET. This week we also shipped new ASP.NET server controls that make it easy to host Silverlight controls within ASP.NET pages.

You can click on the picture below to download a nice poster that provides an overview of some of the key .NET namespaces and features that are supported with the Silverlight 1.1 alpha today:

I also did a Channel9 interview that you can watch to learn a little more about how the managed programming model works within Silverlight, and how we added the CLR support:

14

May 10th Update: I also did a great pod cast with Scott Hanselman that you can download and listen to here. I'd also recommend watching these (free) conference sessions from the MIX conference that cover Silverlight 1.1 with .NET scenarios:

Building Silverlight Applications using .NET (Part 1) Building Silverlight Applications using .NET (Part 2) Extending the Browser Programming Model with Silverlight

2.3 Silverlight 1.0 Beta / 1.1 Alpha


There are currently 2 early releases for Silverlight. a Silverlight 1.0 beta and a Silverlight 1.1 alpha. this is my 1st real look at Silverlight, so i went to install the 1.1 SDK. but the initial problem was it required Orcas ... which I don't want to install just yet. fell back to Silverlight 1.0, but that got ugly real quick. it doesnt have any UI controls nor does it have code-behind support. forget that, back to 1.1, which has the beginnings of controls and managed code support.. Did some searching and found this blog post : Silverlight 1.1 with VS 2005. Following that blog post, i was able to work with Silverlight 1.1 within VS 2005. the first step was to create the host HTML page (App.htm) and the java script to create the Silverlight object tag (App.htm.js). The UI is simple (ItvPage.xaml), its just a ListBox for selecting a category/channel and a MediaElement to play the video stream. both the 1.1 Controls code and XAML is provided, just had to include those files in my project and make sure the XAML was included as an 'Embedded Resource'. first, the ListBox needs to be populated. OnLoaded (ItbPage.xaml.cs), the app makes an HttpRequest for an XML file (Streams.xml) which contains <Category name=""> and <Stream name="" url=""/> elements. It parses the Categories from the XML file and displays the available categories as items in the ListBox. since MCE remote control commands become keyboard presses, i added keyboard support. Ends up you can only hook the KeyDown event on the root Canvas and not child controls. from the forums, it looks like this will change in later releases.

15

The root Canvas hooks the KeyDown event and then passes the key press to the ListBox for selecting different items using the up and down arrow keys. speaking of Canvas, Silverlight is currently limited to that element for layout. i'm assuming that later versions will get more Layout options like StackPanel and Grid? now a user can select a category using the Enter key. When a category is selected, the ListBox is reloaded with the available Streams in that category. then a user can select a Stream to play that will hide the ListBox and show the MediaElement. it will also set the Source of the MediaElement to the streams Url and call Play(). The MediaElement has a MediaFailed event, but Silverlight doesnt have a MessageBox to show the error to the user. instead, you have to fire an event in managed code, that is hooked by javascript on the hosting HTML page, which will call javascript alert() to show the exception message. for that, i followed the pattern from this blog post : Calling Javascript from C#. there's a little more happening, but that's pretty much it. NOTE i wrote a different app to harvest MMS streams from an internet TV web site, which are used within this app.

Prototype

16

it's hosted here : http://www.mperfect.net/mceItvSilver/App.htm. you will be prompted to install Silverlight 1.1 if necessary. the Up/Down arrow keys are for navigating the ListBox. Enter/Space for selecting items in the ListBox. Escape/Backspace for navigating back. you can try it out in MCE, by adding this MCL shortcut to MCE : mceItvSilver.mcl (remove the .txt extension) NOTE there are many streams that will not play (a reliable test stream is 'News' - 'C-Span 1'). not sure why so many of these streams fail within Silverlight?

2.4 Silverlight 1.1 Update


Now that Silverlight 1.0 is out the door, my team is cranking hard on our Silverlight 1.1 release. Silverlight 1.1 will include a cross-platform version of the .NET Framework, and will enable a rich .NET development experience in the browser. It will support a WPF programming model for UI - including support for an extensible control model, layout management, data-binding, control skinning, and a rich set of built-in controls. It will also include a subset of the full .NET Framework base class library you use today, including support for collections, generics, IO, threading, globalization, networking (including sockets, web-services and REST support), HTML DOM, XML, local storage, and LINQ. You'll be able to use any .NET language to develop a Silverlight application (VB, C#, JavaScript, Python, Ruby, Pascal, and more). It is going to really open up a lot of new development opportunities. Silverlight technology (previously called WPF/E: Windows Presentation Foundation /Everywhere) is Microsoft's solution allowing developing RIA (Rich Internet Application) following the example of its direct competitor, Adobe's Flex technology... Flex and Silverlight are based on the same fundamentals: an interface description language coming from XML (MXML for Flex and XAML for
17

Silverlight) and a programming language (Action script 3 for Flex and JavaScript/C#/VB/Python for Silverlight). Like Flex, Silver lights plug-in are compatible with Windows, Mac and Linux platforms, and also with the most widely used browsers: Internet Explorer, Mozilla/Firefox, and Safari. Silverlight is scripted by JavaScript language, with which it will be possible to have interactive applications. Moreover, C# and VB.NET languages will be supported by Silverlight. But that is all for the similarities. This technology has its strong points and its weaknesses and a major competitor: Flex One of Silver lights main advantages lies in the amount of available languages: C#, VB, JavaScript, Python, and Ruby that should be supported as well soon. As for the display, HD (720p) and full-screen are definitely strong assets. More technically, Silverlight also supports multi-threading and is able to use several processors if the client machine is multi-core. Nevertheless, Silverlight counts important weaknesses compare to Flash/Flex... The most important one lies in its weak penetration rate (yet temporary), whereas Adobe's Flash player is installed on about 97% machines worldwide. Silverlight has a long way to go, but Microsoft has significant means to solve that kind of problem ;-) This technology is also less multi-platform than Flash, what is an important drawback, for accessibility in particular. To this, we can add the fact that the developing environment is only available on Windows (Microsoft technology...), so it is impossible to develop Silverlight on Mac or Linux. We can also deplore the lack of sockets as it exists in Flash. Of course, some differences can be considered to be either an advantage or a weakness, depending on their use. The animation under Silverlight is based on time rather than the number of images. Once deployed, the application comprises several folders (XAML, DLL, and JS) contrary to a Flash application where everything is chunked into one single big SWF folder. To conclude, we can only appreciate Microsoft's initiative. Though many weaknesses need to be corrected, a monopoly is never good. Silverlight will at least get credit for shaking Adobe's teams. Debates are open;-

18

2.4 Silverlight 2.0:

A Silverlight 2.0 application hosted in Internet Explorer The alpha version of Silverlight 2.0 (previously referred to as version 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. 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. Silverlight 2.0 also adds support for DRM in media files. The version of .NET Framework in Silverlight adds a subset of WPF UI programming model, including support for shapes, documents, and 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 data binding 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,[11] add two-way data binding support, and automated layout management as well as data manipulation controls such as Data Grid. Third party libraries for
19

expanded sets of UI controls are being made available for the alpha release as well.

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.[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] though it will be in the next release of Silverlight 2.0.[15] Silverlight also supports asynchronous programming via the use of the threading libraries.[18] Silverlight 2.0 includes the Dynamic Language Runtime which allows dynamic compilation and execution of dynamic (scripting) languages. The first upcoming languages written for the DLR are Managed JScript, Iron Python 2.0, and Iron Ruby. Microsoft also plan to build Visual Basic .NET 10.0 (Vex) on the DLR. 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 ECMAScripts 3.0 specification, and Microsoft claims that it is 250 times faster than interpreted JScript. With the managed elements managed integration of .NET Framework, Silverlight also allows HTMLcode interaction, which allows manipulation of HTML DOM from managed code, as well as allow JavaScript code to call code and use objects instantiated by managed code. Silverlight

20

encloses JavaScript objects and DOM elements in managed wrappers to make them available from managed code.[22] However, in the 1.1 alpha releases 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.

A Python interpreter in Silverlight 1.1 hosted in Mozilla Fire fox Silverlight 2.0 also allows limited file system access to Silverlight applications. 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), 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. 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 transparent (SecurityTransparentAttribute), safe critical (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 safe critical assemblies run with full trust, and are not subject to such limitations.

21

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 Safe Critical. 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.

3.0 Silverlight release candidate


Microsoft is set to release a string of web tools this week, including Silverlight 1.0 Release Candidate and a second beta of Visual Studio 2008. Silverlight 1.0 is scheduled for final release in the autumn, and Visual Studio 2008 and the .Net Framework 3.5 are set for release by the end of the year. Silverlight is a download for displaying media and interactive content in web pages. It competes with Flash and other plug-ins that add interactivity to websites. To spur creation of Silverlight applications, Microsoft also released a community technology preview of the Silverlight Add-In for Visual Studio 2008. The plug-in is expected to be ready soon after the final release of Visual Studio 2008.
22

The follow-on Silverlight 1.1 version will include support for the Dynamic Languages Runtime, which will allow programmers to use dynamic, or scripting, languages to write Windows or Silverlight web applications using .Net-based tools. Programmers can use these tools to build applications and get support from Microsoft under its Go Live License. I know Silverlight is direct competition to Adobes Flash family products. However, its sign of the maturity of the RIA space. Whoever is working on the RIA based application should pay attention to the very dynamic nature of this area, only because its the direction that all desktop and web applications are going.

3.1 Silverlight 1.0 and Expression Encoder 1.0 Released


Today we shipped the Silverlight 1.0 release for Mac and Windows. Silverlight 1.0 is focused on enabling rich media scenarios in a browser. Some of its features include:

Built-in codec support for playing VC-1 and WMV video, and MP3 and WMA audio within a browser. The VC-1 codec is a big step forward for incorporating media within a web experience - since it supports very efficiently playing high-quality, high definition video in the browser. It is a standards-based media format that is implemented in all HD-DVD and Blue ray DVD players, and is supported by hundreds of millions of mobile devices, XBOX 360s, PlayStation 3s, and Windows Media Centers (enabling you to encode content once and run it on all of these devices + Silverlight unmodified). It enables you to use a huge library of existing video content and provides access to the broad ecosystem of existing Windows Media tools, components, vendors and hardware. Silverlight supports the ability to progressively download and play media content from any web-server. You can point Silverlight at any URL containing video/audio media content, and it will download it and enable you to play it within the browser. No special server software is required, and Silverlight can work with any web-server (including Apache on Linux). We'll also be releasing an IIS
23

7.0 media pack that enables rich bandwidth throttling features that you can enable on your web-server for free.

Silverlight also optionally supports built-in media streaming. This enables you to use a streaming server like Windows Media Server on the backend to efficiently stream video/audio (note: Windows Media Server is a free product that runs on Windows Server). Streaming brings some significant benefits in that: 1) it can improve the enduser's experience when they seek around in a large video stream, and 2) it can dramatically lower your bandwidth costs. Silverlight enables you to create rich UI and animations, and blend vector graphics with HTML to create compelling content experiences. It supports a JavaScript programming model to develop these. One benefit of this is that it makes it really easy to integrate these experiences within AJAX web-pages (since you can write JavaScript code to update both the HTML and XAML elements together). Silverlight makes it easy to build rich video player interactive experiences. You can blend together its media capabilities with the vector graphic support to create any type of media playing experience you want. Silverlight includes the ability to "go full screen" to create a completely immersive experience, as well as to overlay menus/content/controls/text directly on top of running video content (allowing you to enable DVD like experiences). Silverlight also provides the ability to resize running video on the fly without requiring the video stream to be stopped or restarted.

Today we also shipped the Expression Encoder 1.0 release on the web. Expression Encoder is part of the Microsoft Expression suite of products, and enables designers and content professionals to enhance, encode and publish media content for Silverlight. You can use it to import media files from a variety of formats (QuickTime, WMV, AVI and more), add leaders and trailers to videos for advertising or roll credits, easily watermark video with corporate logos or brands, and then tune the encoding settings to create optimal web-friendly Silverlight experiences.

24

3.2 Deployed Silverlight 1.0 Customers


This week we'll have a wide range of customers already deployed live on the Silverlight 1.0 release. A few of them include: MLB.com (Major League Baseball), Home Shopping Network, World Wrestling Entertainment, and the "Entertainment Tonight" show. Silverlight is also now deployed on several Microsoft sites, including the Halo 3 preview site Tafiti.com, MSN Extra, and MSN Podium '08. You'll also see Silverlight used prominently in several upcoming MSN and Microsoft.com sites.

25

3.3 Silverlight for Linux Support


Over the last few months we've been working to enable Silverlight support on Linux, and today we are announcing a formal partnership with Novell to provide a great Silverlight implementation for Linux. Microsoft will be delivering Silverlight Media Codec for Linux, and Novell will be building a 100% compatible Silverlight runtime implementation called "Moonlight". Moonlight will run on all Linux distributions, and support Firefox, Konqueror, and Opera browsers. Moonlight will support both the JavaScript programming model available in Silverlight 1.0, as well as the full .NET programming model we will enable in Silverlight 1.1. Below is a screen26

shot of the Silverlight 1.1 Flight-Picker application I built in my keynote at MIX running on Linux using Moonlight?

Keep an eye on Miguel de Icaza's blog - I know he'll be blogging a lot more about our partnership on this shortly.

Testing Silverlight on Linux


At this point we do not have a packaged release of Silverlight for Linux and we still have to sort out a few things that would have to be done in order to ship a ready-to-use plugin. But if you are curious or want to contribute to the effort check our page for information on downloading, compiling and getting started with the project.

27

Progress on the Silverlight Airlines, June 20th. How the Hackathon got Started At the Mix conference this year, after the open source panel, I had a chance to meet with Marc Jalabert from Microsoft France who invited me to participate in a re-play of the Mix event in Vegas, this time in Paris. Although Marc had sent me an email on May 9th, I did not notice his email until he pinged me back again on the 28th of May and got his confirmation on the 31st to participate at Mix in Paris. On the 31st he suggested: We suggest you speak during the conference keynote and show a preview of moonlight if you already have something to show. But on the 31st, other than having learned about Silverlight, explored how to decode video, experiment a little with video and started planning for an implementation we had nothing to show. Nothing am telling you. Also, May was a busy month for me HR-wise as we were hiring new developers to join the Mono team. By 1pm on Thursday the 31st, I posted this to our internal Novell Mono mailing list (edited to remove all the embarrassing parts) calling for a hacka-thon:
28

The organizers of ReMix 07 in Paris (ReMix is the repeat of the Microsoft Mix conference) have offered us a 10 minute slot to talk about Mono and demo whatever it is that we have done with Mono's Silverlight. There are two problems: other than a video (rendered in blue, instead of natural colors) and a rectangle that moves, we do not have much. The second problem is that this event is in June 21st so that leaves very little time to get things in shape. Now, it might very well be the case that we should not show anything and we should not rush things out, but it is also a major opportunity, and I think it would be foolish not to take advantage of this. I do not think we need to demo things embedded in the browser, but it would be useful to demo something loaded from a XAML file (video, rectangles, bezier paths, and some limited maybe C# controlled animation, to avoid doing the full animation framework). Issues: * We have a XAML parser written in C# but I have not checked on its state nor checked whether it can do more than just the basics (like doing data type conversion). * Microsoft suggested (and made a good point for it) that the XAML parser be implemented in native code (as 99% of the objects created by XAML are never manipulated by managed code). So we will end up with a C-based XAML parser, whether it is a good idea to do this now, and not reuse the managed one is open to discussion. * Other than the rectangle (that is currently not even rendering) and the video (without audio) I got nothing.
29

* We would need to bind the C implementation to C#, and I think that we can use the same model that Mike used for Gtk#. Not gapi, but the overall model where we mirror the class hierarchy in C# that exists in C++ (in this case, the class is determined by C#, not by C++, but you get the idea). * I have decided to use Cairo for now (David convinced me on the grounds of hardware acceleration). We would need a dedicated hack team to drop whatever it is that they are doing for this noble cause. The question is: who wants to participate in an intense two-week hackathon to make it happen? Obviously, not everyone can work on this at the same time, and having too many people would make things difficult to coordinate. But who is interested?

30

We modified the Silverlight Surface demo to show a live clock and the Mono Logo.

Testing Testing will also present some new challenges. For a list of websites that we currently use for testing go to: Moonlight_1.0_TestSites (http://gomono.com/moonlight/MoonlightStatus.aspx) Moonlight_1.1_TestSites

For a simple self contained html file with embedded Silverlight, Moonlight_Standalone_File

31

We need to be able to reuse existing, mostly unit, tests we already have. Here we face the same difficulties as the assemblies themselves (e.g. #ifdef versus tools); We need to run (parts of) the tests under the new security model - not just under Mono/Linux but also under MS Silverlight under Windows; We need to expand those tests, e.g. new classes, more coverage; Instructions for Jackson's new test harness

What Worked And Did Not Work


There are various factors that I think worked very well for the project:

The availability of Cairo. Pango for doing text rendering. The team background and familiarity with Mono, C#, C, C++, Gtk+, X11, Cairo and Pango. Valgrind. Best C/C++ debugging tool in the world. When the bugs get nasty Valgrind was able to pinpoint the problems while we mixed Mozilla, Mono, Cairo and our runtime library.

Some of the things that we need to sort out and have been problematic:

Cairo performance, we probably need to learn how to better employ Cairo, but there are some bottlenecks in there that are quite bad. Alternatively we can mix rendering with Cairo with rendering with Antigrain (shared RGB buffer) or we could explore replacing Cairo with Antigrain. Cairo does not offer options to render the end cap and start cap differently. Cairo needs to offer an "alpha" enabled version for sources, not only "_set_source_rgba", but allow the "a" to exist for patterns and sources. Pango text rendering with Cairo, two problems: o Rotated text looks terrible and even miss-aligned. Antigrain has a "round-off" mode that makes these rendering glitches go away, it would require us to port pango-cairo to use Agg though. See what it looks like. o Ligatures do not seem to be implemented, this is a problem for rendering arabic strings as it renders each character in its

32

standalone form instead of the linked way. Pango does this, but we could not figure out why it does not work with Cairo (see image showing Linux spelled in Arabic).

Future Directions
I did not think we would be able to get this far in 21 days, I was hoping at most to have a simple XAML file loading and some animations going but the team really achieved an incredible project . I think we are still quite impressed that it could be done. But there is still much work left to do to before we can work flawlessly as a Silverlight plugin. There are still some important chunks of work missing: from ensuring that everything we have implemented is complete to completing large chunks of work that are still missing. One of the major areas that needs work is the C# to browser integration as well as improving the browser plugin which only recently started working. Some work has been done (all on our public SVN repository) but the pieces came in too late to be integrated. We have a to-do list for some of the remaining tasks. Future Directions: Gtk# Widget and the Gnome Desktop Although Silverlight is intended to be used in a web browser we think it would be very useful to Linux desktop programmers to have Silverlight reusable as a widget. We already have been talking to a few folks about how we can help them improve and spice up their desktop applications with Silverlight. Obvious choices are all the existing Gnome/Mono based applications, but ever since we got started on this, the idea of writing a "Media Center" sort of UI has been making the rounds.

33

I have for years talked about my desire of having a "Flash on a Widget" widget for Gtk+, an idea that was not very popular back in the days when Flash was considered only a technology to do animations. We finally have such a widget and it can be scripted, hosted, embedded or extended from any ECMA CLI compliant language: all the traditional static languages for .NET as well as the new batch of dynamic languages that take advantage of the Dynamic Language Runtime (DLR). Larry of F-Spot fame for example has already prototyped F-Spot integration with the Surface demo:

He also has this mode printing PDFs already. Future Directions: Media Codecs

34

Currently we are using the fantastic ffmpeg video library but for the sake of distribution in some countries we might have to write a new video/audio backend. Novell will be requiring copyright assignments or contributions to be made under the MIT X11 license to Moonlight to ensure that we can ship this plugin with proprietary drivers if necessary (and also to relicense Moonlight for embedded system users). Future Directions: Silverlight Designer We will be working on a simple designer for Silverlight written in Silverlight itself. We hope to achieve:

Allowing Linux users to develop rich user experiences in Linux without having to learn XAML by memory or requiring a Windows machine with Blend to design UIs. To integrate this directly into our MonoDevelop IDE so people can create web sites using Silverlight (Michael Hutchinson of aspnet-edit, another Google SoC graduate will be joining us in September). By developing Silverlight in Silverlight we will also allow the MacOS crowd that currently can consume Silverlight content but not produce it to participate in the production ecosystem.

Future Directions: Logo We need a logo for the Moonlight project, so we can print T-Shirts. Jackson suggested on irc for the Silverlight Airlines demo: <jackson> also, we should totally add snakes, time permitting Contributing If you want to help on the effort, the best thing to do is to get the source code, instructions are here and post your questions or suggestions to the Mono Olive discussion group. Posted by Miguel de Icaza on 21 Jun 2007 This is a personal web page. Things said here do not represent the positionofmy employer.
35

3.5 Dynamic Language Support


At MIX we also announced and shipped the first release of a new .NET library that we call the "Dynamic Language Runtime" (or DLR for short). We've been investing a lot in making .NET and the CLR a first-class environment for dynamic languages, and a little over a year ago we formed a dedicated group within my team that has been focused on building better CLR runtime support for dynamic languages as well as delivering excellent .NET implementations of popular dynamic languages. The new Dynamic Language Runtime (DLR) adds a small set of services to the CLR designed explicitly for dynamic language scenarios. These include a shared dynamic type system, language hosting model and support to make it easy to generate fast dynamic code. With these additional features it becomes dramatically easier to build high-quality dynamic language implementations on .NET. Importantly the dynamic language implementations built using the new DLR support are not interpreted. Instead, we use the lightweight-code-generation features added in CLR 2.0 to create in-memory IL that is then JIT'd into native code at runtime (without ever having to save anything to disk). This can yield much better runtime performance than interpreted code, and the lightweight codegen feature ensures that once we are finished with JIT'd code we can optionally garbage collect it to avoid leaking. This enables an incredibly slick and powerful dynamic language programming environment, and enables developers to easily program against the full .NET API using dynamic languages. The DLR - and all of the dynamic languages built on top of it - can be used in cross-platform Silverlight application in the browser, ASP.NET 2.0 applications on the server, and WPF/WinForms applications on the desktop (basically anywhere where the CLR is enabled). At MIX we announced that Microsoft will be shipping 4 dynamic language implementations of our own for .NET:

36

Python Ruby (new) Javascript Dynamic VB (new)

We will ship the source code of our Python and Ruby implementations, as well as ship the source code for the underlying DLR library on CodePlex (all of the source will ship with full modification rights). You can download the DLR as well as the Python implementation (known as "IronPython") today from the IronPython codeplex site. The source code for the Ruby implementation (which we are going to call "IronRuby") will also be published on CodePlex in a few more weeks once it is a little further along. To learn more about our dynamic language support, I highly recommend watching this 15 minute video by John Lam showing off a dynamic language console built in IronPython and running on Silverlight on the Mac. It enables developers to interactively develop Silverlight applications (with intellisense support!) in the browser using Ruby, Python, Javascript and VB:

I'd also recommend watching this (free) conference session from the MIX conference that covers Silverlight 1.1 with dynamic languages:
37

Just Glue It! Ruby and the DLR in Silverlight

Jim Hugunin - who is the chief architect of the DLR - also writes a great blog on dynamic languages with .NET that I recommend subscribing to in order to understand how it works and what you can do with it.

Like www.asp.net and www.iis.net, we'll be using this new Silverlight site to deliver regular samples and "How-do-I?" videos. It also provides a forum system for getting help with Silverlight questions.

38

3.5 Assemblies
Silverlight is an extended subset of the 2.0 .NET framework. Existing assemblies (ECMA) are versioned as 2.1.0.0 which are reduced versions of the 2.0 libraries and have been annotated with the security attributes and have been expanded in a few areas.

Silverlight introduce new assemblies, all signed by the Microsoft key and versioned at 1.0.0.0 - except for AGCLR.DLL which isn't versioned in 1.1 Alpha (bug?).

Dependencies
As we can see in next figures Silverlight doesn't have any circular dependencies between it's assemblies, unlike Fx 2.0, which is good news and will reduce our build time (no special loops in the Make files like we have today).

39

Legend

Assemblies in red are compiled with /unsafe; "Trusted Callers" means that all assemblies can only be used from assemblies running at FullTrust. From a build point of view this means none of them have the AllowPartiallyTrustedCallers attribute;

New versioned Libraries We introduced a new NET_2_1 define and a new net_2_1 profile in the build system. The resulting libraries would be a superset that encompasses both 2.0 and the 2.1 API, but since 2.0 and 2.1 only have a few intersection points we will probably expand the Cecil Linker to specifically tune the 2.1 library to its right size without entering the world of pain that it would be to maintain the 2.0 and 2.1 defines at the same time.

40

In addition, we should look into injecting the security attributes System.Security.SecuritySafeCriticalAttribute and System.Security.SecurityCriticalAttribute out-of-line with another Cecilbased tool, again to avoid populating the code base with too many defines (Note: the injector has been completed). Tasks:

Setup the build for 2.1.0.0 versioned libraries Setup configure for it. Setup the key signing setup and our shoehorning-signer for it. Setup mono-api-info, mono-api-compare, corcompare pages for it. Integrate into the build system.

A peer project of this is Completing the 2.0 Profile effort. As both 2.1.0.0 and 2.0.0.0 share a lot in common. I would like to avoid an ifdef mess; my personal hope is that we can create probably a new profile NET_2_1 that would be a superset of NET_2_0. The result would be a larger assembly than we need to have. At that point, we should use the Cecil-based linker (which will have to be modified) and have the linker strip out all the public code that is not necessary in the 2.1 profile. Note: I generated the corcompare output, but it is hard to read because many issues boil down to the missing attributes, so a first step might be to write the injection library to reduce some of the noise. Note: For the curious the Microsoft BCL Blog Team (http://blogs.msdn.com/bclteam/archive/2007/04/30/introducingmicrosoft-silverlight-1-1-alpha-justin-van-patten.aspx) has published a list of the BCL classes available in SL 1.1 Alpha (http://blogs.msdn.com/bclteam/attachment/2338963.ashx). Note that this is not complete (BCL only) and subject to changes.

41

API Implementation Since there is no SDK documentation shipping with Silverlight 1.1, one way of getting a list of APIs to implement is to use the procedure described in this document: Explore Silverlight Assemblies with Visual Studio Object Browser Alternatively, you can use `monop2 -d assemblyname.dll' to get a list of classes and APIs from the Silverlight installation. System.ServiceModel.Web As part of the Google Summer of Code some of the APIs in this assembly will be implemented, but there are some areas that will not be implemented as part of it. There is currently nobody signed up for working on the Syndication APIs. And although these are not part of the Silverlight 1.1 release, they are on the roadmap. System.Windows.dll This contains the interface to the rendering engine and lives in two parts:

moon/src module on SVN (the C++ code) moon/class/System. Windows on SVN (the C# code)

The class hierarchy for instance (on the WPFNotes page) looks fairly simple, there are two kinds of classes there: those that derive from DependencyObject, and those that do not. The ones that derive from DependencyObject participate in the whole notification/propagation system and the others do not. It is probably simple for those that want to contribute to start work on the classes that do not derive from DependencyObject. We should follow the regular process: write nunit test cases to understand the API, and then write the API. One thing that seems clear to me is that the rendering should be done in the unmanaged world. Just like the full WPF does, it seems like the managed code is merely a front-end that communicates with the backend and creates the object in the unmanaged world. The unmanaged world actually does all the rendering. There are a couple of questions as to how much needs to go in
42

the unmanaged world, but at least it is clear that anything that derives from Visual as well as the majority of the things references from them (Brushes and Transforms at least, and maybe also PathSegments?) Currently the plan is to have the C++ code mirror the C# class hierarchy, and it will be responsible for rendering and for loading XAML files into memory. There are some stubbed out some classes in olive/class/agclr, but they are not complete and no real work has happened, there are just bits to see how pieces fit together. Compiler Fixes Mono 1.2.4 is not able to build the DLR, you can either use SVN of mcs, or you can use Seo's patches for the IronPython/DLR distribution from here LINQ Mono currently does not have a complete LINQ implementation, we need to complete those. They currently live in the mcs/class/System.Core directory. There are plenty of things left to implement in the LINQ namespace. Current developments:

Antonello contributed recently various core bits to LINQ. Atsushi has been working on the XML Linq support. Marek Safar has been working on the C# 3 linq syntax.

Rendering We are currently using Cairo for rendering, but every once in a while we consider the use of AntiGrain, there are pros and cons to each one, and we have not really done any real work to compare one against the other in terms of performance yet. Antigrain 2.4 is licensed under the MIT X11 license, which would be very good for embedded vendors, while Cairo is LGPL/MPL which is less friendly in some settings. Sadly Antigrain 2.5 is now dual-licensed under the

43

GPL/commercial so we could potentially be stuck maintaining a 2.4-based codebase. Cairo Pros:


Potential for hardware acceleration in the future. Maintained and used by multiple open source projects (Mozilla, Gtk+) Well known in the Mono community It is able to offload work to the X server. Interaction between Cairo and X server is well understood and actively worked on.

Cons:

API is context-bound instead of parametrized: so there is an API overhead to switch from one set of brushes, patterns to another one while drawing two different objects. License: LGPL/MPL, this might prevent its use on certain embedded scenarios (gaming consoles for example). Not yet tuned for performance.

AntiGrain 2.4 Pros:


Very fast today. Software. Composable stack. Template-based Parametrized API. Good cross platform story (Win32, X11, Linux).

Cons:

C++

Agg 2.5 will ship with a libsigc++ license that will allow us to treat the code as MIT X11 unless the code is pulled out, allowing Antigrain to be used internally for Silverlight and allowing them to license Antigrain for other customers.
44

4.0 Rendering Pipeline Both the "real" WPF and Silverlight have two components: a managed component that provides the API, that exposes the dependency property system and provides the high-level interface to the rendering engine and an unmanaged component that renders the "scene". There are also at least two threads: one that responds to redraw requests (to ensure that the content is always rendered regardless of whether the application is busy) and another that drives the process.

4.1 Integration with Compiz In some early discussions with David Reveman (the designer of Xgl and Compiz), we are considering the definition of a rendering scene protocol that would allow in the presence of Compiz offload the work to the compositing manager and take advantage of the direct hardware interface that Compiz has. The Plug-in and the DOM

45

Plugin relation to the Browser There are two directions of communication: the browser talking to the plugin, and the plugin talking to the browser. The plugin will have to expose the internal tree structure to its host, this is simple to do, documentation on how to write Mozilla plugins is available. Work on this will probably have to wait until we get the API to a reasonable state. The other direction (plugin communicating with the browser) can be started right away. This is the System.Windows.Browser and System.Windows.Hosting namespaces (they live in System.Silverlight.dll). Our initial goal is to support Mozilla so this should not be too hard.

46

4.2 Plugin Loading


Currently only one instance of the Mono virtual machine can live in a single process (the GC, signal handling, segfault handling all are controlled by the Mono runtime). Open questions:

How should various plugins be isolated from each other? Are AppDomains enough to isolate different plugins? Should Mono be modified to support completely different applications?

4.3 Hosting API System.Silverlight.dll and Microsoft.Scripting.dll are involved. Some notes at MoonlightHostingNotes. JavaScript compiler The JavaScript compiler does not look like it will be open sourced, but some comments from the Mix conference indicate that it is probably a small compiler (scanning and parsing) that defers most of the work to the DLR (already open source). The size of the Javascript compiler in Silverlight and the runtime are 114,688 and 299,008 bytes respectively. Extrapolating this from the size of our C# 1.0 compiler means that their Javascript compiler is roughly 9,000 lines of code, and the supporting runtime is roughly 22,000 lines of code. We have a runtime we could start from already, but it will likely require some changes, while the Javascript compiler seems relatively trivial to implement.

47

5.0 Silverlight SDKs


Developers can create Silverlight 1.0 applications without any extra dependencies in MacOS and Linux. Silverlight 1.1 can optionally use C# and the .NET framework to create applications. For users of Silverlight 1.1 we are creating an SDK that developers can use to create applications that will run on Silverlight 1.1 controls For Developing on non-Microsoft Systems If you install Mono as described in the Getting Started section you will get an SDK that you can use to develop against Microsoft Silverlight and Mono Moonlight APIs. Instead of using the mcs or gmcs compilers as you do regularly with Mono you need to use the smcs compiler that will generate and reference the proper assembly versions that are suitable for Silverlight development.

5.1 Providing the Missing Pieces


Since Silverlight is a subset of the .NET libraries, we should write a Cecilbased tool that extracts the needed classes that a developer might need from Mono's implementation of the class libraries and provides this funcionality to developers. For example, XmlDocument is not available on Silverlight, but a developer might be willing to pay the cost in his application to bundle the needed code. With this tool, we could pull the code from Mono assemblies and give these to the developer. It would extend the reach of Mono's implementation of those APIs, and it would encourage developers to send bug fixes, improvements and contributions back to the project.

5.2 Moonlight IDE


Since Linux and MacOS developers will not be able to run Blend on their operating systems, we have created a XAML designer. This XAML designer is located on SVN in the module "lunareclipse".

48

Lunar Eclipse currently is a standalone desktop application but we want to build a MonoDevelop add-in to have a full Silverlight development experience and possible also port it to the web to provide a designer that MacOS users to use. It also looks like the current VS.NET Orcas can't help (http://silverlight.net/quickstarts/Start/BrowseApi.aspx) much to create Silverlight code based on the security attributes: The Silverlight assemblies include both members that can be used in Silverlight-based applications and members that can be referenced only by .NET Framework code. The members that cannot be used in Silverlightbased applications are identified by the presence of the SecurityCriticalAttribute attribute. The presence of this attribute is not visible in the Object Browser, so you cannot discern which members can be used for Silverlight-based applications. However, you will get an exception when you attempt to execute a security-critical member in a Silverlightbased application. .

5.3 Debugging JIT issues


Since there is no way of passing command line options to the Mono VM embedded in the plugin, you can always wait inside gdb for the first time you get a breakpoint (it happens when the GC scans memory for the bottom of the stack) and you can set some o the debugging variables like this: (gdb) run -no-remote -P debug default.html ... Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1223038608 (LWP 19647)] 0xb2068da7 in GC_find_limit (p=0x89c6f8c "", up=0) at os_dep.c:813 813 GC_noop1 ((word)(*result)); (gdb) p debug_options $1 = {handle_sigint = 0, keep delegates = 0, collect_pagefault_stats = 0, break_on_unverified = 0} (gdb) p debug_options.break_on_unverified = 1

49

$2 = 1 (gdb) cont In the above case, I set the break-on-unverified debugging option that will break into the debugger when unverifiable code is found.

6.0 How Silverlight Update Works


Silverlight is designed to make the update experience as seamless as possible, but its designers also considered security awareness as well as enabling user or enterprise managed overrides. Silverlight knows to kinds of updates. 1. Security related updates. Silverlight checks for security related updates once every 24 hours. Security related updates patch vulnerabilities, but do not provide new features. The 24 hour check interval minimizes your exposure to known vulnerabilities. 2. Feature updates. Silverlight checks for feature updates once every 30 days. Feature updates are releases delivering new capabilities; you know the things that help you build even better Silverlight experiences. For example, Silverlight RC is going to check for the 1.0 release once every 30 days. The Silverlight control has to be running for those checks to occur -- which means the control has to be playing content (which shouldn't be a big deal since there's going to be a LOT of content). When Silverlight will automatically downloads the new version in the background when an update is available and then runs the installation in silent mode to make the new version available the next time your browser starts. Unfortunately, the restart is necessary to unlock the loaded DLL -- remember the control had to be loaded to check for the upgrade. Silverlight will not prompt you to restart the browser if it downloaded a feature updates though. The new version will just magically be there. Getting security updates installed quickly is more important , because they help you to reduce exposure to vulnerabilities, Silverlight will prompt your
50

to close and re-open your browser to make sure you're safe and your time of exposure is as short as possible. In most cases the automatic installation of updates means that users should have the latest Silverlight control installed when they browse to a page with content that requires a recently released Silverlight version. There may be a few cutting edge users that browse to content that requires the latest features before it's time for Silverlight to check for a feature update. In that case, you'll see a nice logo (hopefully) to tell you that Silverlight is downloading a new version for you right now and you'll have to wait until download and inplace upgrade are complete. Then you restart your browser and navigate back to your cutting edge content site. Now, there are a few exception scenarios where Silver lights update behavior is different: Youre running on a Mac your Mac may be cooler than my ThinkPad, but it will detect that an update is available and, based on your update configuration, redirect you to a Microsoft site to update your version. Your browser will navigate to the Silverlight download page and ask you to verify and install the new Silverlight version. You don't like updates and chose to opt out of update checks in the Silverlight configuration. Your choice. We respect your choice and Silverlight will not automatically download and update to new versions. We do believe it's important that you know about security updates and therefore go ahead and check (once every 24 hours) for available update. Instead of downloading and installing updates in the background, we prompt to ask you if you want to install the upgrade. you work in an enterprise that prefers to retain full control over the software that's running on your computer. They can fully prevent Silverlight from any checking and prompting, get the updates from WSUS an install as they deem necessary.

51

7.0 Silverlight vs. Flash An Analysis Report


Silverlight Silverlight Limitations: Silverlight is missing Linux support, so people using Linux machine cannot run it on their machines and will have to stick to Windows and MAC OS. Silverlight will (naturally) be using the WMV and Silverlight will add to the use of the WMV file format. Using the WMV video format essentially makes Silverlight useless for the vast majority of video websites such as YouTube. It cannot play .avi and .mov file. Flash

This limitation doesnt exist with Flash.

Flash Video turned Flash into a mechanism for delivering media with far more potential than any other solution that is .flv, no doubt Flash has also limitation to play other video file. For that Flash required codex for that player installed on Client machine. Even flash is also lacking this area. Silverlight has no support for binding Flash can read data source in terms to models, binding to data, or even of XML or text from some URL and connecting to network resources to can use it. Same thing silverlight also obtain data. can read. Silverlight doesn't even have support for things that should be considered a stock part of any library such as Flash has rich set of control library. buttons, checkboxes, list boxes, list views, grids, etc. Probably in future release may Microsoft support it. Once the accessibility features are provided with Silverlight versions, any existing test tools that support Flash test tools are already in place. driving UI through Accessibility will be fully enabled to automate Silverlight applications Silverlight 1.0 does not support GIFfile format. Even it doesnt support BMP and other file format. It Support all image formats. supports only JPG and PNG file format.
52

Cant do sound processing. Socket programming is not possible. Per pixel bitmap editing, bitmap filters (convolution, color matrix, etc), bitmap effects (drop shadow, blur, glow) cannot be done. Webcam and Microphone support it not there. Built in file upload/download support is not available. The performance of Silverlight and Flash will be nearly the same. While Silverlight is using XAML as description language in a noncompressed format size of Silverlight component is large. In practical implementation of similar component in Flash and Silverlight it has found that size of Silverlight component is approximately 10-20 times larger than Flash component. To deploy Silverlight to client browser more than one components ship. (1) XAML files (2) .dll if using C# (3) Silverlight.js (4) Custom JavaScript file. Images/videos/sounds also required deploy separately. It has found in practical implementation of image animation, at some extent flickering occurs on image.

With some media file sound processing can possible. Flash allows creating XML Socket object. Can do that. Flash supports it. Inbuilt Upload/download support is there.

Size of flash component is smaller.

Flash ships in single component that is .swf. Images/video/sounds also incorporated in single .swf package.

To avoid this type of flickering in flash, refresh layout or cache bitmap functionalities are available.

53

It has found in practical implementation of video play, audio may start playing before showing Flash doesnt face these types of movie on screen. It has also found issues. video can still continue to play after redirecting to other page. It may be it is bug of current beta release. Flash can be played as Windows Right now not any support to play application also by downloading Silverlight object as Windows player for it. Flash can be also application. packaged as .exe which can be deploying standalone. Silverlight is new in market and Flash is exist from many years and required time to get acceptance in have strong acceptance in market. market. Silverlight Feature comparison with Flash Features: Animation - Silverlight supports the WPF animation model, which is not only time based instead of frame based, but lets you define the start and end conditions and it will figure The animation model is frame based. out how to get there for you. No need to deal with matrixes like in flash. Also no need to calculate positions on various frames. It just works. Flash stores its shapes using binary shape records. In order to write shape Silverlight uses XAML. XAML is definitions, you will need to either text based and can be output using a license a 3rd party Flash file format simple XML object. SDK, or build your own. It isnt too difficult, but it does require a bit of a learning curve. The debugging with Silverlight is The debugging with flash is harder simpler than with flash. than Silverlight. Silverlight lets you embed true type font information directly into your Dealing with fonts is fairly complex projects, and download that with flash. information with the downloader object.

54

Rich set of development languages are available for Silverlight. Developer can use JavaScript as well as managed code VB.Net, C# for Silverlight development. XAML is declarative while ActionScript is imperative. Using imperative languages to build UIs goes back to the early days of DOS and Windows, when developers had to manage all of the API nuances when interacting with graphical panes.

Only Action Script can be used as programming tool in Flash.

ActionScript is an imperative language, which brings itself the pitfalls of imperative languages when compared with declarative languages.

55

Web Services support for Silverlight Streaming:The services provided by Microsoft, called Silverlight Streaming, it allows users and developers to host their Silverlight content and apps with Microsoft, taking advantage of their extensive global network of datacenters and their content delivery network. Best of all, this service is free, and while currently it is only in alpha it allows users to upload up to 4GB of content, and to stream up to 1 million minutes of online video delivery at 700kbps, around DVD quality. Starting right now, you can build a total video content site using Silverlight at no cost. The future for this service looks good as they will incorporate Silverlight Streaming with the MSN Video ad network to allow you to easily monetize your video streams and participate in a revenue sharing opportunity with Microsoft while removing your distribution costs. There will also be a premium level of content delivery where you will be able to pay for higher levels of usage - the cost for this service is as yet unknown but expect it to be very low.

There is not any such service provided by Flash to host the content and application with them. Because of the absence of any such service, building a video site based on Flash is not as cost effective as building a video content site using Silverlight. Moreover, because of the Silverlight Streaming service, the existing Video Content sites might be moving to Silverlight site.

56

Additional Support for mobile devices with desktop and desktop browsers: Silverlight is supported by Windows mobile device as part of a new service that the NBL have built. Silverlight applications and media streaming can be run on a mobile phone - so Silverlight even at this stage is about more than just the desktop browser and desktop market. Silverlight may be seen soon on the Symbian OS too. Silverlight does not require video codec to run industry standard videos like .WMV Silverlight supports scalable video formats from HD to mobile. Silverlight supports Hardwareassisted editing and encoding solutions. Silverlight has XAML based presentation layer for SEO. Silverlight provides End-to-end server and application platform. Media server licensing is cheaper than flash. Silverlight supports Scalable full screen video.

Flash is not spread as across the vast majority of both desktops and mobiles platforms, as compared to Silverlight. Flash requires Flash Lite preinstalled on mobile devices.

Flash requires video codec to run .WMV videos. Flash does not support scalable video formats from HD to mobile Flash does not support Hardwareassisted editing and encoding solutions. Flash does not have XAML based presentation layer for SEO. Flash does not provide End-to-end server and application platform. Media server licensing is costlier than Silverlight. Flash does not support Scalable full screen video.

8.0 Why Silverlight is an important?

57

The announcements around Microsofts new Silverlight platform yesterday were important to anyone who is thinking about where the web will evolve. For those of us watching the demos at the Mix conference the immediate importance of it was apparent - Silverlight will be the platform of choice for developers who build rich Internet applications. It makes Flash/Flex look like an absolute toy. After the keynote, the main topic of conversation in the hallways centered on just how effectively Microsoft carried out its execution of Adobe. We didnt cover the news as it broke - I was on stage at Mix and Nik Cubrilovic was denied a press pass due to a mixup and got in very late. There was a lot of early coverage but mostly from journalists who hadnt been properly briefed on it or who rushed to post quickly. In preparation for the Mix Q&A, Nik and I had well over 10 hours of briefing on Silverlight, with very senior Microsoft employees (Ray Ozzie, Scott Guthrie, Charles Fitzgerlad) as well as members of the product team that actually build Silverlight (Keith Smith and Brian Goldfarb). Nik wrote a very long post yesterday afternoon on Silverlight, long after the initial news broke. From a pageview standpoint, the post was a loser for us. We would have been far better off doing a one-paragraph post at 10 am announcing the news, and by the time we wrote in the late afternoon the buzz had worn off somewhat. Im glad we waited to write. Nik (a long-time developer) was most impressed by how small Silverlight is (4 MB) and how fast it is (it blows away native Javascript routines - without exaggeration, Ajax looks like a bicycle next to a Ferrari when compared to Silverlight). The news today about Silverlight is significantly more thoughtful. Microsoft-hater Steve Gillmor gives it a thumbs up and says the engineering behind this is stunning. Robert Scoble, whos angry at Microsoft for not giving him a free pass to the Mix event, says Microsoft rebooted the Web yesterday. The list goes on. If you are a developer or an entrepreneur, take a look at Silverlight, download some of the sample applications, and take the time to understand how it can affect your product. Our overview post is here, and our podcast interview with the product manager who built it is here.

58

Some of the most interesting new web applications will be built on this platform.

9.0 Build a Silverlight media player


Hands on Microsoft's deal with US media giant NBC Universal to stream this summer's Olympic Games online using Silverlight represents a major demonstration of the potential of Microsoft's emerging browser-based runtime and streaming service. In keeping with the news, and following on from my earlier introduction to Silverlight, I wanted to go one step further in building a Silverlight richmedia application and service. Here, I plan to show a more realistic application that demonstrates how designers and developers can work together using Silverlight.

Let's assume you work for a media company that has just signed a new artist. You're working with designers and marketing people to come up with new ways of promoting bands online. How can Silverlight help with this?

9.1 Design
Rather than work with Adobe's Photoshop, let's encourage the designer to use the new Microsoft Expression. All the Expression tools are available on a trial basis from the Microsoft Expression web site. First we can preview and select from the available photos and artwork using Expression Media.

59

Browse and select artwork in Expression Blend Expression Design can be used to build any additional graphic assets. If we need to edit the audio, change its format or crop it, we can use Expression Encoder. To create the application, we'll use Expression Blend 2 December Preview and choose File > New > Create a new Silverlight 1.0 Site project. The new site includes a holding page, some XAML, JavaScript and the allimportant Silverlight.js file. Now we can add all the images that we want to use, along with the audio file (in WMA format) to the project. Images and media can be dragged onto the design surface and arranged to create the design.

Combined images and cover in Expression Blend

60

The basic design is nearly done, but we need to name the buttons playButton, stopButton and pauseButton to allow the developer to attach functionality. Visual Studio shows the XAML that was generated by Blend. Whilst we could go in and start editing it directly - attaching event handlers for instance - I prefer to leave the XAML alone and do everything through script. The Page.xaml.js already defines a handleLoad function, which is the ideal place to set up the new functionality that we need to add. The Silverlight control essentially extends the Document Object Model, so it's easy to find elements from within JavaScript: this.playButton = rootElement.findName("playButton"); this. audio = rootElement.findName("audio"); Having found the play button, we can add an event handler: this.playButton.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.play)); The event handler instructs the audio element to begin playing. play: function(sender, eventArgs) { this.audio.Play(); }, We can continue to wire up the stopButton and pauseButton in a similar way. The play and pause buttons are mutually exclusive - having paused, you need to press play to continue - so we must swap the visibility of these two buttons at the appropriate times. Play: function(sender, eventArgs) { this.playButton.Visibility = "Collapsed"; this.pauseButton.Visibility = "Visible"; this.audio.Play(); },
61

pause: function(sender, eventArgs) { this.pauseButton.Visibility = "Collapsed"; this.playButton.Visibility = "Visible"; this.audio.Pause(); }, We now have a very basic player that can be run from within Visual Studio press F5 or select Debug > Start Debugging.

9.2 Refine the design


Back in Expression Blend, let's create a storyboard that we can use to animate the artist photographs. A storyboard describes the changes to the properties of an object over time. Here we'll hide and show the photographs by changing their opacity. This should give us a kind of slide show effect, with photographs appearing to stack on top of each other. Click the Plus button on the Objects and Timeline window to create a Storyboard; call it doSlideShow. Now create key frames at the points that you want to show photographs - say every eight seconds. The first key frame at 0:00.000 should have all the photographs set to opacity zero, or hidden. Select each of the images in turn and mark the key frame where the image opacity should be switched to 100 per cent. The buttons above the timeline (see picture below) view allow you to test the animation - Blend automatically interpolates the opacity between key frames. You'll need to experiment, adding more key frames until you get the effect you want. I suggest adding key frames with opacity zero, one second before switch on to give a sequenced effect.

62

The animation timeline in Expression Blend

Storyboards can be accessed and controlled just like media elements. The animation can be stopped and started accordingly. this.doSlideShow = rootElement.findName("doSlideShow"); this.doSlideShow.Begin() The full code for this project is available for download here. With a few changes, though, the application can easily be hosted in the Silverlight Streaming Service. First remove the Default.html, Web.Config, Default.html.js and Silverlight.js files. The silverlight.js file is no longer required - this functionality is replaced by Silverlight Streaming. Add some JavaScript that can be called when the application loads - add a file called Player.js as follows (the createDelegate snippet is just some glue that used to come from Silverlight.js). Silverlight.createDelegate = function(instance, method) { return function() { return method.apply(instance, arguments); } }
63

function onLoad(sender, context, source) { var scene = new ChildOfMine.Page(); scene.handleLoad(sender, context, source); } Then create a manifest.xml file that loads the XAML and calls the onLoad function defined above. <SilverlightApp> <version>1.0</version> <source>Page.xaml</source> <onLoad>onLoad</onLoad> <jsOrder> <js>Page.xaml.js</js> <js>Player.js</js> </jsOrder> </SilverlightApp> You can now ZIP up the files and upload to Silverlight Streaming - a process described in detail in my earlier article. To see the application running using the Silverlight Streaming IFRAME invoker click on this link. Wrapping it up Traditionally graphic designers use a tool like Photoshop then "throw their design over the wall" to developers who are responsible for cutting the graphics into the application. The design very rarely works exactly as intended and considerable rework is required if the design changes. The combination of Expression and Visual Studio offers a way to close the gap between the two camps. Thanks to Helen Yousaf for permission to use her copyright material in this article. Rob Blackwell is director of R&D for Active Web Solutions who worked with the Royal National Lifeboat Institute (RNLI) to build its award winning Sea Safety tracking system. You can keep up with Rob here.
64

10.0 Advantages and Drawbacks of silverlight

10.1 Uses of the Silverlight


It is with tremendous pleasure that I can reveal Microsoft Silverlight: our next-generation, cross-platform, cross-browser web client runtime. Silverlight (previously codenamed "WPF/E") is a lightweight subset of XAML for building rich media experiences on the web. There's lots of material at the NAB virtual press room site, but I thought I'd share my top ten list of reasons why you might want to use Silverlight:

1. It supports playback of WMV files on both PC and Macintosh, with many options for interactivity during playback; with just a couple of lines of code, you can provide a platform-neutral way to handle all your movie files. Silverlight supports full-screen 720p video and offers seamless transitions between full-screen and windowed mode without losing your position in the video (something that media sites are crying out for today).

2. By separating markup (XAML) from code, Silverlight provides a

familiar web metaphor for designers and developers. You can embed XAML directly within an HTML file if you want a simple, monolithic solution, or you can keep the two separate to enforce delineation between different web development roles.

3. Silverlight and HTML integrate seamlessly together. Every XAML element can be accessed or manipulated from the same client-side JavaScript that would be used to interact with any DHTML element: there are no artificial boundaries or barriers, and you can even overlay HTML elements on top of Silverlight content (simply by creating a windowless frame). We'll also make it very easy for an ASP.NET AJAX developer to add Silverlight content.

65

4. You can embed XAML directly into your HTML pages; there's nothing binary or opaque about the format. There are only three steps necessary to add animation or media to your RIA application: (i) include a standard JavaScript file in your HTML header; (ii) call a function to create the Silverlight object anywhere on the screen; (iii) add some XAML content (an animation, some media) for runtime delivery.

5. You have full runtime interactivity with Silverlight content. The contents of the XAML file can be completely server-generated, to contain information populated from a database. From JavaScript, it's just a matter of calling the createFromXaml method to add or remove elements dynamically at runtime. There's nothing that you can only create or manipulate at design-time.

6. Silverlight is just a 1MB download on a PC (slightly more on a Macintosh because the universal package contains both Intel and PowerPC versions); it supports Windows XP and above, with Windows 2000 support to come.

7. Silverlight is blindingly fast - for example, you can play many videos simultaneously without stuttering or dropping frames (subject to network bandwidth, of course). We're introducing a new video brush in Silverlight that allows you to use video as a texture for any 2D object (a rectangle, an ellipse or a path). This is going to allow designers incredible power to use media in new ways that have never been accessible through other existing technologies.

1. Silverlight is both client- and server-agnostic. There's no difference between the Macintosh and PC runtimes; you don't need any Microsoft software on the server if you don't want to - you can deliver
66

a great Silverlight experience from an Apache / Linux server to a Mac OS 10.4 client.

2. Silverlight is almost 100% upward compatible with WPF. Animation, 2D vector graphics, media, text - they're all present in Silverlight and the concepts you've learnt in WPF carry forward (although Silverlight is a subset - it doesn't support WPF features such as 3D, data binding or templates). You can use the same tools (e.g. Expression Design) to generate content for Silverlight; you can take XAML from Silverlight and use it in a WPF application when you want to scale up and take full advantage of your local machine. 3. Ah... #10. I can't reveal this yet - there's a big surprise up our collective corporate sleeve that will be announced at MIX. I hate to hold back on you, but anticipation is part of the pleasure, as my mother used to tell me as a child when I was waiting impatiently for Christmas to come! Now that Windows Vista is done, I'll be shifting the focus of my blog slightly - I'll still write just as much about WPF, but I'll also start to write about its web-based little brother, since they both are part of the same continuum and my day-to-day job incorporates both technologies equally. Rich interactive web-based and Windows-based content; it's an exciting time to be a client platform evangelist!

Here is why we want Silverlight to be a UI model for MCE developers

Intuitive - the WPF/XAML/Silverlight code-behind model makes sense to ASP.NET developers. MCML would have to be extended to work the same large developer base - Silverlight is only in beta/alpha, and already has more 3rd party developers than MCML tool support - VS.NET 2005 and Blend ... MCML only has McmlPad (similar to the lightweight tool XamlPad) Books - there are a lot of books out there for learning WPF, and that info will mostly transfer to learning Silverlight. i'm assuming Silverlight books are on the way.

67

Write once / run anywhere - Ive done java, so I know that's never the case, but Silverlight could get us closer. Developers are going to want a common code base for apps that run in MCE, extenders (including 360), and MediaRoom. and with Silverlight being cross platform, we ultimately want it to run in Apple TV and the Wii/PS3 browsers. Learn once / write everywhere - developers have to know a ton of different technologies. if they happen to learn WPF when writing desktop apps, and then they could leverage that for MCE ... that'd be huge. as of now, somebody wanting to get into MCE dev pretty much has to start from scratch for figuring out MCML. media support - it already supports 720p, with advanced playback capabilities, in a very small runtime ... perfect for MCE Controls - the Silverlight 1.1 alpha is adding controls, i haven't that MCML is adding controls yet? Momentum - Silverlight's got all the mojo. heard some of the stuff being added to MCML at the summit, cant say what those features are, but its not impressive

10.2 Limitations of the Silverlight


These are some of the problems i noticed about working with Silverlight in MCE

Different runtimes - Vista MCE uses .NET 3.0 and Silverlight uses its own (1 or 2 Meg) runtime. if Silverlight were tooled to run locally as full trust permission within MCE, then MCE might have to change the way it hosts 3rd party controls in an external process. Historically, MCE has been slow in adding new runtime support for developers. E.g. MCE devs were doing .NET 1.1 for a long time after .NET 2.0 was out. No Silverlight runtime on the 360 - it sort of works on an extender right now, but it renders through remote desktop at about 5fps. XNA has already got a version of the Compact Framework on the 360, and Silverlight is being made to work on Windows Mobile devices using CF ... so it doesnt seem like that far of a stretch to get the XNA runtime to work on the 360. it's only a 1 or 2 meg runtime, so it shouldnt be that difficult. Hell, the Mono crew has already made Moonlight for Linux :)
68

Limited keyboard support - currently, only the root Canvas can get keyboard events. Plus the Silverlight controls need to have keyboard support added. Layout - need more layout elements that will flow and scale to display properly on large screen TVs. different execution - XBAP can run locally or served from the web, I 'think' Silverlight can run in this same model, i just haven't tested it yet. If not, i'm assuming Silverlight will get this model for Windows Mobile? Javascript - had to resort to javascript for some functionality (e.g. alert ()) ... hate javascript. we need more managed code APIs to reduce the amount of javascript we have to write. granted, it's also a plus, that developers can choose to use javascript exclusively. back button - need a way to hook the Back button to keep the Silverlight app from exiting until it is supposed to exit back to MCE runtime install - need a way to install the runtime from within MCE and only using the remote

11.1 Silverlight Compatibility

IE OS/Brow 6 ser SP 1

IE 6 IE IE Firefox/SeaMonkey/ Safar Konquer Opera SV 7 8 Mozilla i or 1 1.0, 2.0; via N/A NPA PI

Windows N/ N/ 1.0, Vista/Ser 2.0 1.0, 2.0 A A 2.0 ver 2008

Unofficia lly

69

Windows Server N/ 1.0, 1.0, 2003/Ho 2.0 1.0, 2.0 A 2.0 2.0 me Server

1.0, 2.0; via N/A NPA PI 1.0, 2.0; via N/A NPA PI 2.0; via N/A NPA PI

Unofficia lly

Windows N/ 1.0, 1.0, 2.0 1.0, 2.0 XP A 2.0 2.0

Unofficia lly

Windows N/ N/ N/ 2.0 2.0 2000 A A A

Planned

Windows N/ N/ N/ 1.0 N/A Mobile 6 A A A Mac OS X N/ N/ N/ N/ 1.0 10.4.8+ A A A A PPC Mac OS X N/ N/ N/ N/ 1.0, 2.0 10.4.8+ A A A A Intel Linux x86 N/ N/ N/ N/ Planned A A A A

N/A N/A

N/A

1.0

N/A

Planned

1.0, 2.0

N/A

Planned

N/A Planned Planned

70

(Moonlight)

Linux N/ N/ N/ N/ x86Planned A A A (Moonlight) A 64

N/A Planned Planned

11.1 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.[29] A Silverlight project contains the Silverlight.js and CreateSilverlight.js files which initializes the Silverlight plug-in 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. Silverlight applications can be written in any .NET language. As such, you can use for work with Silverlight any development tools which can be used with .NET languages. 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. The current beta release of Visual Studio 2008 requires the Visual Studio Tools for Silverlight to create Silverlight projects, and let the compiler target CoreCLR. A Silverlight project contains:

71

the Silverlight.js and CreateSilverlight.js files which initializes the Silverlight plugin for use in HTML pages, XAML file for the UI, code-behind files for the application code.

You can debug Silverlight applications in a manner similar to ASP.NET applications. Also you can use Visual Studio's CLR Remote Cross Platform Debugging feature to debug Silverlight applications running on a different platform as well. Development Tools:

Microsoft Visual Studio 2005 The premier developer tool for creating Silverlight 1.0 applications. Silverlight product support requires the Standard, Professional, or Team System editions of Visual Studio 2005, with the Microsoft Silverlight 1.0 Software Development Kit (SDK) installed. Microsoft Visual Studio 2008 Beta 2 Microsoft Visual Studio 2008 Beta 2 Standard Edition Microsoft Visual Studio 2008 Beta 2 Professional Edition Microsoft Visual Studio Team System 2008 Beta 2 Team Suite

The next-generation developer tool for creating Silverlight 1.1 Alpha September Refresh applications. Silverlight product support requires the Standard, Professional, or Team System editions of Visual Studio 2008 Beta 2, with the Microsoft Silverlight Tools Alpha Refresh for Visual Studio 2008 Beta 2 installed.

Microsoft Silverlight Tools Alpha Refresh for Visual Studio 2008 Beta 2 (July 2007) The add-on to create Silverlight applications using .NET. This add-on requires the Standard, Professional, or Team System editions of Visual Studio 2008 Beta 2. It will not work with the Express Editions of Visual Studio 2008 Beta 2. Microsoft ASP.NET Futures (July 2007) This release includes Silverlight controls for ASP.NET.

Designer Tools:

72

Expression Blend 2 September Preview Professional design tool to create Silverlight user experiences. Expression Encoder A feature of Expression Media that offers encoding, enhancement, and publishing of rich media experiences to Microsoft Silverlight. Expression Design A professional illustration and graphic design tool to create Silverlight assets. Microsoft Silverlight 1.0 Software Development Kit

Software Development Kits:

Microsoft Silverlight 1.0 Software Development Kit The SDK contains documentation and samples, together with templates for Visual Studio. Microsoft Silverlight 1.1 Software Development Kit Alpha September Refresh The SDK contains documentation and samples

11.2 Licensing
An unattributed report claimed 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.[32] However, portions of the Dynamic Language Runtime, included with Silverlight, have been made available on Microsoft's CodePlex website using the Microsoft Public License.

Criticism
Silverlight has received criticism for narrow operating system compatibility, especially for keeping Linux out of their official offering. Even though they are officially collaborating on Moonlight project, Bruce Chizen, CEO of Adobe has questioned "the commitment of Microsoft to keep the Silverlight platform compatible with other OS besides Windows".[33] His concerns are based on "examples from history" where, he claims, Microsoft has launched products with promises of ongoing cross-platform compatibility that no longer apply.

73

Microsoft has also been criticized for not using the Scalable Vector Graphics standard for Silverlight.[34] California and several other U.S. States have asked a District Judge to extend Microsoft's antitrust case settlement for another five years,[35] citing "a number of concerns, including the fear that Microsoft could use the next version of Windows to 'tilt the playing field' toward Silverlight, its new Adobe Flash competitor", says a Seattle Post-Intelligencer article.

12.0 Security
Developers commenting on the security model for Microsoft's Silverlight application development platform have extolled its virtues. The comments have come from the .NET security blog, in reference to Microsoft's recently announced Silverlight, a cross-browser, cross-platform plug-in for .NET-based web and rich media applications. James Senior, a Microsoft technical specialist in the U.K., spotted several examples of Silverlight security receiving kudos from developers. Senior noted how Silverlight applications will be security transparent. They will not contain unverifiable code, or be able to call native code directly. Applications can access public methods only if the methods are security transparent, or if the method has a SecuritySafeCriticalAttribute. Senior also referenced posts showing types that can be contained in a Silverlight application, again with an emphasis on security. The security model will have to stand up to rigorous abuse in the real world once Microsoft and developers begin to ramp up production of Silverlight applications, and they gain more regular use publicly. Attackers will render a poor security model useless, and if that happens

74

Microsoft will bear the wrath of people victimized by yet another exploit of one of their applications.

75

S-ar putea să vă placă și