我正在尝试使用StorageFile
方法CreateStreamedFileFromUriAsync
下载文件,但我对IRandomAccessStreamReference
参数感到困惑。我如何传递IRandomAccessStreamReference?这是一个界面。我该怎么办?
public static IAsyncOperation<StorageFile> CreateStreamedFileFromUriAsync(
string displayNameWithExtension,
Uri uri,
IRandomAccessStreamReference thumbnail
)
答案 0 :(得分:6)
我找到了答案:
IRandomAccessStreamReference thumbnail =
RandomAccessStreamReference.CreateFromUri(new Uri(remoteUri));
IAsyncOperation<StorageFile> file1 =
StorageFile.CreateStreamedFileFromUriAsync("duyuru.pdf", new Uri(remoteUri), thumbnail);