【问题标题】:Out of browser Silverlight app - how to setup automatic updates?浏览器之外的 Silverlight 应用程序 - 如何设置自动更新?
【发布时间】:2014-02-05 00:44:38
【问题描述】:

我想知道如何设置我的 Silverlight 项目以启用浏览器外应用程序的自动更新。

我在 app.xaml.cs 中添加了一些代码(见下文),重新构建应用程序,作为浏览器外安装,更改了 asseblyinfo.cs 中的 versionionfo,重新构建,再次运行,但不幸的是没有发生更新。我还缺少什么吗?

    public App()
    {
        this.Startup += this.Application_Startup;
        this.Exit += this.Application_Exit;
        this.UnhandledException += this.Application_UnhandledException;

        InitializeComponent();

        if (Application.Current.IsRunningOutOfBrowser)
        {
            App.Current.CheckAndDownloadUpdateCompleted +=
                new CheckAndDownloadUpdateCompletedEventHandler(App_CheckAndDownloadUpdateCompleted);
            App.Current.CheckAndDownloadUpdateAsync();
        }
    }

    void App_CheckAndDownloadUpdateCompleted(object sender, CheckAndDownloadUpdateCompletedEventArgs e)
    {
        if (e.Error == null && e.UpdateAvailable)
        {
            MessageBox.Show("Application updated, please restart to apply changes.");
        }
    }

编辑

额外问题:

App如何检测到有更新?来自 assemblyinfo.cs?清单中的某个地方?

编辑

谁能解释我为什么IsRunningOutOfBrowser 总是返回 FALSE,即使应用程序是从桌面的快捷方式运行的?

【问题讨论】:

    标签: silverlight silverlight-3.0


    【解决方案1】:

    感谢Silvelright 论坛,有解决方案。

    IsOutOfBrowser 属性不能在构造函数中使用。它开始工作的时间是应用程序启动事件。

    【讨论】:

      【解决方案2】:

      确保 Web 服务器正在运行,以便客户端可以连接到服务器并检查更新。您可能还想检查 Error 属性以查看是否有任何异常。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-05-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多