超时等待DeviceInformation Win10

时间:2016-12-08 11:35:24

标签: uwp

我有两种静态方法:

ToArray()

while (object.children.length)
{
    object.children.remove(object.children[0]);
}

并使用:

public class RenderDevice
        public static async Task<List<DeviceInformation>> GetDeviceNames()
        {
            DeviceInformationCollection dir = await  DeviceInformation.FindAllAsync(MediaDevice.GetAudioRenderSelector());
            return dir.AsEnumerable().ToList();
        }
}

我有时会在public class CaptureDevice public static async Task<List<DeviceInformation>> GetCaptureDeviceNames() { DeviceInformationCollection dir = await DeviceInformation.FindAllAsync(MediaDevice.GetAudioCaptureSelector()); return dir.AsEnumerable().ToList(); } 开始有时停机,有时会在第二个var renderDevices = RenderDevice.GetDeviceNames(); renderDevices.Wait(); var captureDevices = CaptureDevice.GetDeviceNames(); captureDevices.Wait(); 停机 看起来像.Wait()的问题或者我做错了什么?

0 个答案:

没有答案