Пример #1
0
 static void CheckUpdate()
 {
     if (SdkUpdateCheck.version.Length > 0 && SdkUpdateCheck.version != VadRConfig.VERSION)
     {
         if (!UpdateWindow.Init(SdkUpdateCheck.version, SdkUpdateCheck.htmlUrl))
         {
             UpdateWindow.ShowWindow();
         }
     }
     else
     {
         EditorUtility.DisplayDialog("VadR VR Analytics", "Your VadR VR Analytics Plugin is up to date.", "Ok");
     }
 }
Пример #2
0
 void Application_CheckAndDownloadUpdateCompleted(object sender, CheckAndDownloadUpdateCompletedEventArgs e)
 {
     if (m_isFirstCheck)
     {
         ProcessWhenCompleted(e);
     }
     else
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             var box = new UpdateWindow(m_xapVersionList);
             box.ShowWindow();
         });
     }
 }
Пример #3
0
        private void ProcessWhenCompleted(CheckAndDownloadUpdateCompletedEventArgs e)
        {
            //如果有某个应用程序更新可用,但是使用了用户尚未安装的 Silverlight 的新版本,将不下载更新。在此情况下,UpdateAvailable 属性值为 false,并且 Error 属性值为 PlatformNotSupportedException 实例。
            //出现这种情况时,您可以提醒用户打开应用程序的宿主网站,触发基于 HTML 的 Silverlight 升级体验。
            if (e.Error != null &&
                e.Error is PlatformNotSupportedException)
            {
                MessageBox.Show("An application update is available, " +
                                "but it requires a new version of Silverlight. " +
                                "Visit the application home page to upgrade.");

                return;
            }

            XapVersionInfo xapVersionInfo;
            var            client = new CommonServiceV40Client();

            client.GetFrameworkVersionAsync();
            client.GetFrameworkVersionCompleted += (obj, args) =>
            {
                if (args.Error != null)
                {
                    throw args.Error;
                }
                if (args.Result.Faults != null && args.Result.Faults.Count > 0)
                {
                    throw new Exception(args.Result.Faults[0].ErrorDetail);
                }

                if (args.Result.Body != null)
                {
                    xapVersionInfo = ToXapVersionInfo(args.Result.Body);

                    if (e.UpdateAvailable)
                    {
                        var version = UtilityHelper.GetIsolatedStorage(Constants.Key_Framework_Version);

                        if (string.IsNullOrEmpty(version))
                        {
                            Deployment.Current.Dispatcher.BeginInvoke(() =>
                            {
                                var box = new UpdateWindow(xapVersionInfo);
                                box.ShowWindow();
                            });
                        }
                        else if (!xapVersionInfo.Version.Equals(version, StringComparison.OrdinalIgnoreCase))
                        {
                            xapVersionInfo.PreVersion = version;

                            Deployment.Current.Dispatcher.BeginInvoke(() =>
                            {
                                var box = new UpdateWindow(xapVersionInfo);
                                box.ShowWindow();
                            });
                        }
                    }

                    UtilityHelper.SetIsolatedStorage(Constants.Key_Framework_Version, xapVersionInfo.Version);
                }
            };
        }