2013-07-02 24 views
7

voglio conoscere il numero di modello del dispositivo di programmazione come indicato nelle impostazioni circa pagina about pageinformazioni su Windows Phone (numero di modello)

Attualmente sto usando

Microsoft.Phone.Info.DeviceStatus.DeviceName 

ma non aiuta e dà qualche altro valore tipico. Per favore aiutatemi come posso ottenere il modello/nome del telefono come sopra.

+0

Su quale telefono stai testando il codice e quale valore ottieni dalle chiamate a 'DeviceStatus.DeviceName' o' DeviceStatus.DeviceManufacturer'? – Haspemulator

+0

Stavo testando su Lumia 520 e DeviceStatus.DeviceName fornisce un valore come questo RM-914_im_india_389 e DeviceStatus.DeviceManufacturer dà valore a Nokia, ma ho risolto questo problema usando [PhoneNameResolver] (https://github.com/ailon/PhoneNameResolver) come suggerito da [Olivier Payen] (http://stackoverflow.com/questions/17425016/information-about-windows-phone-model-number?answertab=votes#tab-top) – Jatin

risposta

7

Si dovrebbe usare PhoneNameResolver, una semplice classe che risolve i dispositivi oscuri nomi come

RM-885_apac_prc_250

in nomi commerciali amichevoli come

NOKIA Lumia 720

Ecco un esempio di codice:

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

More info in questo post del blog: http://devblog.ailon.org/devblog/post/2013/01/21/Introducing-PhoneNameResolver%E2%80%93a-lib-to-decipher-Windows-Phone-models.aspx

+0

grazie amico è quello che stavo cercando – Jatin

0

è possibile recuperare DeviceName utilizzando proprietà estese da PhoneInfo, quindi here's the link. Testato e funzionante fino ad oggi;)

Divertiti.

+2

Questo sembra produrre gli stessi nomi di varianti (RM-914_im_india_389) come usando DeviceStatus.DeviceName non deprecato. – GrahamW

1

è possibile utilizzare una funzione come questa: -

 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; 
    }