How can I get a Silverlight application to check for an update without the user clicking a button?
- by Edward Tanguay
I have made an out-of-browser silverlight application which I want to automatically update every time there is a new .xap file uploaded to the server.
When the user right-clicks the application and clicks on Updates, the default is set to "Check for updates, but let me choose whether to download and install them":
This leads me to believe that it is possible to make my Silverlight application automatically detect if there is a new .xap file present on the server, and if there is, the Silverlight client will automatically ask the user if he would like to install it.
This however is not the case. I upload a new .xap file and the Silverlight application does nothing.
Even if I add this to my App.xaml.cs:
--
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new BaseApp();
if (Application.Current.IsRunningOutOfBrowser)
{
Application.Current.CheckAndDownloadUpdateAsync();
}
}
and update the .xap file, the Silverlight application does nothing.
This information leads me to believe that I have to make a button which the user clicks to see if there is an update. But I don't want the user to have to click a button every day to see if there is an update. I want the application to check by itself if there is a new .xap file and if there is, let the client ask the user if he wants the update.
How do I make my Silverlight application check, each time it starts, if there is a new .xap file, and if there is, pass control to the Silverlight client to ask the user if he wants to download it, as the above dialogue implies is possible?