码迷,mamicode.com
首页 > 移动开发 > 详细

<WP8开发学习笔记>获取手机的常用型号(如Lumia920,而非RM-822)

时间:2014-10-25 11:48:09      阅读:250      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   使用   sp   div   on   log   

之前WP7时代可以用API获得WP手机的型号如lumia510,但是到了WP8后用APi只能获得硬件版本号了如RM-822,这种型号可以让我们更详细的了解具体的硬件版本,比如国行和港行,设备版本号不一样(但是我不记得了╮(╯-╰)╭),一个支持4G,一个不支持,但是型号都是Lumia920,这或许是微软的考量吧。

但是当我们只想要手机常用的型号时,发现没有这个Api了,真的是很麻烦。

我在GitHub上找到了一个手机型号转换器,PhoneNameResolver,地址 https://github.com/Aureate-Sunshine/PhoneNameResolver

它可以把设备版本号翻译成常见的型号。

使用的就是这个函数,把获取到的厂商和设备版本号传入,获取一个CanonicalPhoneName对象,

public static CanonicalPhoneName Resolve(string manufacturer, string model)

这个对象包含以下属性

 

public class CanonicalPhoneName 
{ 
         public string ReportedManufacturer { get; set; } 
         public string ReportedModel { get; set; } 
         public string CanonicalManufacturer { get; set; } 
         public string CanonicalModel { get; set; } 
         public string Comments { get; set; } 
         public bool IsResolved { get; set; } 

 
        public string FullCanonicalName
         { 
             get { return CanonicalManufacturer + " " + CanonicalModel; } 
         } 
} 

想要显示lumia920这样的型号话,获取他的CanonicalModel就好了,还有FullCanonicalName就是Nokia Lumia 920这样的完整型号。

 

<WP8开发学习笔记>获取手机的常用型号(如Lumia920,而非RM-822)

标签:style   blog   http   color   使用   sp   div   on   log   

原文地址:http://www.cnblogs.com/aureate-sunshine/p/3995566.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!