UWP получает уникальный идентификатор USB-накопителя

В JavaScript используйте /[\S\s]*/. Источник

1
задан Mikart Aerang 3 March 2019 в 10:13
поделиться

1 ответ

По вашему требованию вы можете использовать API Windows.Devices.Enumeration для получения переносного устройства хранения. Для более подробной информации вы можете обратиться к DeviceEnumaerationAndPairing сценарий 2.

handlerAdded = new TypedEventHandler<DeviceWatcher, DeviceInformation>(async (watcher, deviceInfo) =>
{
    // Since we have the collection databound to a UI element, we need to update the collection on the UI thread.
    await rootPage.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
    {
        ResultCollection.Add(new DeviceInformationDisplay(deviceInfo));

        rootPage.NotifyUser(
            String.Format("{0} devices found.", ResultCollection.Count),
            NotifyType.StatusMessage);
    });
});

Тогда вы можете получить уникальный идентификатор из объекта deviceInfo.

0
ответ дан Nico Zhu - MSFT 3 March 2019 в 10:13
поделиться
Другие вопросы по тегам:

Похожие вопросы: