百度空间 | 百度首页 
 
查看文章
 
silverlight Beta版本与1.0正式版的不同
2007-10-02 13:39

silverlight 测试版与正式发布版本的区别

What Changed Between Beta and Release of Silverlight 1.0

This document provides a list of new features, changes, and enhancements that have been made to Silverlight since the Silverlight 1.0 Beta release (MIX release May, 2007). In addition, this document provides a list of "breaking changes" that you might need to make in applications that you created using the Silverlight 1.0 Beta release, in order to make them compatible with the Silverlight 1.0 release.

Note: Another resource for breaking changes is here.

This overview covers the following topics:
Silverlight 1.0 Release Enhancements
Breaking Changes
Remove "javascript:" in event handlers
Remove "Sys."
Use the latest Silverlight.js
All Downloads are now Asynchronous
Glyph element FontURI is Resolved Asynchronously
Remove Visibility.Hidden
Extra check on ASX Tags Resulting in MediaFailed Event
New Parser Error on Invalid Double Values like "Auto"
OnLoad, OnError, OnResize, OnFullScreenChange are now Function Pointer Based Rather than String Based
Elements in <*.Resource> blocks must be named
The MediaElement Position property value can be greater than the MediaElement NaturalDuration property value
Additional Animation Run-Time Errors
Can No Longer Use ’\’ in URIs
All Shaped Transform Members are now of Type Transform instead of TransformGroup
Remove IsFilled Property
AddEventListener now Returns a Token to be Passed to removeEventListener to Un-Register Event Handlers
Replace <control>.settings.version Property with isVersionSupported method
Change enableHtmlAccess: true to enableHtmlAccess: "true"
The width and height properties in createObject must be string values
Tighter restrictions of what objects can have child objects
Downloader is only able to make a download from the same port as the HTML
Silverlight 1.0 Release Enhancements

New "root" property on Content. Enables access to the root element of the XAML DOM.
New “Tag” property on UIElement. Enables user storage on every Silverlight UIElement.
New MediaElement APIs for selecting different audio streams out of a file with multiple audio tracks. See the AudioStreamCount and AudioStreamIndex properties.
Improved media performance: optimized assembly instructions for the video decode.
Media script commands encoded in a separate stream in the video file will now raise the MediaElement’s MarkerReached event.
Added support for Adobe CFF fonts.
Improved performance for transparent controls on Safari.
Breaking Changes

The following list contains the breaking changes between the release of Silverlight 1.0 and Silverlight 1.0 Beta (Mix release of May, 2007). If you have created applications using the Beta release, please update your applications using this list as a guideline. Use the code samples, where provided, to ensure your application runs on both Beta and RTM version of Silverlight 1.0.
Remove "javascript:" in event handlers

The first example shows attaching an event handler in Beta and the second example shows how to do it in the 1.0 release.

Silverlight BetaXAML
<canvas onMouseLeftButtonDown="javascript:myhandler"   />


Silverlight ReleaseXAML
<canvas onMouseLeftButtonDown="myhandler" />  

Remove "Sys."

Remove "Sys." from namespaces in your code. For example, change the following beta code. JavaScript
Sys.Silverlight.createObject(....)   


To this code.JavaScript
Silverlight.createObject(....)   

Use the latest Silverlight.js

Please make sure you use the latest Silverlight.js provided to you in your applications. A few changes have been made to this file. The plug-in has been renamed from "WPFe Plug-In" to "Silverlight Plug-In". This plug-in is referred to in Silverlight.js file to detect Silverlight on the system. Also the MIME type of the plug-in was changed from application/ag-plugin to application/x-silverlight. Finally, the namespace "Sys." was removed. Make sure all instances of "Sys." are pulled from your applications.
All Downloads are now Asynchronous

Due to difficulties in providing reliable synchronous downloads across all platforms, we’ve removed this feature from our downloader API. Consequently, the 3rd parameter on the download open API has been removed as it is no longer needed. You must update open calls to remove this parameter.

Only the Beta release lets you add the extra argument to the downloader open method. Following is an example. JavaScript
function download(host, file) {
   var dl = host.createObject("downloader");
   dl.addEventListener("completed", downloadComplete);
   // If Beta version add the extra argument
   if (_mix) {
     dl.open("get", file, true);
   } else {
     dl.open("get", file);
   }
   dl.send();
}

Glyph element FontURI is Resolved Asynchronously

When processing the XAML code, the font specified by the Glyphs FontUri attribute is downloaded separately and asynchronously. This means that text displayed by the Glyphs element will appear once the font is downloaded, in most cases after other content has already appeared.

In Silverlight 1.0, there is no event for Glyphs downloading progress when using the FontUri. To work around this you could use the Downloader object to first request the font file (and thus use the Downloader's progress events to know when Glyphs is downloaded).

Once the Downloader has finished downloading the font, you can then create a Glyphs element with the FontUri by specifying the exact same URI. Since the font is already downloaded, it would not be downloaded again and the Glyphs element should render almost instantaneously.

NOTE: This does make an assumption that the font downloaded will remain in the browser's cache (since this retentive behavior is user and browser specific, this is uncertain) and will be picked up when the Glyphs element attempts to download the same file.
Remove Visibility.Hidden

In order to reduce surface area, Visibility.Hidden was removed from the product. Prior to this change, Visibility.Hidden behaved the same as Visibility.Collapsed. Since Silverlight behavior is functionally similar to the behavior of WPF Visibility.Collapsed, Visibility.Collapsed was retained. To create content that will work consistently between Beta and 1.0, replace all occurrences of "Hidden" in both XAML and script with "Collapsed."

For JavaScript, change this Beta code.JavaScript
sender.findName("fsm").visibility = "Hidden";


To this code.JavaScript
sender.findName("fsm").visibility = "Collapsed";


And for XAML, change this Beta code.XAML
<Canvas x:Name="mask" Visibility="Hidden">


To this code.XAML
<Canvas x:Name="mask" Visibility="Collapsed">

Extra check on ASX Tags Resulting in MediaFailed Event

There is a set of ASX tags that were ignored in the Silverlight Beta release and that now result in a MediaFailed event. These tags are: PREVIEWMODE, BANNERBAR, PARAM, REPEAT, STARTMARKER, ENDMARKER and some MOREINFO tags. Also, if a REF URL fails to open, Silverlight does not fall back to other REFs in the same ENTRY. Instead, a MediaFailed event is raised.
New Parser Error on Invalid Double Values like "Auto"

More parser errors are reported in Silverlight 1.0 RTM. Applications will break now in cases where the developer sets a numeric property to an invalid value. In the Beta release, an invalid value was treated as a 0, but Silverlight 1.0 RTM throws an error when it encounters the same value. The following is an example:XAML
<TextBlock Width="Auto" Text="Created By:" />


“Auto” is not supported in Silverlight 1.0. In the Beta release of Silverlight 1.0, the above example causes the Width to be set to 0. Since the Beta release did not clip TextBlock by Width, this did not impact the application behavior. However, this same example will generate a parser error in Silverlight 1.0 RTM.
OnLoad, OnError, OnResize, OnFullScreenChange are now Function Pointer Based Rather than String Based

We’ve changed OnLoad, OnError, OnResize and OnFullScreenChange to be function-pointer based rather than string based. In order to develop Silverlight content that works on both Beta and 1.0 RTM releases, you need to check the version and develop the application code accordingly. The following is an example using OnResize:XAML
if (Silverlight.checkVersion(_ag, "20416")) {
   // Beta code path – use strings
   _ag.content.onResize = "javascript:onResize";
   ag.content.onFullScreenChange = "onFullScreenChanged";
} else {
   // Release code path – use function pointers
   _ag.content.onResize = onResize;
   _ag.content.onFullScreenChange = onFullScreenChanged;
}

Elements in <*.Resource> blocks must be named

Elements in <*.Resource> blocks must be named. This means you must have an x:Name property for all content in a <*.Resources> section. For example:

Silverlight BetaXAML
<Canvas.Resources>
<Storyboard>
       <!-- Content here... -->
    </Storyboard>
</Canvas.Resources>


Silverlight 1.0 RTMXAML
<Canvas.Resources>
    <Storyboard x:Name="name">
         <!-- Content here... -->
     </Storyboard>
</Canvas.Resources>

The MediaElement Position property value can be greater than the MediaElement NaturalDuration property value

This will mostly be seen in broadcast cases which had previously returned 0 for the Position value but now returns the play time. Developers creating transport controls should be aware of this and the need to clip the media if necessary. For example:

Silverlight BetaJavaScript
// set the slider thumb position in the right range of the track’s width
// assumes position is never greater than media’s naturalDuration
sliderThumb[“Canvas.Left”] = (myME.position.seconds/myME.naturalDuration.seconds)*sliderTrack.width;


Silverlight 1.0 RTMJavaScript
// need to clip the slider position by the track’s width
if (myME.position.seconds >= myME.naturalDuration.seconds)
    sliderThumb[“Canvas.Left”] = sliderTrack.width;
else
sliderThumb[“Canvas.Left”] = (myME.position.seconds/myME.naturalDuration.seconds)*sliderTrack.width;

Additional Animation Run-Time Errors

Silverlight 1.0 RTM is stricter than Beta in throwing run-time errors caused by functionality that is not supported. Examples of such errors are:
Storyboard.TargetProperty must be defined on all animations by the time they are begun. Storyboard.TargetName must either be specified on animations themselves or on a parent Storyboard by the time they are begun.
Certain Storyboard/Animations properties can only be modified when the Storyboard is stopped. These properties are Storyboard.TargetName and Storyboard.TargetProperty.
Can No Longer Use ’\’ in URIs

This behavior has been changed in order to maintain the cross platform support of Silverlight-based applications. All Web resources should be renamed if they include a "\". For example, use "./assets/images/bg.jpg" instead of ".\assets\images\bg.jpg”
All Shaped Transform Members are now of Type Transform instead of TransformGroup

This behavior has been changed in order to be consistent across Silverlight and WPF. For example, RTM brush.relativeTransform.toString() will return "Transform" rather than "TransformGroup."
Remove IsFilled Property

The IsFilled property on PathFigure is no longer supported. Developers should remove it from their application code.

Silverlight BetaXAML
<PathFigure IsFilled="true" .../>


Silverlight 1.0 RTMXAML
<PathFigure .../>

AddEventListener now Returns a Token to be Passed to removeEventListener to Un-Register Event Handlers

If you intend to remove event handlers during the lifetime of your Silverlight-based application, you must change the syntax by which you add the event handlers, and retain a token that is now necessary for the removeEventListener call. The token differentiates for cases where multiple handlers were attached for the same event. If you do not intend to remove event handlers, you can leave your addEventListener calls alone, although you should note that addEventHandler now also supports adding the handlers by reference rather than by a quoted name string. This change was made in order to make the Silverlight event object model more similar to other scripting object model syntaxes.

For JavaScript, change this Beta code.JavaScript
myObj.addEventListener(“MouseEnter”, myEnterHandler);
myObj.removeEventListener(“MouseEnter”, myEnterHandler);


To this code.JavaScript
var enterToken = myObj.addEventListener(“MouseEnter”, myEnterHandler);
myObj.removeEventListener(“MouseEnter”, enterToken);


And for XAML, change this Beta code.XAML
<... x:Name=”myObj” MouseEnter=”myEnterHandler”/>
JavaScript
sender.FindName(“myObj”).removeEventListener(“MouseEnter”, myEnterHandler);


To this code.XAML
<... x:Name=”myObj” MouseEnter=”myEnterHandler”/>
JavaScript
sender.FindName(“myObj”).removeEventListener(“MouseEnter”, 0);

Replace <control>.settings.version Property with isVersionSupported Method

Use this method to remove the <control>.settings.version property from the object tag and to use a new isVersionSupported method. This method takes a version string (for example, “1.0” or “1.1”) and returns a Boolean indicating whether the plug-in is compatible with the requested version.
Change enableHtmlAccess: true to enableHtmlAccess: "true"

Following is an example of how to add quotation marks to the value of enableHtmlAccess. Change this example.JavaScript
enableHtmlAccess: true


To this.JavaScript
enableHtmlAccess: "true"

The width and height properties in createObject must be string values

The width and height properties in the createObject function call must be string values, not integer values.
Tighter restrictions of which objects can have child objects

Silverlight 1.0 RTM tightens restrictions on which objects can have child objects. For example, Rectangle and TextBlock used could have child objects in Silverlight Beta, but this is no longer allowed.
Downloader is only able to make a download from the same port as the HTML

The Downloader object is only able to make a download from the same port as the HTML file that hosts the Silverlight plug-in.


类别:默认分类 | 添加到搜藏 | 浏览() | 评论 (1)
 
最近读者:
 
网友评论:
1
2007-10-02 18:27 | 回复
没有中文的呀! 我的4级还在努力中的呀!
 
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu