When a Silverlight 4 application is installed and run out-of-browser (OOB), is it possible to have the application automatically recognize updates to the .xap file (and either automatically install or prompt the user to update)?
If you access the application from it's original web URL, you are automatically given the latest & greatest (based on your settings).
But once I install the application to run OOB, it does not seem to recognize updates to the original .xap file, nor does there seem to be any way to trigger an update (开发者_Go百科outside of right-clicking, uninstalling, and then going out to the website to get the latest version).
Thanks in advance
This is something your application needs to implement. However the Application
object provides a simple means to acheive this via the CheckAndDownloadUpdateAsync method.
Additional information for others looking at the CheckAndDownloadUpdateAsync method not finding an update. Ensure you have signed your xap file.
"SL Project"->Properties->Signing->Check "Sign the Xap File"
Also CheckAndDownloadUpdateAsync seemed to block the UI thread when placed in the Application_Startup() as many samples suggest. Placing it in a background worker was less disruptive and allowed us to customize the frequency of the check.
Update: I am not sure if CheckAndDownladUpdateAsync still behaves the same with SL5. This is how I did it with SL4:
I wrapped any code that needs the UI thread with Dispatcher.BeginInvoke() including:
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
App.Current.CheckAndDownloadUpdateCompleted += new CheckAndDownloadUpdateCompletedEventHandler(App_CheckAndDownloadUpdateCompleted);
App.Current.CheckAndDownloadUpdateAsync();
}
精彩评论