我正在Windows手机8中开发一个应用程序。我可以通过一些应用程序数据确定它是全新安装还是该设备上的更新应用程序?
答案 0 :(得分:0)
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
是您可以在IsolatedStorageSettings或数据库中维护的应用程序版本......