SL4DemoTestPage.aspx
上传用户:haqqyyuan
上传日期:2021-05-06
资源大小:26k
文件大小:3k
源码类别:

SilverLight

开发平台:

C#

  1. <%@ Page Language="C#" AutoEventWireup="true" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" >
  4. <head runat="server">
  5.     <title>SL4Demo</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.             if (errorType == "ImageError" || errorType == "MediaError") {
  31.               return;
  32.             }
  33.             var errMsg = "Unhandled Error in Silverlight Application " +  appSource + "n" ;
  34.             errMsg += "Code: "+ iErrorCode + "    n";
  35.             errMsg += "Category: " + errorType + "       n";
  36.             errMsg += "Message: " + args.ErrorMessage + "     n";
  37.             if (errorType == "ParserError") {
  38.                 errMsg += "File: " + args.xamlFile + "     n";
  39.                 errMsg += "Line: " + args.lineNumber + "     n";
  40.                 errMsg += "Position: " + args.charPosition + "     n";
  41.             }
  42.             else if (errorType == "RuntimeError") {           
  43.                 if (args.lineNumber != 0) {
  44.                     errMsg += "Line: " + args.lineNumber + "     n";
  45.                     errMsg += "Position: " +  args.charPosition + "     n";
  46.                 }
  47.                 errMsg += "MethodName: " + args.methodName + "     n";
  48.             }
  49.             throw new Error(errMsg);
  50.         }
  51.     </script>
  52. </head>
  53. <body>
  54.     <form id="form1" runat="server" style="height:100%">
  55.     <div id="silverlightControlHost">
  56.         <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
  57.   <param name="source" value="ClientBin/SL4Demo.xap"/>
  58.   <param name="onError" value="onSilverlightError" />
  59.   <param name="background" value="white" />
  60.   <param name="minRuntimeVersion" value="4.0.41108.0" />
  61.   <param name="autoUpgrade" value="true" />
  62.   <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.41108.0" style="text-decoration:none">
  63.     <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
  64.   </a>
  65.     </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
  66.     </form>
  67. </body>
  68. </html>