我有一些用户正在使用silverlight应用程序,当新版本发布时,他们不会收到更新。这是不是应该是自动的,或者我在什么地方错过了一个选项?我也开始想,也许XAP文件被缓存了,我需要如何防止这种情况。
有什么想法吗?
发布于 2010-01-15 12:07:23
您需要编写几行代码。
如果你熟悉“一键”部署,那么一些你习惯的选项在Silverlight中是不存在的。您需要自己编写代码。
http://nerddawg.blogspot.com/2009/07/silverlight-out-of-browser-apps-how.html
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
if (Application.Current.IsRunningOutOfBrowser)
{
Application.Current.CheckAndDownloadUpdateAsync();
}然后在你的App()构造函数中:
Application.Current.CheckAndDownloadUpdateCompleted +=
new CheckAndDownloadUpdateCompletedEventHandler(Current_CheckAndDownloadUpdateCompleted);和一个事件处理程序:
void Current_CheckAndDownloadUpdateCompleted(object sender, CheckAndDownloadUpdateCompletedEventArgs e)
{
// http://nerddawg.blogspot.com/2009/07/silverlight-out-of-browser-apps-how.html
if (e.UpdateAvailable)
{
MessageBox.Show("The application has been updated! Please close and reopen it to load the new version.");
}
else if (e.Error != null && e.Error is PlatformNotSupportedException)
{
MessageBox.Show("An application update is available, " +
"but it requires a new version of Silverlight. " +
"Please contact tech support for further instructions.");
}
}发布于 2010-01-15 12:06:10
只有当开发人员执行CheckAndDownloadUpdateAsync()调用时,它才会自动更新。请参阅更新:http://timheuer.com/blog/archive/2009/07/10/silverlight-3-released-what-is-new-and-changed.aspx#oob
https://stackoverflow.com/questions/1261792
复制相似问题