zoukankan      html  css  js  c++  java
  • WP7应用版本升级的实现方法

    首先必须要有一个服务提供升级推送查询
    // Code to execute when the application is launching (eg, from Start)
            // This code will not execute when the application is reactivated
            private void Application_Launching(object sender, LaunchingEventArgs e)
            {
                updateServiceReference.UpdateSoapClient usp = new updateServiceReference.UpdateSoapClient();
                usp.CheckMobileUpdateCompleted += new EventHandler<updateServiceReference.CheckMobileUpdateCompletedEventArgs>(usp_CheckMobileUpdateCompleted);
                usp.CheckMobileUpdateAsync(1);
            }
     
            void usp_CheckMobileUpdateCompleted(object sender, updateServiceReference.CheckMobileUpdateCompletedEventArgs e)
            {
                if (e.Result == null)
                {
                    return;
                }
                System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                //string version = System.Reflection.Assembly.GetExecutingAssembly().FullName;
                //获取程序集的版本号,然后去掉.得到数字对比大小
                string version = assembly.GetCustomAttributes(false).OfType<System.Reflection.AssemblyFileVersionAttribute>().First().Version;
                if (int.Parse(e.Result.Ver) > int.Parse(version.Replace(".""")))
                {
                    if (MessageBox.Show(e.Result.UpdateLog, "升级提示"MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                    {
                        Microsoft.Phone.Tasks.MarketplaceDetailTask ms = new Microsoft.Phone.Tasks.MarketplaceDetailTask();
                        ms.ContentType = Microsoft.Phone.Tasks.MarketplaceContentType.Applications;
                        ms.ContentIdentifier = e.Result.DownPath;
                        ms.Show();
                    }
                }
            }
  • 相关阅读:
    吴裕雄--天生自然--Go 语言学习笔记--Go 语言指针
    SVN报错“Failed to run the WC DB work queue associated with”解决办法
    【Oracle学习笔记】Oralce随机数与随机取样
    [CUDA]CUDA编程资源汇总
    [算法竞赛]目标检测常用技巧总结
    [CUDA]CUDA编程实战五——dot向量点积运算
    [CUDA]CUDA编程实战四——矩阵乘法
    [CUDA]CUDA编程实战三——矩阵加法的实现
    [CUDA]CUDA编程实战一——了解CUDA及获取GPU信息
    [CUDA]CUDA编程实战二——向量加法
  • 原文地址:https://www.cnblogs.com/leestar54/p/3220430.html
Copyright © 2011-2022 走看看