2 <html xmlns="http://www.w3.org/1999/xhtml" >
3
4 <head>
5 <title>Html_SilverlightChina</title>
6 <style type="text/css">
7 html, body {
8 height: 100%;
9 overflow: auto;
10 }
11 body {
12 padding: 0;
13 margin: 0;
14 }
15 #silverlightControlHost {
16 height: 100%;
17 text-align:center;
18 }
19 </style>
20 <script type="text/javascript" src="Silverlight.js"></script>
21 <script type="text/javascript">
22 function onSilverlightError(sender, args) {
23 var appSource = "";
24 if (sender != null && sender != 0) {
25 appSource = sender.getHost().Source;
26 }
27
28 var errorType = args.ErrorType;
29 var iErrorCode = args.ErrorCode;
30
31 if (errorType == "ImageError" || errorType == "MediaError") {
32 return;
33 }
34
35 var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n" ;
36
37 errMsg += "Code: "+ iErrorCode + " \n";
38 errMsg += "Category: " + errorType + " \n";
39 errMsg += "Message: " + args.ErrorMessage + " \n";
40
41 if (errorType == "ParserError") {
42 errMsg += "File: " + args.xamlFile + " \n";
43 errMsg += "Line: " + args.lineNumber + " \n";
44 errMsg += "Position: " + args.charPosition + " \n";
45 }
46 else if (errorType == "RuntimeError") {
47 if (args.lineNumber != 0) {
48 errMsg += "Line: " + args.lineNumber + " \n";
49 errMsg += "Position: " + args.charPosition + " \n";
50 }
51 errMsg += "MethodName: " + args.methodName + " \n";
52 }
53
54 throw new Error(errMsg);
55 }
56 </script>
57 </head>
58 <body>
59 <form id="form1" runat="server" style="height:100%">
60 <div id="silverlightControlHost">
61 <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
62 <param name="source" value="ClientBin/Html_SilverlightChina.xap"/>
63 <param name="onError" value="onSilverlightError" />
64 <param name="background" value="white" />
65 <param name="minRuntimeVersion" value="3.0.40818.0" />
66 <param name="autoUpgrade" value="true" />
67 <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration:none">
68 <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
69 </a>
70 </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
71 </form>
72 </body>
73 </html>
2 <param name="source" value="ClientBin/Html_SilverlightChina.xap"/>
3 <param name="onError" value="onSilverlightError" />
4 <param name="background" value="white" />
5 <param name="minRuntimeVersion" value="3.0.40818.0" />
6 <param name="autoUpgrade" value="true" />
7 <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration:none">
8 <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
9 </a>
10 </object>
参数 |
介绍 |
AutoUpgrade |
允许开发人员控制终端用户的Silverlight是否自动升级。默认为True |
Background |
设置应用背景颜色,默认为Null |
enableFramerateCounter |
是否在浏览器状态栏显示当前帧速率,默认为false |
enableHtmlAccess |
是否允许访问浏览器DOM,默认为false,如果为true,将允许Silverlight访问网页 |
iniParams |
初始化参数信息,通过该参数可以从网页传递参数到Silverlight应用中,在Silverlight中可以通过后台代码获取参数(非常有用) |
minRuntimeVersion |
运行该应用的最低Silverlight版本,在本例中,最低版本是Silverlight 3.0.40818.0 |
maxFramerate |
设置最大的帧速率,默认是每秒60帧 |
onLoad |
可以在本事件中调用自定义Javascript函数 |
splashScreenSource |
设置一个xaml文件作为下载XAP的时候,动画开始页面 |
Source |
XAP路径 |
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
2 <param name="source" value="/jv9/Html_SilverlightChina.xap"/>
3 <param name="onError" value="onSilverlightError" />
4 <param name="background" value="white" />
5 <param name="minRuntimeVersion" value="3.0.40818.0" />
6 <param name="autoUpgrade" value="true" />
7 <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration:none">
8 <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
9 </a>
10 </object>