Silverlight专题(6)-自定义提示Plugin安装信息

问题:

Silverlight 2 RC0虽然发布了

但是由于其只是针对开发人员的版本

所以微软没有提供对这个版本安装的正确提示信息

也就是说别人如果访问您用RC0编译的网站

将得到错误的信息,要求他们安装Silverlight 2 Beta2

而不是RC0的Runtime

所以我们非常有必要自定义安装信息

解决方案:

打开要加载Silverlight程序的asp.net页面

页面代码类似如下(RC0的版本号更新到了2.0.30923.0):

<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
    TagPrefix
="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" style="height:100%;">
<head runat="server">
   
<title>ReleaseTest</title>
</head>
<body style="height:100%;margin:0;">
   
<form id="form1" runat="server" style="height:100%;">
       
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
       
<div  style="height:100%;">
           
<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/ReleaseTest.xap" MinimumVersion="2.0.30923.0" Width="100%" Height="100%"/>
       
</div>
   
</form>
</body>
</html>

<asp:Silverlight .../>就是用来加载Silverlight应用程序的,有点而类似flash插件

<asp:Silverlight .../>下面有个

<PluginNotInstalledTemplate/>

用来自定义Runtime没有安装的状态下的提示信息

 

微软给的默认的情况如下,相信大家都比较熟悉了

我们可以自定义安装代码如下:

<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/ReleaseTest.xap" MinimumVersion="2.0.30923.0" Width="100%" Height="100%">
  
<PluginNotInstalledTemplate>
       请卸载已经安装的Silverlight的所有版本,之后安装
<a href="http://go.microsoft.com/fwlink/?linkid=129011">
      
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight RC0" style="border-style: none"/></a>
       才能访问本网站
  
</PluginNotInstalledTemplate>
</asp:Silverlight>

在这里我设置了安装地址为Silverlight 2 RC0的Runtime : http://go.microsoft.com/fwlink/?linkid=129011

这样你的老板或者同事就不会频繁的来问你为什么我已经安装了Silverlight了,但是还是访问不了你的网站了

我们的自定义安装界面如下(没有做美化处理,大家如果要使用,可能还需要让美工帮忙处理下):>

 

代码下载地址如下:

posted @ 2008-10-01 14:57  ibillguo  阅读(2331)  评论(4编辑  收藏  举报