我有以下代码:
class Program
{
static Windows.Networking.Proximity.ProximityDevice proximityDevice;
static StringBuilder sb;
static void Main(string[] args)
{
sb = new StringBuilder();
InitializeProximityDevice();
}
private static void InitializeProximityDevice()
{
proximityDevice = Windows.Networking.Proximity.ProximityDevice.GetDefault();
if (proximityDevice != null)
{
sb.Append("Proximity device initialized.\n");
File.AppendAllText("c:\\temp\\log.txt", sb.ToString());
sb.Clear();
}
else
{
sb.Append("Failed to initialize proximity device.\n");
File.AppendAllText("c:\\temp\\log.txt", sb.ToString());
sb.Clear();
}
}
}
当我执行此代码时,获得的接近设备为NULL。但是,如下图所示,我在Windows上安装了NFC设备。
我缺少什么?