Windows Dev Center

Collapse the table of content
Expand the table of content
Expand Minimize
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DeviceThumbnail class

Represents the thumbnail image for a device.

Syntax


public ref class DeviceThumbnail sealed : IRandomAccessStreamWithContentType,
    IRandomAccessStream,
    IClosable,
    IInputStream,
    IOutputStream,
    IContentTypeProvider

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 (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

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

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

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

Attributes

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

See also

Object
IRandomAccessStreamWithContentType
IRandomAccessStream
IClosable
IInputStream
IOutputStream
IContentTypeProvider

 

 

Show:
© 2015 Microsoft