本文介绍了.xap文件到您的web目录,确保目标代码中的路径正确。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我遇到了"正确路径"的问题。在目标代码中。我需要更改哪一部分?

这就是我所拥有的:

< head>
< title> blendlogo< / title>

< style type =" text / css">
html,body {
height:100%;
overflow:auto;
} body {
padding:0;
margin:0;
}
#silverlightControlHost {
height:100%;
}< / style>

< script type =" text / javascript">
function onSilverlightError(sender,args){

var appSource ="" ;;
if if(sender!= null&& sender!= 0){
appSource = sender.getHost()。Source;
}
var errorType = args.ErrorType;
var var iErrorCode = args.ErrorCode;

var errMsg =" Silverlight 2应用程序中的未处理错误" + appSource +" \ n" ;


errMsg + ="代码:" + iErrorCode +" \ n" ;;
errMsg + ="类别:" + errorType +" \ n" ;;
errMsg + ="消息:" + args.ErrorMessage +" \ n" ;;


if(errorType ==" ParserError")
{
errMsg + =" File:" + args.xamlFile +" \ n" ;;
errMsg + ="行:" + args.lineNumber +" \ n" ;;
errMsg + ="职位:" + args.charPosition +" \\\
" ;;
其他if(errorType ==" RuntimeError")
{
if if(args.lineNumber!= 0)
{{br /> errMsg + ="行:" + args.lineNumber +" \ n" ;;
errMsg + ="职位:" + args.charPosition +" \ n" ;;左}
errMsg + =" MethodName:" + args.methodName +" \ n" ;;
}


抛出新错误(errMsg);
}< / script>
< / head> ;


< body>
<! - 来自Silverlight的运行时错误将显示在此处。
这将包含调试信息,应在删除或隐藏时调试完成 - >
< div id ='errorLocation'style =" font-size:small; color:Gray;">< / div>


< div id =" silverlightControlHost">
< object data =" data:application / x-silverlight,"类型= QUOT;应用程序/ x-Silverlight的2英寸宽度= QUOT; 100%QUOT; height =" 100%">
< param name =" source" value =" blendlogo.xap" />
< param name =" onerror"值= QUOT; onSilverlightError" />
< param name =" background"值= QUOT;白" />
< param name =" minRuntimeVersion"值= QUOT; 2.0.31005.0" />
< param name =" autoUpgrade"值= QUOT;真" />
< a href =" " style =" text-decoration:none;">
< img src =" " alt ="获取Microsoft Silverlight" style =" border-style:none" />
< / a>
< / object>
< iframe style ='visibility:hidden; height:0; width :0; border:0px'>< / iframe>
< / div>
< / body>
< / html>

解决方案


I having trouble with the "correct path" in the object code.  Which part do i need to change?

This is what i've got:

<head>
    <title>blendlogo</title>

    <style type="text/css">
    html, body {
     height: 100%;
     overflow: auto;
    }
    body {
     padding: 0;
     margin: 0;
    }
    #silverlightControlHost {
     height: 100%;
    }
    </style>
   
    <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>
</head>

<body>
    <!-- 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," type="application/x-silverlight-2" width="100%" height="100%">
   <param name="source" value="blendlogo.xap"/>
   <param name="onerror" value="onSilverlightError" />
   <param name="background" value="white" />
   <param name="minRuntimeVersion" value="2.0.31005.0" />
   <param name="autoUpgrade" value="true" />
   <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
        <img src="http://go.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>
</body>
</html>

解决方案


这篇关于.xap文件到您的web目录,确保目标代码中的路径正确。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 03:44