Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 识别Windows Phone设备的正确方法_C#_Windows Runtime_Windows Phone - Fatal编程技术网

C# 识别Windows Phone设备的正确方法

C# 识别Windows Phone设备的正确方法,c#,windows-runtime,windows-phone,C#,Windows Runtime,Windows Phone,我正在使用以下代码检索连接到计算机的设备 string aqsFilter = "System.Devices.InterfaceClassGuid:=\"{6AC27878-A6FA-4155-BA85-F98F491D4F33}\" AND System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True"; var interfaces = await DeviceInformation.FindAllAsyn

我正在使用以下代码检索连接到计算机的设备

string aqsFilter = "System.Devices.InterfaceClassGuid:=\"{6AC27878-A6FA-4155-BA85-F98F491D4F33}\" AND System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True";
var interfaces = await DeviceInformation.FindAllAsync(aqsFilter,propertiesToGet);

foreach (var item in interfaces)
{
    Console.WriteLine(item.Name);
    foreach (var p in item.Properties)
    {
        Console.WriteLine("{0}:{1}", p.Key, p.Value);
    }
}

是否有一个属性可以让我确切地知道设备是否是Windows Phone?

您是否尝试使用Environment.OSVersion

 string os = Environment.OSVersion.Version;

有关更多信息,请查看

我的代码未在设备上运行。。。从Windows桌面应用程序中,我需要知道计算机上是否连接了有效的Windows Phone设备。