StorageFile.ReplaceWithStreamedFileAsync Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Replaces the contents of the file referred to by the specified IStorageFile object with a new data stream. 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 ^> ^ ReplaceWithStreamedFileAsync(IStorageFile ^ fileToReplace, StreamedFileDataRequestedHandler ^ dataRequested, IRandomAccessStreamReference ^ thumbnail);
/// [Windows.Foundation.Metadata.RemoteAsync]
static IAsyncOperation<StorageFile> ReplaceWithStreamedFileAsync(IStorageFile const& fileToReplace, StreamedFileDataRequestedHandler const& dataRequested, IRandomAccessStreamReference const& thumbnail);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<StorageFile> ReplaceWithStreamedFileAsync(IStorageFile fileToReplace, StreamedFileDataRequestedHandler dataRequested, IRandomAccessStreamReference thumbnail);
function replaceWithStreamedFileAsync(fileToReplace, dataRequested, thumbnail)
Public Shared Function ReplaceWithStreamedFileAsync (fileToReplace As IStorageFile, dataRequested As StreamedFileDataRequestedHandler, thumbnail As IRandomAccessStreamReference) As IAsyncOperation(Of StorageFile)
- fileToReplace
- IStorageFile
The file (type IStorageFile) that the new data stream should be written to.
- dataRequested
- 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
The thumbnail image for the StorageFile to create.
For a high-quality thumbnail, one edge of this thumbnail should be at least 1024 pixels.
When this method completes, it returns a StorageFile object that represents the new data stream. Subsequently, this StorageFile object should be used to access file content instead of the file (type IStorageFile) that was specified to be replace.
- Attributes
This method lets 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.
Product | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |