silver light

35
MICROSOFT SILVERLIGHT SEMINAR REPORT Submitted by M.SREENIVASAN In partial fulfillment of the award of the degree Of BACHELOR OF TECHNOLOGY In COMPUTER SCIENCE AND ENGINEERING SCHOOL OF ENGINEERING COCHIN UNIVERSITY OF SCIENCE & TECHNOLOGY COCHIN-682 022 JULY 2008

Upload: sreehari143

Post on 19-Nov-2014

335 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Silver Light

MICROSOFT SILVERLIGHT

SEMINAR REPORT

Submitted by

M.SREENIVASAN

In partial fulfillment of the award of the degree

Of

BACHELOR OF TECHNOLOGY

In

COMPUTER SCIENCE AND ENGINEERING

SCHOOL OF ENGINEERING

COCHIN UNIVERSITY OF SCIENCE & TECHNOLOGY

COCHIN-682 022

JULY 2008

Page 2: Silver Light

DIVISION OF COMPUTER SCIENCE AND

ENGINEERING

SCHOOL OF ENGINEERING

COCHIN UNIVERSITY OF SCIENCE & TECHNOLOGY,

COCHIN-682 022

Certified that this is a bonafide record of the Seminar Entitled

“MICROSOFT SILVERLIGHT”

Done by the following Student

M. Sreenivasan

Of the VIIth semester, Computer Science and Engineering in the year 2008 in

partial fulfillment of the requirements to the award of Degree Of Bachelor Of

Technology in Computer Science and Engineering of Cochin University of Science

and Technology

Certificate

Seminar Guide Head Of Division

Dr. DAVID PETER .SMs. Sheena S

Date:

Page 3: Silver Light

ACKNOWLEDGEMENT

At the outset, I thank the Lord Almighty for the grace, strength

and hope to make my endeavor a success.

I also express my gratitude to Dr. David Peter, Head of the

Department and my Seminar Guide for providing me with adequate

facilities, ways and means by which I was able to complete this seminar. I

express my sincere gratitude to him for his constant support and valuable

suggestions without which the successful completion of this seminar would

not have been possible.

I thank Ms. Sheena S, my seminar guide for his boundless

cooperation and helps extended for this seminar. I express my immense

pleasure and thankfulness to all the teachers and staff of the Department of

Computer Science and Engineering, CUSAT for their cooperation and

support.

Last but not the least, I thank all others, and especially my

classmates and my family members who in one way or another helped me in

the successful completion of this work.

M.SREENIVASAN

Page 4: Silver Light

ABSTRACT

Microsoft Silverlight is a web browser plugin that provides

support for rich internet applications such as animation, vector graphics

and audio-video playback. Silverlight competes with products such as

Adobe Flash, Adobe Flex, Adobe Shockwave, JavaFX, and Apple

QuickTime. Now in beta-testing, version 2.0 brings improved

interactivity and support for .NET languages and development tools.

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. Mobile devices, starting with Windows Mobile

6 and Symbian (Series 60) phones, will also be supported. A third-party

free software implementation named Moonlight is under development to

bring compatible functionality to GNU/Linux.

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 indexable than that

Page 5: Silver Light

created with Flash as it is not compiled, but represented as text (XAML).

Silverlight can also be used to create Windows Sidebar gadgets for

Windows Vista.

Silverlight supports playback of WMV, WMA and MP3

media content across all supported browsers without requiring Windows

Media Player, the Windows Media Player ActiveX control or Windows

Media browser plugins. Because Windows Media Video 9 is an

implementation of the SMPTE VC-1 standard, Silverlight also supports

VC-1 video, though still only in an ASF file format. Furthermore, the

Software license agreement says VC-1 is only licensed for the "personal

and non-commercial use of a consumer". Silverlight does not support

playback of H.264 video. 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 Silverlight application being edited in Microsoft Visual

Studio.Silverlight applications can be written in any .NET programming

language. As such, any development tools which can be used with .NET

Page 6: Silver Light

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 Microsoft Expression Blend

versions 2.0 and 2.5 for designing the UI of Silverlight 1.0 and 2

applications respectively. Visual Studio 2008 can be used to develop and

debug Silverlight applications. To create Silverlight projects and let the

compiler target CoreCLR, Visual Studio 2008 requires the Silverlight

Tools for Visual Studio which is available as a beta release

Page 7: Silver Light

TABLE OF CONTENTS

CHAPTER NO: TITLE PAGE NO:

LIST OF TABLES i

LIST OF FIGURES i

1. INTRODUCTION

1.1 OVERVIEW 1

1.2 RELEASES 1

2. SILVERLIGHT

2.1 WHAT IS SILVERLIGHT 3

2.1.1 FEATURES 4

2.1.2 RUNNING SILVERLIGHT 5

2.1.3 CREATING SILVERLIGHT 6

2.2 AS A PART OF USER CONTINNUM 6

2.3 SILVERLIGHT ARCHITECTURE 9

2.3.1 SILVERLIGHT1.0 11

2.3.2 SILVERLIGHT 2.0 16

2.4 COMPATIBILITY 21

2.5 DEVELOPMENT TOOLS 22

2.6 DEPLOYMENT AND PACKAGING 24

2.7 SCENARIOS FOR USAGE 25

3. CONCLUSION

3.1 CRITISISM 26

3.2 MOONLIGHT 26

3.3 CONCLUSION 26

4. REFERENCES 27

i

Page 8: Silver Light

LIST OF TABLES

SL NO: NAME PAGE NO:

1. COMPATIBILITY 21

LIST OF FIGURES

SL NO: NAME PAGE NO:

1. SILVERLIGHT BASED APPLICATION 4

2. MICROSOFT UX CONTINNUM 7

3. MICROSOFT END-TO-END OFFERING 8

4. ARCHITECTURE OF SILVERLIGHT 9

5. THE SILVERLIGHT 1.0 11

6. THE SILVERLIGHT 2.0 16

7. SILVERLIGHT WITH EXPRESSION BLEND 23

8. VISUAL STUDIO 24

9. SILVERLIGHT PACKAGING 25

ii

Page 9: Silver Light

SilverLight

Division Of Computer Engineering 1

1. INTRODUCTION

1.1 OVERVIEW

Microsoft silverlight is a programmable web browser plug in that

enables features such as animation, vector graphics and audio-video playback that

characterize rich internet applications. Silverlight competes with products such as

Adobe Flash, Adobe Flex, Adobe Shockwave, Gears (software), and JavaFX. Version

2.0, now in beta-testing, brings improved interactivity and support for .NET

languages and development tools.

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. Mobile

devices, starting with Windows Mobile 6 and Symbian (Series 60) phones, will also

be supported. A third-party free software implementation named Moonlight is under

development to bring compatible functionality to GNU/Linux.

1.2 RELEASES

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

Page 10: Silver Light

SilverLight

Division Of Computer Engineering 2

• XAML – to allow the UI layout to be created using XAML markup language.

Silverlight 2 (previously referred to as version 1.1)[includes a version

of the .NET Framework, implementing the same full Common Language Runtime

version 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. The XAML markup as well as the code, is

compiled into .NET assemblies which are then compressed using ZIP and stored in a

.xap file.

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 also adds support for adaptive streaming of

media files (which allows Silverlight to choose the bit rate of the media based on

available bandwidth) as well as Windows Media DRM[and PlayReady DRM in media

files.

Silverlight 2 includes Deep Zoom, a technology derived from

Microsoft Live Labs Photosynth. It allows users to zoom into or out of an image (or a

collage of images), with smooth transitions, using the mouse wheel.[The images can

scale from 2 or 3 megapixels in resolution to gig pixel range, but the user need not

wait for it to be downloaded entirely; rather Silverlight downloads only the parts in

view, optimized for the zoom level being viewed. Beta 2 onwards, Deep Zoom uses

an XML-based file format.

Page 11: Silver Light

SilverLight

Division Of Computer Engineering 3

2. SILVERLIGHT

2.1 WHAT IS SILVERLIGHT

Silverlight is a new Web presentation technology that is created to run

on a variety of platforms. It enables the creation of rich, visually stunning and

interactive experiences that can run everywhere: within browsers and on multiple

devices and desktop operating systems (such as the Apple Macintosh). In consistency

with WPF (Windows Presentation Foundation), the presentation technology in

Microsoft .NET Framework 3.0 (the Windows programming infrastructure), XAML

(extensible Application Markup Language) is the foundation of the Silverlight

presentation capability.

Silverlight enables you to create a state-of-the-art application that has

the following features:

• It is a cross-browser, cross-platform technology. It runs in all popular Web

browsers, including Microsoft Internet Explorer, Mozilla Firefox, and Apple

Safari, and on Microsoft Windows and Apple Mac OS X.

• It provides a consistent experience no matter where it runs.

• It is supported by a very small download that installs in seconds.

• It streams video and audio. It scales video quality to everything from mobile

devices to desktop browsers to 720p HDTV video modes.

• It includes compelling graphics that users can manipulate—drag, turn, and

zoom— directly in the browser.

• It reads data and updates the display, but it doesn't interrupt the user by

refreshing the whole page.

Page 12: Silver Light

SilverLight

Division Of Computer Engineering 4

fig: 2.1 Silverlight-based application with rich graphics and user interaction

Web developers and graphics designers can create Silverlight-based

applications in a variety of ways. You can use Silverlight markup to create media and

graphics, and manipulate them with dynamic languages and managed code.

Silverlight also enables you to use professional-quality tools like Visual Studio for

coding and Microsoft Expression Blend for layout and graphic design.

2.1.1 FEATURES

Silverlight combines multiple technologies into a single development

platform that enables you to select the right tools and the right programming language

for your needs. Silverlight offers you the following features:

• WPF and XAML. Silverlight includes Windows Presentation Foundation

(WPF) technology, which greatly extends the elements in the browser for

creating UI. WPF lets you create immersive graphics, animation, media, and

other rich client features, extending browser-based UI beyond what is

available with HTML alone. Extensible Application Markup Language

(XAML) provides a declarative markup syntax for creating WPF elements.

• Extensions to JavaScript. Silverlight provides extensions to the universal

browser scripting language that provide powerful control over the browser UI,

including the ability to work with WPF elements.

Page 13: Silver Light

SilverLight

Division Of Computer Engineering 5

• Cross-browser, cross-platform support. Silverlight runs the same on all

popular browsers (on any platform). You can design and develop your

application without having to worry about which browser or platform your

users have.

• Integration with existing applications. Silverlight integrates seamlessly with

your existing JavaScript and ASP.NET AJAX code to complement

functionality you have already created.

• Access to the .NET Framework programming model and to associated tools.

You can create Silverlight-based applications using dynamic languages such

as managed JScript and IronPython as well as languages such as C# and

Visual Basic. You can use development tools such as Visual Studio to create

Silverlight-based applications. for more information.

• LINQ. Silverlight includes language-integrated query (LINQ), which enables

you to program data access using intuitive native syntax and strongly typed

objects in .NET Framework languages.

If you already use ASP.NET, you can integrate Silverlight with the server and client

capabilities of ASP.NET that you are familiar with. You can create server-based

resources in ASP.NET and use the AJAX capabilities of ASP.NET to interact with

server-based resources without interrupting the user

2.1.2. Running Silverlight-based Applications

Silverlight-based applications run in the browser. Silverlight makes

sure that you can run your applications in all modern browsers, without having to

create browser-specific code.

To run a Silverlight-based application, users require a small plug-in in

their browser. The plug-in is free. If users do not already have the plug-in, they are

automatically prompted to install it. The download and installation take seconds and

require no interaction from the user except permission to install.

Page 14: Silver Light

SilverLight

Division Of Computer Engineering 6

2.1.3. Creating Silverlight-based Applications

You can create Silverlight-based applications using skills that you

already have and tools that you are already familiar with. You can create Web pages

that use both HTML and WPF elements with Silverlight. Like HTML, XAML enables

you to create UI for your Web-based application with declarative syntax, with the

difference that XAML provides significantly more powerful elements.

2.2 SILVERLIGHT AS A PART OF USER-EXPERIENCE

CONTINNUM

Now, more than ever, customers are demanding applications and

online experiences that not only meet their individual needs in terms of effectiveness

and efficiency, but also address the perception of satisfaction the user has with a

company's products or services. In most cases, the level of satisfaction will have a

network and an emotional effect, shaping perceptions of the company as a whole, and,

as an extension, the perceptions of those with whom the individual comes into touch.

Microsoft acknowledges this connection and has a made a renewed commitment to

user experience (UX) as a part of the end-to-end experience. UX is more than a pretty

UI; it is the aggregation of the interaction point of a user with an application. Our

mission is thus to enable a great user experience wherever the customer needs that: on

the Web, on devices, in Office, and in Windows.

Two recent examples of Microsoft's own investment in UX are

Microsoft Windows Vista and Microsoft Office 2007. By focusing on the end-user

experience first, subtle and somewhat radical changes were made to both products in

order to address productivity and satisfaction.

• Windows Vista introduces easier ways to visualize and organize your files,

media, and communications. In every case of the UI, a focus on user-centric

task accomplishment and experience was put first. Other examples of focusing

on UX include the new task switcher (Alt+Tab) and Wi-Fi signal notification.

Page 15: Silver Light

SilverLight

Division Of Computer Engineering 7

• Microsoft Office 2007 has introduced the new "Ribbon" concept to replace

traditional toolbars. A natural extension, the ribbon reduces time to find any

given feature in an Office application to about 10 seconds.

Fig 2.2 Microsoft UX continuum

From a platform perspective, Microsoft introduces a consistent

offering that uses common skills to address the different application-interaction

surfaces, as indicated in Figure 1.

• ASP.NET AJAX offers the benefits of standard Microsoft support (around-

the-clock support for a period of 10 years) for AJAX-enabled applications

built around Web standards. It allows standard Web applications to be more

effective by improving the interaction parameters of the application (such as

refresh, resource usage, and navigation).

• ASP.NET AJAX and Silverlight are designed to be complementary

technologies. In the broader sense, Silverlight can interact with any AJAX

application, both client- and server-side. Examples for such integration include

mapping applications, video playback with rich presentation, and more.

• For connected applications on Windows, Microsoft provides the .NET

Framework 3.0 programming layer (shipped in Windows Vista and available

Page 16: Silver Light

SilverLight

Division Of Computer Engineering 8

for Windows XP) that includes the Windows Presentation Foundation (WPF).

By using WPF, one can create rich, immersive, connected applications and

experiences that can take full advantage of the Windows platform, including

UI, media, offline communication, and document support. WPF uses a

superset of the same XAML that is used by Silverlight.

Fig 2.2.1Microsoft end-to-end offering for UX

As Figure shows, Silverlight is not an isolated island; it is a piece in a

consistent end-to-end offering that enables taking application experiences to the next

level. This offering includes server-side components, tools (Microsoft Expression and

Microsoft Visual Studio), and UX technologies.

Page 17: Silver Light

SilverLight

Division Of Computer Engineering 9

2.3 SILVERLIGHT ARCHITECTUTE

Silverlight has few basic properties:

• It integrates with various browsers on Windows and on the Macintosh.

• It enables rendering of richer user experiences that are defined by XAML.

• It render media (music and video).

• It enables programming that is consistent with the Web programming model.

• It is small.

Silverlight was designed to address these properties:

Fig 2.2.2 Architecture of Silverlight

• Lightweight browser plug-in—Silverlight has Windows and Macintosh

modules that are designed to enhance Internet Explorer (versions 6.0 and 7.0),

Firefox 2.0, and Safari browsers. The December 2006 CTP for Windows is 1.1

MB in size.

Page 18: Silver Light

SilverLight

Division Of Computer Engineering 10

• Native presentation runtime— Software-based browser enhancement that

allows rendering of XAML-based interactive 2-D graphics, text, and media, in

addition to the browser native rendering of HTML. XAML can be used inline,

in a file, or in a package.

• Interactive video and audio—Cross-platform independent media runtime

that can render Windows Media content (WMV and WMA) in addition to

MP3 (will be available after the December 2006 CTP). Video and audio are

handled as a media element in XAML, enabling flexibility in their

presentation. Furthermore, the media support leverages the huge infrastructure

and ecosystem around Windows Media, enabling cost-effective delivery of

top-quality media.

• Programming layer—In consistency with the Web architecture, Silverlight

XAML is exposed using a DOM model to JavaScript. That way, AJAX

programs can utilize the extended markup rendering capability using the same

programming paradigms and practices (on the client and on the server). After

the December 2006 CTP, we will also enable a managed code programming

model using a subset of full CLR that will enhance the programmability side

of the browsers to enable more performant and more scalable Web

applications.

Page 19: Silver Light

SilverLight

Division Of Computer Engineering 11

2.3.1The Silverlight 1.0

Fig 2.3 Silverlight 1.0

Browser Plug-in

At the top of the stack, a browser plug-in enables hosting in Microsoft

Internet Explorer, Mozilla Firefox, or Apple Safari. The recommended hosting and

deployment of the plug-in is provided in the SDK.

Primarily, the plug-in provides mechanisms for the following:

• Setting and changing the XAML content to be executed by the runtime.

• Retrieving objects from the runtime, for manipulation through JavaScript.

• Downloading content incrementally.

The rendering performance of the plug-in varies with the hosting

parameters specified and the complexity of the content. We recommend that you set

the settings.EnableFrameRateCounter property to true during development to display

the frame rate in the browser's status bar and identify performance bottlenecks.

Page 20: Silver Light

SilverLight

Division Of Computer Engineering 12

Hosting parameters that affect the consistency and performance of your application

include the following:

• is Windowless Setting this parameter to false will ensure the highest frame

rate and will result in better visual display quality across various platforms.

Windowed display is the best mode of operation for the plug-in.

• Background If windowless mode is required, use an opaque background

instead of a translucent or fully transparent background for better

performance. In particular, you should set the background to '#FF000000',

where the first component is FF. A transparent background affects

performance because the browser has to re-render the area under the control

with each frame. This additional rendering, combined with the cost of

blending images, can result in significantly slower performance on some

operating systems and browsers.

Element Tree

At the heart of a Silverlight-based application is a tree of objects, such

as Path objects, Image objects, and MediaElement objects, that you compose to build

an application. This tree, which is called the element tree, is conceptually similar to an

HTML tree. However, it has a richer set of graphical elements than HTML, and the

programming model is similar to the HTML Document Object Model (DOM). The

traversal order of the tree controls the order in which the objects in the application are

drawn. To build an element tree, you can use the XAML parser that is provided with

Silverlight (by setting the source on the plug-in) or use the CreatueFromXAML

method.

You can make changes to the element tree as follows:

• You can use the JavaScript API to change child relationships and to set

properties on the content.

Page 21: Silver Light

SilverLight

Division Of Computer Engineering 13

• You can use the animation system to change the value of properties over time.

If your application relies on per-frame manipulation of the element

tree, we recommend that you test its performance by using the various JavaScript

engines that are available on different operating systems and browsers. The

recommended method for manipulating the element tree over time is through the

animation system. This approach is platform- and browser-independent and is the

most efficient method.

JavaScript Programming Model

The hosting Web page can call the content.FindName method to

retrieve a named element and can subsequently set properties or call methods that are

exposed by that element. In addition, you can attach keyboard and mouse event

handlers to the elements or to the control. These event handlers enable the user to

receive JavaScript callbacks and respond to user input All objects in Silverlight

1.0 can be manipulated through a JavaScript object model..

Rendering Engine

The Silverlight rendering engine is optimized for rasterizing the

contents of the element tree at the desired frame rate indicated on the plug-in. In

particular, the optimizations include the following:

• Incremental redraw between frames, which reduces the number of pixels

drawn based on the content that is changing.

• Not rasterizing content that is completely or partially occluded.

The rendering engine feature set includes the follow.

• Text rendering support

o Subpixel positioning.

o Custom anti-aliasing for sharper text.

• Transforms

o Path transforms.

Page 22: Silver Light

SilverLight

Division Of Computer Engineering 14

o Brush transforms.

o Text and graphics remain sharp when scaled. Image data will be

resampled, and quality will vary based on the resolution of the source

images.

• Clipping:

o Applied to a group of arbitrary drawing primitives, which could also

include other nested clips, opacity effects, or opacity masks.

• Opacity and opacity mask support:

o Applied to a group of arbitrary drawing primitives, including other

nested opacities or clips.

Animation System

Animation can enhance your graphical creation by adding movement

and interactivity. By animating a background color or applying an animated

Transform, you can create dramatic screen transitions or provide helpful visual cues.

You can create basic animations as well as more complex and powerful animations

that use key frames.

Image Cache

When an image references a URL, the image is downloaded and

cached in its decoded form for the duration of the application based on the URL that

is specified. If you reference the image multiple times within your application, it will

be retrieved from the image cache, and that usage pattern will run quickly.

Referencing the same image from separate plug-ins takes advantage of the browser

cache but requires the image to be decoded once for each Silverlight-based

application.

For best results, the resolution of the image being downloaded should

be close to the display size of the image. If the image resolution is significantly larger

Page 23: Silver Light

SilverLight

Division Of Computer Engineering 15

than the display size, bilinear filtering aliasing display artifacts can occur. If the image

resolution is significantly smaller than the display size, the image will appear blurry.

In addition, picking an image resolution that is close to the display size

will ensure minimum download times. If zoom effects are required where this is

simply not possible, store multiple resolutions on the server and dynamically switch

image sources during your animation.

Text Engine

The text engine will flow text strings within a TextBlock by applying

simple formatting and explicitly positioning glyphs for precise fixed-format display. It

will either use a specified font from the system (which is limited to a set that is

available on all platforms) or use a specified Uniform Resource Identifier (URI),

which can refer to a TrueType font.

Glyph Cache

The glyph cache is used by the text engine to produce glyphs for

rendering from font files. The glyph is optimized for readability at a particular target

resolution, so an initial cost is incurred on the first frame on which text is drawn or

when the scale of text changes. After this initial cost, scrolling or translation of text is

significantly cheaper.

If your application requires dynamic scale changes of large text, it may

be better to pick a vector representation of that effect.

Media Pipeline

The video pipeline retrieves content either through progressive HTTP

download or HTTP streaming (for WMS servers), calls the decoders to decode the

video, and displays with the rendering system and audio engine.

If your application transitions from windowed to full-screen display,

we recommend the use of a video brush that references the currently playing media

Page 24: Silver Light

SilverLight

Division Of Computer Engineering 16

element in the new full-screen content to ensure that the transition is seamless and

does not require rebuffering.

If the content in your application has to react to events in the video,

you can insert markers in the video stream that will be fired to the application.

Decoders

Silverlight 1.0 supports PNG and JPG files for imaging, Windows

Media Video (WMV) files for video, and Windows Media Audio (WMA) and MP3

files for audio.

2.3.2.The Silverlight 2.0

Fig2.3 Silvelight2.0 Architecture

Silverlight 2 (previously referred to as version 1.1)[includes a version

of the .NET Framework, implementing the same full Common Language Runtime

Page 25: Silver Light

SilverLight

Division Of Computer Engineering 17

version as .NET Framework 3.0; so it can execute programs written in any .NET

language. 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. The XAML markup as well as the code, is

compiled into .NET assemblies which are then compressed using ZIP and stored in a

.xap file.

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 also adds support for adaptive streaming of

media files (which allows Silverlight to choose the bit rate of the media based on

available bandwidth) as well as Windows Media DRM and PlayReady 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. Beta 2 onwards,it ships with more than 30 UI controls[

(including TextBox, CheckBox, Slider, ScrollViewer, and Calendar controls,

among others),supporting two-way databinding support, automated layout

management (by means of StackPanel, Grid etc)[as well as data manipulation

controls such as DataGrid[and ListBox. UI controls are skinnable using a template-

based approach

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.

Page 26: Silver Light

SilverLight

Division Of Computer Engineering 18

Almost all of the System.LINQ and System.LINQ.Expression

namespaces are exposed. It also supports serialization of objects, for data persistence.

Silverlight can handle data in RSS or JSON format, in addition to XML. The BCL

provides enhanced support for working with XML data, including the XMLReader

and XMLWriter classes. Silverlight 2 also supports asynchronous programming via

the use of the threading libraries.

Silverlight also includes classes for data access over XML-based Web

services, REST, WCF Services and ADO.NET Data Services. The networking

support in Silverlight can be used by Silverlight applications to communicate using

HTTP, or at the lower socket level. Cross-domain communication is supported.

Silverlight uses an XML-based configuration file to control the cross-domain resource

access policy, both for HTTP connections as well as socket connections. It can be

used by site administrators to control which resources a Silverlight application that

did not originate in the domain of the site can access. In addition, Silverlight also

supports the Adobe Flash cross domain policy file format.[Silverlight sockets can only

initiate a connection; they cannot listen for connections.

Silverlight 2 includes the Dynamic Language Runtime (DLR) which

allows dynamic compilation and execution of dynamic (scripting) languages.

Compilers for the languages based on the DLR (including IronPython and IronRuby)

are be packaged with the DSL app in the .xap package. The DSL SDK includes a

web server named Chiron that can dynamically package all the dependencies for the

DSL application and serve it to the browser. The first upcoming languages written for

the DLR are Managed JScript, IronPython 2.0, and IronRuby. Microsoft also plans to

build Visual Basic .NET 10.0 (VBx) 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 ECMAScript 3.0 specification, and Microsoft claims that it is 250 times faster

than interpreted JScript.

Page 27: Silver Light

SilverLight

Division Of Computer Engineering 19

With the integration of .NET Framework, Silverlight also allows

HTML-managed 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.[However, in the 1.1 alpha release directly calling JavaScript code is not

implemented, but managed code events can fire JavaScript handlers. A Silverlight

instance does not need to have a UI component in order to manipulate the HTML

DOM from managed code.[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.

Silverlight 2 includes Deep Zoom, a technology derived from

Microsoft Live Labs Photosynth. It allows users to zoom into or out of an image (or a

collage of images), with smooth transitions, using the mouse wheel. The images can

scale from 2 or 3 megapixels in resolution to gigapixel range, but the user need not

wait for it to be downloaded entirely; rather Silverlight downloads only the parts in

view, optimized for the zoom level being viewed.[Beta 2 onwards, Deep Zoom uses

an XML-based file format.[

Silverlight 2 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 is sanitized of path information to

prevent the application from getting access to information like user name and can be

opened only 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. It is by default set to 1 MB per URL,but

can be changed by the user. Data stored by a Silverlight application in the isostorage

is 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 the same

Silverlight application can share the saved data, even if they are running on different

browsers.

Page 28: Silver Light

SilverLight

Division Of Computer Engineering 20

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

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 digitally 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.

Page 29: Silver Light

SilverLight

Division Of Computer Engineering 21

2.4. COMPATIBILITY

The following table presents an availability and compatibility matrix of

Silverlight versions for various operating systems and web browsers.

OS/browser IE

6

SP

1

IE

6

SV

1

IE

7 IE

8 FirefoxSea

Monkey/Mozil

la

Safari Konquero

r

Opera

Windows

Vista/2008 N/

A N/

A 1.0,

2.0 2.0 1.0, 2.0 1.0,

2.0;

via

NPAP

I

N/A Unofficiall

y

Windows

XP/2003/Ho

me Server

N/

A 1.0,

2.0 1.0,

2.0 1.0, 2.0 1.0,

2.0;

via

NPAP

I

N/A Unofficiall

y

Windows

2000 2.0 N/

A N/

A N/

A N/A 2.0;

via

NPAP

I

N/A Planned

Windows

Mobile 6 1.0 N/

A N/

A N/

A N/A N/A N/A N/A

Mac OS

10.4/10.5

PowerPC

N/

A N/

A N/

A N/

A 1.0 1.0 N/A Planned

Mac OS

10.4/10.5

Intel

N/

A N/

A N/

A N/

A 1.0, 2.0 1.0,

2.0 N/A Planned

Linux x86 N/

A N/

A N/

A N/

A Planned N/A Planned Planned

Linux x86-64 N/

A N/

A N/

A N/

A Planned N/A Planned Planned

Table2.1 Compatibility

• Opera will be officially supported with future builds.[Unofficially Silverlight

supports Opera already, via a hack.

Page 30: Silver Light

SilverLight

Division Of Computer Engineering 22

• On Linux^, the functionality will be made available via the compatible third-

party Moonlight runtime.[Moonlight will be available for the major Linux

distributions, with support for Firefox, Konqueror, and Opera browsers.

• Silverlight for Mobile will be used to run Silverlight content on mobile

devices. The first CTP for Windows Mobile 6 will be released in 2nd Quarter

of 2008.[Nokia has announced plans to make Silverlight for Mobile available

for S60 on Symbian OS, as well as for Series 40 devices and Nokia Internet

tablets. Silverlight for Mobile will initially support Silverlight 1.0 content.

• Additional platforms are being considered as well.

2.5. 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 Microsoft Expression Blend versions 2.0 and 2.5 for designing the UI of

Silverlight 1.0 and 2 applications respectively. Visual Studio 2008 can be used to

develop and debug Silverlight applications. To create Silverlight projects and let the

compiler target CoreCLR, Visual Studio 2008 requires the Silverlight Tools for

Visual Studio which is available as a beta release.[

A Silverlight project contains the Silverlight.js and CreateSilverlight.js

files which initializes the Silverlight plugin for use in HTML pages, a XAML file for

the UI, and code-behind files for the application code. Silverlight applications are

debugged in a manner similar to ASP.NET applications. Visual Studio's CLR Remote

Cross Platform Debugging feature can be used to debug Silverlight applications

running on a different platform as well

Building a Simple Silverlight Application

Page 31: Silver Light

SilverLight

Division Of Computer Engineering 23

Let's start by taking a look at the Microsoft Expression Blend to create

a very simple application in XAML for Silverlight. To create a Silverlight application

in Blend, select File->New project and the New Project dialog box open.

Fig.2.4 Creating a new Silverlight project with Expression Blend

Select OK and a new project will be created. This project will contain a

default HTML page, some JavaScript code-behind this page, a XAML document, a

JavaScript code behind for the XAML document and Silverlight.js.

Silverlight.js contains the code for downloading and instantiating the

Silverlight control. This is provided to you as part of the Silverlight SDK.

Default.html is a standard HTML Web page. This contains three

JavaScript script references, pointing to Silverlight.js, Default.html.js (which contains

the application specific code for instantiating Silverlight), and Scene.xaml.js (which

contains the event handlers for application events defined in the XAML).

Page 32: Silver Light

SilverLight

Division Of Computer Engineering 24

This is designed to separate the page (default.html), from the

instantiation logic (default.html.js), and the design (Scene.xaml), and the event code

(Scene.xaml.js). But, enough with the theory, let’s get down to developing a simple

application

Using Visual Studio

You can create Silverlight-based applications using Visual Studio

2008. (Silverlight support for Visual Studio 2008 is available as a plug-in for the

IDE.) Visual Studio provides the same tools for Silverlight, such as powerful editors,

project management, debugging, and so on, that it already provides for creating

applications with the .NET Framework

Fig2.5 Visual Studio

2.6. DEPLOYMENT AND PACKAGING

Content for a Web page that contains Silverlight elements can be created by using

the following tactics:

Page 33: Silver Light

SilverLight

Division Of Computer Engineering 25

• Inline XAML and JavaScript.

• External XAML files and JavaScript files.

• Compressed content package (available after the December 2006 CTP) that

contains XAML, managed code, images, fonts, and media. Streaming media

sources can be referenced from the XAML media elements.

Fig 2.6 Silverlight packaging (after Feb 2007 CTP)

We believe that the flexibility of application packaging and the

consistency of the application architecture with Web standards and operations will

create many opportunities for improving the impact and effectiveness of Web

applications, making applications more scalable, fault-tolerant, and dynamic (they can

change their markup on the fly), and making content more discoverable.

Web pages that require Silverlight can detect if the Silverlight plug-in

is installed, and can direct users to download it and install it (either through a redirect

or through an object tag). The Silverlight SDK has documentation on that.

2.7. SCENARIOS FOR USING SILVERLIGHT

Silverlight is perfect for the following Web application scenarios that

encompass many real-world scenarios:

• Web media— Branded playback with events, video and marketing mix,

dynamic videos with ads, audio playback, and so forth

• Rich islands on a page (mini apps)— Casual games and gadgets

Page 34: Silver Light

SilverLight

Division Of Computer Engineering 26

• Web visualization elements— Navigation properties, data visualization, and

ads

Silverlight is designed for Web page content that is connected to its

host (it will not work offline), that deeply engages the user, and that can render on any

browser.

3. CONCLUSIONS

3.1 CRITICISM

Silverlight has been criticized for keeping Linux out of their official

offering. Even though Microsoft is officially collaborating on the Moonlight project,

Bruce Chizen, former CEO of Adobe, and maker of direct competitor Flash, has

questioned "the commitment of Microsoft to keep the Silverlight platform compatible

with other OS than Windows". His concerns are based on "examples from history"

where Microsoft has launched products with promises of ongoing cross-platform

compatibility that no longer apply, such as Internet Explorer for UNIX, the Microsoft

Java Virtual Machine, OS/2, and Windows Media Player.

3.2 MOONLIGHT

Moonlight is an upcoming free and open-source implementation of the

Microsoft Silverlight runtime. It is currently being developed by the Mono

Project.Silverlight 1.0 was released on September 5, 2007.it is developed so as to

include the features of Microsoft Silverlight in Linux based systems. Moonlight is

also usable outside of the browser as a Gtk+ widget. A number of Desklets were

written using this new technology during the Novell Hack-week.

Page 35: Silver Light

SilverLight

Division Of Computer Engineering 27

3.3 CONCLUSIONS

This report provides a high-level overview of the Silverlight

architecture and how it fits into the Microsoft offering for building next-generation

Web applications. Silverlight is part of a larger revolution of the ways applications are

designed, built, and delivered. With markup-based UI and flexible programming

models, businesses will be able to offer better experiences on the right form factor for

their customers.

4. REFERENCES

� http://www.microsoft.com/SILVERLIGHT/

� http://silverlight.net/

� http://www.nsaneblog.com/software/260/microsoft-silverlight-review/

� http://en.wikipedia.org/wiki/Silverlight

� http://en.wikipedia.org/wiki/Moonlight

� http://msdn.microsoft.com/enus/library/bb404713(VS.95).aspx

� http://www.wynapse.com/Silverlight.aspx