【问题标题】:How to check if app is updated or fresh install in Windows Phone 8?如何在 Windows Phone 8 中检查应用程序是否已更新或全新安装?
【发布时间】:2015-02-25 17:27:19
【问题描述】:

我正在 Windows phone 8 中开发一个应用程序。我可以通过一些应用程序数据确定它是该设备上的全新安装还是更新的应用程序?

【问题讨论】:

  • 您自己的应用程序?为什么不直接使用本地存储和平面文件作为数据库,并在首次运行或每次更新时增加它...甚至使用应用程序版本,例如 if (appversion < this.appversion) {updateVersion; callSpecialCase; }

标签: c# xaml silverlight windows-phone-7 windows-phone-8


【解决方案1】:
string currentAppVer = string.Empty;
var xmlReaderSettings = new XmlReaderSettings { XmlResolver = new XmlXapResolver() };
using (var xmlReader = XmlReader.Create("WMAppManifest.xml", xmlReaderSettings))
{
     xmlReader.ReadToDescendant("App");
     currentAppVer = xmlReader.GetAttribute("Version").Replace(".", "");
}

try
{
     if ((Convert.ToInt32(currentAppVer)) < (Convert.ToInt32(response.appVersion)))
     {
          MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask();
          marketplaceDetailTask.ContentIdentifier = App.appContentIdentifier;
          marketplaceDetailTask.ContentType = MarketplaceContentType.Applications;
          marketplaceDetailTask.Show();
          Application.Current.Terminate();
     }
}
catch (Exception ex)
{ }

response.appVersion 是您可以在独立存储设置或数据库中维护的应用程序版本...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-05-03
    • 1970-01-01
    • 2023-04-10
    • 1970-01-01
    • 2018-03-07
    • 1970-01-01
    • 2020-03-27
    • 2014-07-10
    相关资源
    最近更新 更多