Edw*_*uay 0 silverlight out-of-browser silverlight-4.0
我有一个silverlight应用程序,用户可以在浏览器外安装.
当右键单击,并期待在更新面板,它被设置为"检查更新,并让我选择是否下载并安装:
替代文字http://www.deviantsart.com/upload/uhjdal.png
然而,用下面的代码,我的应用程序检测并下载新版本的自动,和新版本可于下次启动应用程序,无需任何用户互动:
App.xaml.cs:
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new BaseApp();
if (Application.Current.IsRunningOutOfBrowser)
{
Application.Current.CheckAndDownloadUpdateAsync();
Application.Current.CheckAndDownloadUpdateCompleted += new CheckAndDownloadUpdateCompletedEventHandler(Current_CheckAndDownloadUpdateCompleted);
}
}
void Current_CheckAndDownloadUpdateCompleted(object sender, CheckAndDownloadUpdateCompletedEventArgs e)
{
if (e.UpdateAvailable)
{
//an new version has been downloaded and silverlight version is the same
//so user just has to restart application
}
else if (e.Error != null &&
e.Error is PlatformNotSupportedException)
{
//a new version is available but the silverlight version has changed
//so user has to go to new website and install the appropriate silverlight version
}
else
{
//no update is available
}
}
Run Code Online (Sandbox Code Playgroud)
这恰好是我想要的特定应用程序,但是:
这不是误导用户,因为Silverlight播放器让他相信他将能够"选择是否下载和安装更新",实际上,在他不知情的情况下下载和安装更新?
| 归档时间: |
|
| 查看次数: |
125 次 |
| 最近记录: |