2013-07-02 22 views
7

tôi muốn biết số kiểu thiết bị lập trình như nó được hiển thị trong các thiết lập về trang about pagethông tin về windows phone (số mô hình)

tôi hiện đang sử dụng

Microsoft.Phone.Info.DeviceStatus.DeviceName 

nhưng nó không giúp và đưa ra một số giá trị điển hình khác. Xin vui lòng giúp tôi làm thế nào tôi có thể nhận được mô hình/tên điện thoại như trên.

+0

On mà điện thoại được bạn kiểm tra mã của bạn và bạn nhận được giá trị nào từ các cuộc gọi đến 'DeviceStatus.DeviceName' hoặc' DeviceStatus.DeviceManufacturer'? – Haspemulator

+0

tôi đã được thử nghiệm trên Lumia 520 và DeviceStatus.DeviceName cho giá trị như RM-914_im_india_389 này và DeviceStatus.DeviceManufacturer cho giá trị của Nokia, nhưng tôi giải quyết này bằng cách sử dụng [PhoneNameResolver] (https://github.com/ailon/PhoneNameResolver) theo đề nghị của [Olivier Payen] (http://stackoverflow.com/questions/17425016/information-about-windows-phone-model-number?answertab=votes#tab-top) – Jatin

Trả lời

7

Bạn nên sử dụng PhoneNameResolver, một lớp đơn giản mà giải quyết các thiết bị tên ít người biết như

RM-885_apac_prc_250

thành tên thương mại thân thiện hơn như

NOKIA Lumia 720

Dưới đây là một số mẫu mã:

var phone = PhoneNameResolver.Resolve(
    DeviceStatus.DeviceManufacturer, DeviceStatus.DeviceName); 
SomeTextBox.Text = phone.FullCanonicalName; 

thêm thông tin trong bài viết trên blog này: http://devblog.ailon.org/devblog/post/2013/01/21/Introducing-PhoneNameResolver%E2%80%93a-lib-to-decipher-Windows-Phone-models.aspx

+0

cảm ơn người đàn ông đó là điều tôi đang tìm kiếm – Jatin

0

bạn có thể lấy lại DeviceName sử dụng thuộc tính mở rộng từ PhoneInfo, vì vậy here's the link. Đã kiểm tra và làm việc đến ngày hôm nay;)

Tận hưởng.

+2

này dường như để sản xuất các tên biến thể tương tự (RM-914_im_india_389) bằng cách sử dụng DeviceStatus.DeviceName không được chấp nhận. – GrahamW

1

bạn có thể sử dụng một chức năng như thế này: -

 public static string getDeviceInfo(bool asList = false) 
    { 
     string r = ""; 

     Geolocator locationservice = new Geolocator(); 

     if (DeviceNetworkInformation.CellularMobileOperator != "") r += "CellularMobileOperator: " + DeviceNetworkInformation.CellularMobileOperator + Environment.NewLine; 
     r += "CellularDataEnabled: " + DeviceNetworkInformation.IsCellularDataEnabled + Environment.NewLine; 
     r += "WiFiEnabled: " + DeviceNetworkInformation.IsWiFiEnabled + Environment.NewLine; 
     r += "IsNetworkAvailable: " + DeviceNetworkInformation.IsNetworkAvailable + Environment.NewLine; 
     r += "Hardware Identifier: " + Convert.ToBase64String((byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId")) + Environment.NewLine; 
     r += "Location Services Permission: " + locationservice.LocationStatus + Environment.NewLine; 

     r += "Language: " + CultureInfo.CurrentCulture.EnglishName + Environment.NewLine; 
     r += "Locale: " + CultureInfo.CurrentCulture.Name + Environment.NewLine; 
     //r += "Background Service Enabled: " + ScheduledActionService.Find("PeriodicAgent").IsEnabled + Environment.NewLine; 
     r += "Runtime Version: " + Environment.Version + Environment.NewLine; 
     r += "Maximum Memory: " + (DeviceStatus.DeviceTotalMemory/(1024 * 1024)) + "M" + Environment.NewLine; 
     r += "Maximum Memory Available: " + (DeviceStatus.ApplicationMemoryUsageLimit/(1024 * 1024)) + "M" + Environment.NewLine; 
     r += "Peak Memory Use: " + (DeviceStatus.ApplicationPeakMemoryUsage/(1024 * 1024)) + "M" + Environment.NewLine; 
     r += "Charger: " + DeviceStatus.PowerSource + Environment.NewLine; 
     r += "DeviceFirmwareVersion: " + DeviceStatus.DeviceFirmwareVersion + Environment.NewLine; 
     r += "DeviceManufacturer: " + DeviceStatus.DeviceManufacturer + Environment.NewLine; 
     r += "OS Version: " + Environment.OSVersion + Environment.NewLine; 
     r += "User ID: " + settings[KeyString.USER_ID] + Environment.NewLine; 
     var phone = PhoneNameResolver.Resolve(DeviceStatus.DeviceManufacturer, DeviceStatus.DeviceName); 
     r += "Phone model(userfriendly form):" +phone.FullCanonicalName ; 
     return r; 
    } 
Các vấn đề liên quan