DeviceThumbnail class

Applies to Windows and Windows Phone

Represents the thumbnail image for a device.

Syntax


Public NotInheritable Class DeviceThumbnail
    Implements IRandomAccessStreamWithContentType, _
    IRandomAccessStream, _
    IDisposable, _
    IInputStream, _
    IOutputStream, _
    IContentTypeProvider

Attributes

[DualApiPartition()]
[MarshalingBehavior(Agile)]
[Version(0x06020000)]

Members

The DeviceThumbnail class has these types of members:

Methods

The DeviceThumbnail class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
CloneStream Creates a new instance of a IRandomAccessStream over the same resource as the current stream.
Close [C++, JavaScript]Closes the current stream and releases system resources.
Dispose [C#, VB]Performs tasks associated with freeing, releasing, or resetting unmanaged resources.
FlushAsync Flushes data asynchronously in a sequential stream.
GetInputStreamAt Returns a pointer to an input stream starting at the specified location.
GetOutputStreamAt Returns a pointer to an output stream starting at the specified location.
ReadAsync Returns an asynchronous byte reader object.
Seek Sets the position of the stream to the specified value.
WriteAsync Writes data asynchronously in a sequential stream.

 

Properties

The DeviceThumbnail class has these properties.

PropertyAccess typeDescription

CanRead

Read-onlyGets a value that indicates whether the stream can be read from.

CanWrite

Read-onlyGets a value that indicates whether the stream can be written to.

ContentType

Read-onlyReturns the content type of the thumbnail image.

Position

Read-onlyGets the byte offset of the stream.

Size

Read/writeGets or sets the size of the device thumbnail image.

 

Remarks

Call DeviceInformation.GetThumbnailAsync and handle the completion event as shown in the example.

Examples


// 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;
    }
                
}

Requirements

Minimum supported client

Windows 8 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 [Windows Store apps, desktop apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Devices.Enumeration
Windows::Devices::Enumeration [C++]

Metadata

Windows.winmd

 

 

Show:
© 2014 Microsoft