DeviceThumbnail クラス

定義

デバイスのサムネイル画像を表します。

public ref class DeviceThumbnail sealed : IClosable, IRandomAccessStreamWithContentType
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class DeviceThumbnail final : IClosable, IRandomAccessStreamWithContentType
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class DeviceThumbnail : System.IDisposable, IRandomAccessStreamWithContentType
Public NotInheritable Class DeviceThumbnail
Implements IDisposable, IRandomAccessStreamWithContentType
継承
Object Platform::Object IInspectable DeviceThumbnail
属性
実装

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10240.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v1.0 で導入)

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

}

注釈

DeviceInformation.GetThumbnailAsync を呼び出し、例に示すように完了イベントを処理します。

プロパティ

CanRead

ストリームを読み取ることができるかどうかを示す値を取得します。

CanWrite

ストリームを書き込むことができるかどうかを示す値を取得します。

ContentType

サムネイル画像のコンテンツ タイプを返します。

Position

ストリームのバイト オフセットを取得します。

Size

デバイスのサムネイル画像のサイズを取得または設定します。

メソッド

CloneStream()

現在のストリームと同じリソースに対して IRandomAccessStream の新しいインスタンスを作成します。

Close()

現在のストリームを閉じ、システム リソースを解放します。

Dispose()

アンマネージ リソースの解放またはリセットに関連付けられているアプリケーション定義のタスクを実行します。

FlushAsync()

シーケンシャル ストリームで非同期的にデータをフラッシュします。

GetInputStreamAt(UInt64)

指定した場所から開始する入力ストリームへのポインターを返します。

GetOutputStreamAt(UInt64)

指定した場所から出力ストリームへのポインターを返します。

ReadAsync(IBuffer, UInt32, InputStreamOptions)

非同期バイト リーダー オブジェクトを返します。

Seek(UInt64)

ストリームの位置を指定した値に設定します。

WriteAsync(IBuffer)

シーケンシャル ストリームに非同期的にデータを書き込みます。

適用対象