PageRenderTime 43ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/Visual Studio 2008/CSSL3HTMLBridge/CSSL3HTMLBridge.Web/CSSL3HTMLBridgeTestPage.aspx

#
ASP.NET | 143 lines | 129 code | 14 blank | 0 comment | 15 complexity | 40391863570b4ec74840a92ef4d48320 MD5 | raw file
  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>CSSL3HTMLBridge</title>
  6. <style type="text/css">
  7. html, body
  8. {
  9. height: 100%;
  10. overflow: auto;
  11. }
  12. body
  13. {
  14. padding: 0;
  15. margin: 0;
  16. }
  17. #silverlightControlHost
  18. {
  19. height: 100%;
  20. text-align: center;
  21. }
  22. .style1
  23. {
  24. font-size: 32pt;
  25. font-weight: bold;
  26. color: #FF0000;
  27. }
  28. </style>
  29. <script type="text/javascript" src="Silverlight.js"></script>
  30. <script type="text/javascript">
  31. // register silverlight event.
  32. function onSilverlightLoaded() {
  33. var silverlight1 = document.getElementById('silverlight1');
  34. silverlight1.Content.silverlightPage.TextChanged = function(sender, e) {
  35. document.getElementById('Text4').value = e.Text;
  36. }
  37. }
  38. // change textbox1 text.
  39. function changetext(name) {
  40. document.getElementById('Text1').value = name;
  41. }
  42. function ontext3keydown() {
  43. var text = document.getElementById('Text3').value;
  44. // calling managed code method.
  45. var silverlight1 = document.getElementById('silverlight1');
  46. silverlight1.Content.silverlightPage.ChangeTB3Text(text);
  47. }
  48. function onSilverlightError(sender, args) {
  49. var appSource = "";
  50. if (sender != null && sender != 0) {
  51. appSource = sender.getHost().Source;
  52. }
  53. var errorType = args.ErrorType;
  54. var iErrorCode = args.ErrorCode;
  55. if (errorType == "ImageError" || errorType == "MediaError") {
  56. return;
  57. }
  58. var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n";
  59. errMsg += "Code: " + iErrorCode + " \n";
  60. errMsg += "Category: " + errorType + " \n";
  61. errMsg += "Message: " + args.ErrorMessage + " \n";
  62. if (errorType == "ParserError") {
  63. errMsg += "File: " + args.xamlFile + " \n";
  64. errMsg += "Line: " + args.lineNumber + " \n";
  65. errMsg += "Position: " + args.charPosition + " \n";
  66. }
  67. else if (errorType == "RuntimeError") {
  68. if (args.lineNumber != 0) {
  69. errMsg += "Line: " + args.lineNumber + " \n";
  70. errMsg += "Position: " + args.charPosition + " \n";
  71. }
  72. errMsg += "MethodName: " + args.methodName + " \n";
  73. }
  74. throw new Error(errMsg);
  75. }
  76. </script>
  77. </head>
  78. <body>
  79. <form id="form1" runat="server">
  80. <div id="silverlightControlHost" style="width: 400px; height: 400px; position: absolute;
  81. top: 0px; left: 0px;">
  82. <object id="silverlight1" data="data:application/x-silverlight-2," type="application/x-silverlight-2"
  83. width="100%" height="100%">
  84. <param name="source" value="ClientBin/CSSL3HTMLBridge.xap" />
  85. <param name="onError" value="onSilverlightError" />
  86. <param name="onLoad" value="onSilverlightLoaded" />
  87. <param name="background" value="white" />
  88. <param name="minRuntimeVersion" value="3.0.40624.0" />
  89. <param name="autoUpgrade" value="true" />
  90. <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration: none">
  91. <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"
  92. style="border-style: none" />
  93. </a>
  94. </object>
  95. <iframe id="_sl_historyFrame" style="visibility: hidden; height: 0px; width: 0px;
  96. border: 0px"></iframe>
  97. </div>
  98. <div style="border: 10px solid #FF0000; position: absolute; top: 0px; left: 400px;
  99. width: 400px; height: 380px;">
  100. <span class="style1">Html</span><table style="width: 100%">
  101. <tr>
  102. <td style="height: 23px" valign="top">
  103. </td>
  104. </tr>
  105. <tr>
  106. <td valign="top" style="height: 68px">
  107. <input id="Text1" type="text" readonly="readonly" style="width: 100%" />
  108. </td>
  109. </tr>
  110. <tr>
  111. <td valign="top" style="height: 68px">
  112. <input id="Text2" type="text" style="width: 100%" />
  113. </td>
  114. </tr>
  115. <tr>
  116. <td valign="top" style="height: 68px">
  117. <input id="Text3" type="text" onchange="ontext3keydown()" style="width: 100%" />
  118. </td>
  119. </tr>
  120. <tr>
  121. <td valign="top">
  122. <input id="Text4" type="text" readonly="readonly" style="width: 100%" />
  123. </td>
  124. </tr>
  125. </table>
  126. </div>
  127. </form>
  128. </body>
  129. </html>