Silverlight 8.1,这是个有点奇葩的版本号。
Silverlight 在Web上到5.0就没有继续更新了,在WP上一直做为界面输出,然而WP7.X时代没有公开它是Silverlight 7,在WP8.0也没有公开它是Silverlight 8.0,这到了WP8.1就直接叫他是Silverlight 8.1了,让很多开发者有点晕。
Silverlight 8.1 在WP上指的是WP8.1的一种项目模板,为了完全向下兼容WP8.0而存在。
但也有部分行为需要重新定义,包括后退键的处理。具体如下:
按后退键时退出应用。
Silverlight 8.1 and Windows Phone 8 apps are terminated when the user uses the Back button to navigate backward past the first page of the app. This is different than the behavior of Windows Phone Store apps, which are paused when the user backs out of them. You can force your app to use the behavior of Windows Phone Store apps by setting PauseOnBack, which causes your app to be suspended when the user navigates backward past the first page of the app.
恢复而不是创建一个新的实例
On Windows Phone 8, the default behavior when the user launches an app from the Apps list or its primary tile is for a new instance of the app to be launched, replacing any existing instance of the app. Developers could override this behavior by modifying the app manifest, described in Enabling Fast Resume in the app manifest file. A Silverlight 8.1 app is always resumed when launched, instead of replacing any running instance. This behavior matches the behavior of Windows Phone Store apps. However, Silverlight 8.1 and Windows Phone 8 apps are terminated when the user uses the Back button to navigate backward past the first page of the app. After an app is terminated this way, any launch of the app will result in a new instance being created.
不支持持续的后台执行
Windows Phone 8 apps can continue to run in the background after the user navigates away from the app under certain conditions. This feature is not available for Silverlight 8.1 apps. If you need this feature, you should continue to use a Windows Phone 8 app. For more information, see Running location-tracking apps in the background for Windows Phone 8.
后台代理可用的CPU时间片更少
For a managed Windows Phone 8 ScheduledTaskAgent to be able to access Silverlight 8.1 features, it runs on the modern execution stack, which is converged with Windows. This uses a different CPU quota mechanism than Windows Phone 8. In some cases, a Silverlight 8.1 background agent might find that it gets less CPU time than it did previously. If that happens, the app may choose to call RequestAccessAsync()()()(). This will increase the CPU quota given to the agent.
不支持AudioPlayerAgent 和AudioStreamingAgent
不支持 WalletAgent
不支持in-process后台任务
不支持本地化的磁贴更新(MNPS)
不能使用托管的Windows Runtime Componnet
需要在WMAppManifest.xml中声明DefaultTask
不能在WMAppManifest.xml中声明支持的分辨率
App Bar的行为在不同设备上表现不同
不能使用XNA
使用Windows.System.MemoryManager查看内存使用
不要在主线程中调用WaitForPendingFinalizers()
SL8.1在前台主线程使用STA,而WP8.0使用MTA
Panorama的改变
In Windows Phone 8, Panorama does not call Measure(Size) for collapsed items. This has the consequence that items initially added as Collapsed are not displayed when their visibility is set to Visible until some other event triggers a call to MeasureOverride(Size). This is not the case in Silverlight 8.1
In Silverlight 8.1, Panorama handles PanoramaItem objects uniformly, whether they were explicitly added or generated through databinding. The SelectedItem property will return the associated data item. Also, the SelectionChanged event is now raised for databound PanoramaItem objects. In Windows Phone 8, it is not.
Web requests的改变
-
In Windows Phone 8, HTTP requests using the TRACE verb are blocked. This verb is allowed in Silverlight 8.1.
-
In Windows Phone 8, the BeginGetResponse(AsyncCallback, Object) callback is invoked only when the response body is received rather than when the response headers arereceived, even when AllowReadStreamBuffering is set to false. This is fixed in Silverlight 8.1.
-
In Windows Phone 8, when a protocol error occurs on a web request, the resulting WebException message always indicates that the error is "Not Found". In Silverlight 8.1, the error message indicates which protocol error occurred.
-
In Windows Phone 8, http-only cookies are stripped out of web responses before passing the CookieContainer back to the app. This is not done in Silverlight 8.1.
-
In Windows Phone 8, HttpWebRequest is limited to a fixed 5 automatic redirects. This limitation has been removed.
-
In Windows Phone 8, HttpWebRequest rewrites a request as GET before resending it if a 307 Temporary Redirect response status code is received. This behavior is incorrect according to RFC 2616 and has been fixed in Silverlight 8.1.
-
If an HttpWebRequest is aborted before EndGetResponse(IAsyncResult) is called, then calling EndGetResponse(IAsyncResult) would throw an exception even if a response had been received. In Windows Phone 8, in this scenario HaveResponse returns true even though it is impossible for an app to retrieve the response
Web Browser 的改变
The HTML5 project template has been modified for Silverlight 8.1. The included CSS file (phone.css) contains definition for width, which was set to values that would not scale well with newly supported device resolutions. In Silverlight 8.1, the value "device-width" has been added and will return correct values based on device size and resolutions.
In the Windows Phone 8 WebBrowser control, the default value of IsScriptEnabled is false, which caused frustration among developers because it’s not obvious that it needs to be set to true for the control to work correctly. In Silverlight 8.1 the tools have been updated to set that value to true by default at design time.
In Silverlight 8.1, the User Agent string used by the WebBrowser control has been updated to include the string “WebBrowser/8.1” to enable web sites to identify clients using the control.
CLR的改变
XDocument.Load只能加载.appx包中的内容
Uri支持ms-app语法
Sort()使用introspective sort取代快排。