Silverlight 3超出浏览器更新

One*_*Guy 2 silverlight auto-update silverlight-3.0 out-of-browser

我有一些用户使用的Silverlight应用程序在发布新版本时没有收到更新.难道这不是自动的,或者我在某个地方错过了选项吗?我也开始认为可能是缓存了XAP文件而我有些需要防止这种情况.

有什么想法吗?

Sim*_*ver 5

您需要编写几行代码.

如果您熟悉"单击"部署,那么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();
        }
Run Code Online (Sandbox Code Playgroud)

然后在你的App()构造函数中:

    Application.Current.CheckAndDownloadUpdateCompleted += 
    new CheckAndDownloadUpdateCompletedEventHandler(Current_CheckAndDownloadUpdateCompleted);
Run Code Online (Sandbox Code Playgroud)

和一个事件处理程序:

 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.");
        }
    }
Run Code Online (Sandbox Code Playgroud)