Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在Windows Phone 8中检查应用程序是否已更新或新安装?_C#_Xaml_Silverlight_Windows Phone 7_Windows Phone 8 - Fatal编程技术网

C# 如何在Windows Phone 8中检查应用程序是否已更新或新安装?

C# 如何在Windows Phone 8中检查应用程序是否已更新或新安装?,c#,xaml,silverlight,windows-phone-7,windows-phone-8,C#,Xaml,Silverlight,Windows Phone 7,Windows Phone 8,我正在Windows phone 8中开发一个应用程序。我可以通过一些应用程序数据确定它是新安装的还是该设备上更新的应用程序吗 string currentAppVer = string.Empty; var xmlReaderSettings = new XmlReaderSettings { XmlResolver = new XmlXapResolver() }; using (var xmlReader = XmlReader.Create("WMAppManifest.xml", xm

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

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是您可以在自己的应用程序的隔离存储设置或数据库中维护的应用程序版本。

?为什么不直接使用本地存储和平面文件作为数据库,并在第一次运行或每次更新时对其进行增量。。。或者甚至使用应用程序版本,比如如果appversion