我已经在我的机器上安装了芒果SDK,我想创建一个在Windows Phone OS 7.0和Windows Phone OS 7.5设备上运行的应用程序。另外我需要在同一个应用程序中实现许多芒果功能。可能吗 ?如果是,请告诉我如何进行版本检查,因为基于我们需要实现芒果功能的版本。WP7.1向后兼容性
-2
A
回答
6
你将不得不维护两个不同的版本。您无法同时编译一个支持两个版本的XAP。
Mango API仅在使用7.1 SDK编译时才可用。因此,您不能在代码中进行联机检查。
但是这是毫无意义的,因为几乎没有用户还没有升级到芒果,并且所有新手机都带有芒果。
2
现在,所有的Windows手机都带有Wp7.5芒果版本老的设备也在获得芒果更新,所以它只针对少数运行WP7.0的手机看起来毫无意义。
但是,如果你不需要任何与SDK相关的API访问,那么你可以做这个分叉。
然而You can find the solution to the finding the OS version is in [my answer of same kind of question here.]1
2
可以使用Type类和反思,虽然过程并不容易做到这一点。创建了Windows Phone 7.0的应用程序,然后创建一个实现了芒果特定功能MangoExtensions类:
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});
}
相关问题
- 1. .net 4向后兼容性
- 2. XSD向后兼容性
- 3. Silverlight 5向后兼容性
- 4. 向后兼容性play-1.2.3
- 5. pandas.DataFrame.to_pickle向后兼容性
- 6. UWP MediaPlayerElement向后兼容性
- 7. 向后兼容性dll
- 8. GCC向后兼容性
- 9. C#的向后兼容性
- 10. Xcode向后兼容性
- 11. Visual Studio向后兼容性
- 12. visual studio向后兼容性
- 13. 二进制兼容性vs向后兼容性
- 14. Office.Interop向后兼容?
- 15. 向后兼容Android
- 16. 向后兼容BackupAgent
- 17. ios5向后兼容
- 18. MSVCRT向后兼容?
- 19. 向后兼容setOnDateSetListener
- 20. UI元素向后兼容性
- 21. 正确的向后兼容性,java.lang.VerifyError
- 22. WCF服务 - 向后兼容性问题
- 23. 斯卡拉向后兼容性
- 24. iOS 4和iOS 5向后兼容性
- 25. 向后兼容性有多重要?
- 26. OpenGL着色语言向后兼容性
- 27. StructureMap 2.6.1的向后兼容性问题
- 28. R file.copy copy.mode向后兼容性
- 29. 对Caches目录的向后兼容性
- 30. ISerializable的和向后兼容性
如果你让为自己的受众特征的应用程序,我完全同意这种说法;这里唯一的问题是与客户合作,说服他们放弃7.0的支持 - 我上次检查时,微软没有发布关于Mango vs 7.0的用户百分比的任何信息。 – 2012-01-04 08:38:22