APP.CS
public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;
this.CheckAndDownloadUpdateCompleted += new CheckAndDownloadUpdateCompletedEventHandler(App_CheckAndDownloadUpdateCompleted);
this.CheckAndDownloadUpdateAsync();
InitializeComponent();
}
void App_CheckAndDownloadUpdateCompleted(object sender, CheckAndDownloadUpdateCompletedEventArgs e)
{
//throw new NotImplementedException();
if (e.UpdateAvailable)
{
MessageBox.Show("发现新版本的Silverlight应用程序" +
",请重新启用您的应用程序!");
}
else if (e.Error != null &&
e.Error is PlatformNotSupportedException)
{
MessageBox.Show("发现新版本Silverlight应用程序," +
"但是不能运行在您的Silverlight版本中,请访问程序主页更新。");
}
else
{
//没有新版本应用程序需要更新
}
}