WP7.1向后兼容

发布于 2024-12-24 00:45:14 字数 155 浏览 0 评论 0 原文

我已在计算机中安装了 mango SDK,并且想要创建一个在 Windows Phone OS 7.0 和 Windows Phone OS 7.5 设备上运行的应用程序。我还需要在同一个应用程序中实现许多芒果功能。是否可以 ?如果是,请告诉我如何进行版本检查,因为根据版本我们需要实现芒果功能。

I have installed mango SDK in my machine and I want to create an application which runs on both Windows Phone OS 7.0 and Windows Phone OS 7.5 devices. Also I need to implement many of the mango features in the same application. Is it possible ? if yes please tell me how to do the version checking, because based on the version we need to implement the mango features.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

橘味果▽酱 2024-12-31 00:45:14

您必须维护两个不同的版本。您无法编译一个同时支持这两个版本的 XAP。

Mango API 仅在使用 7.1 SDK 编译时可用。因此,您无法在代码中进行内联检查。

但这毫无意义,因为几乎没有用户没有升级到 Mango,而且所有新手机都附带 Mango。

You'll have to maintain two different versions. You can't compile one XAP that supports both versions at the same time.

The Mango APIs are only available when compiling with the 7.1 SDK. And as such, you can't do in-line checking in the code.

But it's rather pointless, as there's almost no users left that haven't upgraded to Mango, and all new phones ship with Mango.

煮茶煮酒煮时光 2024-12-31 00:45:14

如今,所有 Windows 手机都附带 Wp7.5 芒果版本,而且较旧的设备也正在获取芒果更新,因此仅针对少数运行 WP7.0 的手机看起来毫无意义。

但如果您不需要任何与 SDK 相关的 api 访问,那么您可以进行此分叉。

但是 您可以找到查找操作系统版本的解决方案在[我对同类问题的回答]。1

Now days all the Windows phone are shipping with the Wp7.5 mango version also Older devices are getting mango updates, so it looks pointless in targeting only few WP7.0 running phones.

But if you dont need to anything SDK related api access then you can do this bifurcation.

However You can find the solution to the finding the OS version is in [my answer of same kind of question here.]1

终难遇 2024-12-31 00:45:14

您可以使用 Type 类和反射来完成此操作,尽管该过程并不容易。创建一个 Windows Phone 7.0 应用程序,然后创建一个实现 mango 特定功能的 MangoExtensions 类:

http://www.sharpgis.net/post/2011/08/21/Windows-Phone-Adding-Mango-features-to-a-70-WinPhone-App.aspx

bool IsMangoDevice = (Environment.OSVersion.Version >= new Version(7, 1));

if (IsMangoDevice)
{
  Type t = Type.GetType("Microsoft.Phone.Shell.StandardTileData, Microsoft.Phone");

  //get the constructor for the StandardTileData and create a new instance of it
  var newTileData = t.GetConstructor(new Type[] { }).Invoke(null);
  //Get the setter method for the title property
  var setMethod = newTileData.GetType().GetProperty("Title").GetSetMethod();
  //Set the tile title
  setMethod.Invoke(newTileData, new object[] { "This is my new tile" });
  //Get the create method for the shell tiles
  Type shellTileType = Type.GetType("Microsoft.Phone.Shell.ShellTile, Microsoft.Phone");
  var createMethod = shellTileType.GetMethod("Create");
  //Create the tile, with the uri and tile data
  Uri uri = new new Uri("/MainPage.xaml?Test=This_Came_From_A_Secondary_Tile", UriKind.Relative)
  createMethod.Invoke(null, new object[] {  uri, newTileData});
}

You can do this using the Type class and reflection, although the process will not be easy. Create a Windows Phone 7.0 application, and then create a MangoExtensions class which implements the mango specific features:

http://www.sharpgis.net/post/2011/08/21/Windows-Phone-Adding-Mango-features-to-a-70-WinPhone-App.aspx

bool IsMangoDevice = (Environment.OSVersion.Version >= new Version(7, 1));

if (IsMangoDevice)
{
  Type t = Type.GetType("Microsoft.Phone.Shell.StandardTileData, Microsoft.Phone");

  //get the constructor for the StandardTileData and create a new instance of it
  var newTileData = t.GetConstructor(new Type[] { }).Invoke(null);
  //Get the setter method for the title property
  var setMethod = newTileData.GetType().GetProperty("Title").GetSetMethod();
  //Set the tile title
  setMethod.Invoke(newTileData, new object[] { "This is my new tile" });
  //Get the create method for the shell tiles
  Type shellTileType = Type.GetType("Microsoft.Phone.Shell.ShellTile, Microsoft.Phone");
  var createMethod = shellTileType.GetMethod("Create");
  //Create the tile, with the uri and tile data
  Uri uri = new new Uri("/MainPage.xaml?Test=This_Came_From_A_Secondary_Tile", UriKind.Relative)
  createMethod.Invoke(null, new object[] {  uri, newTileData});
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文