how to obtain more info from DeviceWatcher? RRS feed

  • Question

  • Hi, 

    from the DeviceWatcher class, there're events for added, updated, removed, etc, but how could I get more information out of it? Info like Model Name, device Name, connection, etc.

    I couldn't get much out from parameters DeviceWatcher and DeviceInformationUpdate classes.

    Currently, the only way I know to obtain those information is through using DeviceInformation class or PnpObject class with .FindAllAsync() or derived methods. 

    string[] properties = { "System.ItemNameDisplay", "System.Devices.ModelName", "System.Devices.Connected" };

    var containers = await PnpObject.FindAllAsync(PnpObjectType.DeviceContainer, properties);

    however, it is inconvenient and wasteful to update the entire device list if I already know there is one device updated.

    var results = await DeviceInformation.FindAllAsync();
    foreach (var result in results)
                   Debug.WriteLine("device: {0}", result.Name.ToString());
                   Debug.WriteLine("\t Id: {0}", result.Id.ToString());
                   foreach (var prop in result.Properties)
                            Debug.WriteLine("\t key: {0}, value: {1}", prop.Key, prop.Value);
            catch(Exception ex)



    Monday, May 21, 2012 9:00 AM


All replies