-api-id | -api-type |
---|---|
T:Windows.Devices.Enumeration.DeviceThumbnail |
winrt class |
Represents the thumbnail image for a device.
Call DeviceInformation.GetThumbnailAsync and handle the completion event as shown in the example.
// Takes a parameter of type DeviceInformation
// and retrieves a DeviceThumbnail to pass to displayImage().
function getImage (device) {
var thumbnail = null;
if (device){
device.getThumbnailAsync().then(
function (thumbnail) {
if (thumbnail){
if (thumbnail.size > 0) {
displayImage(thumbnail);
}
}
});
}
}
function displayImage(imageFile) {
try {
// Setting 2nd parameter to 'false' cleans up
// the URL after first use.
// We set this because we only need to load the URL
// into the image tag once.
document.getElementById("deviceImage").src =
window.URL.createObjectURL(imageFile, false);
} catch (e) {
document.getElementById("statusMessage").innerHTML =
"Could not display image, error: " + e.message;
}
}