StorageFile.CreateStreamedFileAsync(String, StreamedFileDataRequestedHandler, IRandomAccessStreamReference) StorageFile.CreateStreamedFileAsync(String, StreamedFileDataRequestedHandler, IRandomAccessStreamReference) StorageFile.CreateStreamedFileAsync(String, StreamedFileDataRequestedHandler, IRandomAccessStreamReference) StorageFile.CreateStreamedFileAsync(String, StreamedFileDataRequestedHandler, IRandomAccessStreamReference) StorageFile.CreateStreamedFileAsync(String, StreamedFileDataRequestedHandler, IRandomAccessStreamReference) Method

Definition

Creates a StorageFile to represent the specified stream of data. This method lets the app produce the data on-demand by specifying a function to be invoked when the StorageFile that represents the stream is first accessed.

public : static IAsyncOperation<StorageFile> CreateStreamedFileAsync(Platform::String displayNameWithExtension, StreamedFileDataRequestedHandler dataRequested, IRandomAccessStreamReference thumbnail)
static IAsyncOperation<StorageFile> CreateStreamedFileAsync(winrt::hstring displayNameWithExtension, StreamedFileDataRequestedHandler dataRequested, IRandomAccessStreamReference thumbnail) const;
public static IAsyncOperation<StorageFile> CreateStreamedFileAsync(String displayNameWithExtension, StreamedFileDataRequestedHandler dataRequested, IRandomAccessStreamReference thumbnail)
Public Shared Function CreateStreamedFileAsync(displayNameWithExtension As String, dataRequested As StreamedFileDataRequestedHandler, thumbnail As IRandomAccessStreamReference) As IAsyncOperation(Of StorageFile)
Windows.Storage.StorageFile.createStreamedFileAsync(displayNameWithExtension, dataRequested, thumbnail).done( /* Your success and error handlers */ );

Parameters

displayNameWithExtension
String String String

The user-friendly name of the StorageFile to create, including a file type extension.

dataRequested
StreamedFileDataRequestedHandler StreamedFileDataRequestedHandler StreamedFileDataRequestedHandler

The function that should be invoked when the StorageFile that is returned is first accessed. This function should produce the data stream represented by the returned StorageFile and lets the app produce data on-demand instead of writing the contents of the file at creation time.

thumbnail
IRandomAccessStreamReference IRandomAccessStreamReference IRandomAccessStreamReference

The thumbnail image for the StorageFile to create.

For a high-quality thumbnail, one edge of this thumbnail should be at least 1024 pixels.

Returns

When this method completes, it returns a StorageFile object that represents the new stream of data.

Remarks

Both this method and CreateStreamedFileFromUriAsync can be used to create a StorageFile that can be passed to other methods or passed to another app through app contracts.

These methods let you defer expensive operations to produce the data until that data needed (when it is first accessed). This avoids creating unnecessary delays in user interaction while the data is produced.