Get Owners Name
I'm porting an iPhone game to Windows Phone 7, and I'm wondering how I would go about getting the phone's name? Lik开发者_StackOverflow中文版e, on the iPhone it would be the name you had set it to in iTunes, and that's also readable in the API with (obj-c..) [[UIDevice currentDevice] name]..
Anyone know the equivalent WP7 .NET methods/properties? I can't find them on MSDN.
You can get the manufacturer specified name of the device via:
Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceName").ToString();
Note that "There is no standard format for this string. This value may be empty."
More at: http://msdn.microsoft.com/en-us/library/ff941122(VS.92).aspx
My guess is you are going to be working in the Microsoft.Phone.Info namespace, but they have not released members of the DeviceExtendedProperties or UserExtendedProperties classes yet.
MSDN Namespace Info
If you are using XNA, use the static SignedInGamers property of the Gamer class.
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.gamerservices.gamer.signedingamers.aspx
Edit: I thought you meant owner's name, like their gamertag or name, instead of what they named the device.
Use DeviceStatus.DeviceName of Microsoft.Phone.Info directive
Refer: http://dotnetspeaks.com/DisplayArticle.aspx?ID=151
精彩评论