【问题标题】:Silverlight 3 Out of the Browser UpdatesSilverlight 3 脱离浏览器更新
【发布时间】:2010-01-15 12:07:22
【问题描述】:

我有一些用户正在使用 Silverlight 应用程序,但在发布新版本时没有收到更新。这不是假设是自动的,还是我在某处错过了一个选项?我也开始认为 XAP 文件可能被缓存了,我需要如何防止这种情况发生。

有什么想法吗?

【问题讨论】:

    标签: silverlight silverlight-3.0 auto-update out-of-browser


    【解决方案1】:

    你需要写几行代码。

    如果您熟悉“一键式”部署,那么您过去使用的某些选项在 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.");
            }
        }
    

    【讨论】:

      【解决方案2】:

      只有在开发者执行 CheckAndDownloadUpdateAsync() 调用时才会自动更新。查看更新:http://timheuer.com/blog/archive/2009/07/10/silverlight-3-released-what-is-new-and-changed.aspx#oob

      【讨论】:

      • 你在开玩笑吧!这个问题已经开放了几个月,我们都在一分钟内回复!我通过编辑标签来解决这个问题,但后来找到了答案。谢谢!
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-15
      • 2011-01-16
      • 2010-11-22
      相关资源
      最近更新 更多