<%@ Page Language="C#" AutoEventWireup="true"  MasterPageFile="~/portlets/Resources/MasterPages/WSRP.Master" 
CodeBehind="VideoPortlet.aspx.cs" Inherits="SilverlightWeb.portlets.Silverlight_sample.VideoPortlet" %>
<%@ Register Src="./UserControl/VideoWebUserControl.ascx" TagName="video" TagPrefix="uc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="wsrphead" runat="server">

    <script src="./Silverlight.js" type="text/javascript"></script>
    <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;

            if (errorType == "ImageError" || errorType == "MediaError") {
              return;
            }

            var errMsg = "Unhandled Error in Silverlight 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>
</asp:Content>
<asp:Content ContentPlaceHolderID="webpartcontrol" runat="server">
    <uc1:video ID="video" runat="server" />
</asp:Content>