在 windows phone 8.1 中不使用文件选择器选择图像

pick image without using filepicker in windows phone 8.1

我想获取存储在特定文件夹和特定名称中但不使用 Filepicker 或任何类型的选择器的图像或图像路径。我需要使用 c# 以编程方式执行此操作。我有一种方法可以使用该特定名称从外部 url 保存图像,我需要获取该图像或其路径。在 "windows phone 8.1"

    public async Task GetBCardImageFromWeb(string url)
    {
        StorageFolder picsFolder = KnownFolders.SavedPictures;
        StorageFile file = await picsFolder.CreateFileAsync(
             "MyBusinessCardImageEmail.jpg", CreationCollisionOption.GenerateUniqueName);

        HttpClient client = new HttpClient();
        string path = url;
        byte[] responseBytes = await client.GetByteArrayAsync(path);

        var stream = await file.OpenAsync(FileAccessMode.ReadWrite);

        using (var outputStream = stream.GetOutputStreamAt(0))
        {
            DataWriter writer = new DataWriter(outputStream);
            writer.WriteBytes(responseBytes);
            await writer.StoreAsync();
            await outputStream.FlushAsync();
        }
    }

    public async Task<StorageFile> FetchImageFileFromPhone()
    {
        string fileName = "MyBusinessCardImageEmail.jpg";
        StorageFolder myfolder = KnownFolders.PicturesLibrary;
        StorageFile file = await myfolder.GetFileAsync(fileName);
        //file = Windows.Storage.FileIO.ReadBufferAsync(file);
        return file;
        //using (Stream stream = (await file.OpenReadAsync()).AsStreamForRead())
        //using (BinaryReader reader = new BinaryReader(stream))
        //{
        //    Windows.Storage.FileProperties.BasicProperties x = await file.GetBasicPropertiesAsync();
        //    await stream.FlushAsync();
        //    return stream;
        //}
    }

问题已解决。其实我并没有处理流。

 using (var outputStream = stream.GetOutputStreamAt(0))
            {
                DataWriter writer = new DataWriter(outputStream);
                writer.WriteBytes(responseBytes);
                await writer.StoreAsync();
                await outputStream.FlushAsync();
                outputStream.Dispose();
            }
            //});
            await stream.FlushAsync();
            stream.Dispose();