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