共用方式為


StorageFile.CreateStreamedFileAsync 方法

定義

建立 StorageFile 來代表指定的資料流程。 這個方法可讓應用程式藉由指定第一次存取代表資料流程的 StorageFile 時叫用的函式來產生隨選資料。

public:
 static IAsyncOperation<StorageFile ^> ^ CreateStreamedFileAsync(Platform::String ^ displayNameWithExtension, StreamedFileDataRequestedHandler ^ dataRequested, IRandomAccessStreamReference ^ thumbnail);
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<StorageFile> CreateStreamedFileAsync(winrt::hstring const& displayNameWithExtension, StreamedFileDataRequestedHandler const& dataRequested, IRandomAccessStreamReference const& thumbnail);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<StorageFile> CreateStreamedFileAsync(string displayNameWithExtension, StreamedFileDataRequestedHandler dataRequested, IRandomAccessStreamReference thumbnail);
function createStreamedFileAsync(displayNameWithExtension, dataRequested, thumbnail)
Public Shared Function CreateStreamedFileAsync (displayNameWithExtension As String, dataRequested As StreamedFileDataRequestedHandler, thumbnail As IRandomAccessStreamReference) As IAsyncOperation(Of StorageFile)

參數

displayNameWithExtension
String

Platform::String

winrt::hstring

要建立的 StorageFile 使用者易記名稱,包括檔案類型副檔名。

dataRequested
StreamedFileDataRequestedHandler

第一次存取傳回的 StorageFile 時,應該叫用的函式。 此函式應該會產生傳回的 StorageFile 所代表的資料流程,並讓應用程式視需要產生資料,而不是在建立時寫入檔案的內容。

thumbnail
IRandomAccessStreamReference

要建立之 StorageFile 的縮圖影像。

針對高品質的縮圖,此縮圖的一個邊緣至少應為 1024 圖元。

傳回

此方法完成時,它會傳回代表新資料流程的 StorageFile 物件。

屬性

備註

這個方法和 CreateStreamedFileFromUriAsync 都可以用來建立 StorageFile ,可以傳遞至其他方法,或透過應用程式合約傳遞至另一個應用程式。

這些方法可讓您延遲昂貴的作業,以產生資料,直到第一次存取資料時 (該資料) 為止。 這可避免在產生資料時產生使用者互動時產生不必要的延遲。

適用於