1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
| <%@ Page Language="C#"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
string selectedTitle = "";
string selectedPath = "";
void OnInit(Object sender, EventArgs e)
{
IEnumerable firstVideo = videosDataSource.Select()[0];
selectedTitle = firstVideo.Title;
selectedPath = firstVideo.Path;
}
void VideoChanged(Object sender, EventArgs e) {
selectedTitle = videosDropDownList.SelectedItem.Text;
selectedPath = videosDropDownList.SelectedValue;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server" onload="OnInit">
<script type="text/javascript">
function onSilverlightError(sender, args) {
var appSource = "";
if (sender != null && sender != 0) {
appSource = sender.getHost().Source;
}
var errorType = args.ErrorType;
var iErrorCode = args.ErrorCode;
var errMsg = "Unhandled Error in Silverlight 2 Application " + appSource + "\n";
errMsg += "Code: " + iErrorCode + " \n";
errMsg += "Category: " + errorType + " \n";
errMsg += "Message: " + args.ErrorMessage + " \n";
if (errorType == "ParserError") {
errMsg += "File: " + args.xamlFile + " \n";
errMsg += "Line: " + args.lineNumber + " \n";
errMsg += "Position: " + args.charPosition + " \n";
}
else if (errorType == "RuntimeError") {
if (args.lineNumber != 0) {
errMsg += "Line: " + args.lineNumber + " \n";
errMsg += "Position: " + args.charPosition + " \n";
}
errMsg += "MethodName: " + args.methodName + " \n";
}
throw new Error(errMsg);
}
</script>
<style type="text/css">
html, body {
height: 100%;
overflow: auto;
}
body {
padding: 0;
margin: 20;
}
#silverlightControlHost {
height: 100%;
}
</style>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="videosDropDownList" runat="server" AutoPostBack="True"
DataSourceID="videosDataSource" DataTextField="Title" DataValueField="Path" OnSelectedIndexChanged="VideoChanged">
</asp:DropDownList>
<asp:SqlDataSource ID="videosDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:IISConnectionString %>"
SelectCommand="SELECT Id, Title, Path, IsPublic FROM Videos WHERE (IsPublic = 1)">
</asp:SqlDataSource>
<!-- Runtime errors from Silverlight will be displayed here.
This will contain debugging information and should be removed or hidden when debugging is completed -->
<div id='errorLocation' style="font-size: small;color: Gray;"></div>
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="SmoothStreamingBlackGlass.xap"/>
<param name="onerror" value="onSilverlightError" />
<param name="initparams" value='autoplay=True,muted=False,stretchmode=0,displaytimecode=False,playlist=<playList><playListItems><playListItem title="<%= selectedTitle %>" description="" mediaSource="<%= selectedPath %>\Manifest" adaptiveStreaming="True" thumbSource="<%= selectedPath %>_Thumb.jpg" frameRate="24.0000384000614" ></playListItem></playListItems></playList>' />
<a href="http://go2.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="http://go2.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
</a>
</object>
<iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>
</div>
</div>
</form>
</body>
</html> |
Partager