Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 保存到隔离存储后,如何自动打开(播放)文件?WP8_C#_Windows Phone 8_Isolatedstorage - Fatal编程技术网

C# 保存到隔离存储后,如何自动打开(播放)文件?WP8

C# 保存到隔离存储后,如何自动打开(播放)文件?WP8,c#,windows-phone-8,isolatedstorage,C#,Windows Phone 8,Isolatedstorage,我认为它应该放在OpenReadCompleted事件中的某个地方,但我尝试过的任何东西都不起作用。下面的代码包括如果文件已经存在,它将播放的部分,这是有效的。但我想它也自动播放后,最初下载 audioStream = IsolatedStorageFile.GetUserStoreForApplication().OpenFiledata.SavePath,FileMode.Open, FileAccess.Read, FileShare.Read); AudioPlayer.Set

我认为它应该放在OpenReadCompleted事件中的某个地方,但我尝试过的任何东西都不起作用。下面的代码包括如果文件已经存在,它将播放的部分,这是有效的。但我想它也自动播放后,最初下载

audioStream = IsolatedStorageFile.GetUserStoreForApplication().OpenFiledata.SavePath,FileMode.Open, FileAccess.Read, FileShare.Read);    

AudioPlayer.SetSource(audioStream);
AudioPlayer.Play();
}
else
{

            WebClient client = new WebClient();
            client.OpenReadCompleted += (senderClient, args) =>
                {
                    using (IsolatedStorageFileStream fileStream = IsolatedStorageFile.GetUserStoreForApplication().CreateFile(data.SavePath))  
                    {
                        args.Result.Seek(0, SeekOrigin.Begin);
                        args.Result.CopyTo(fileStream);
                    }
                };
            client.OpenReadAsync(new Uri(data.FilePath));
}

我可以发誓我早就试过了,但没用。这是我的解决办法。在参数后添加AudioPlayer代码,如下所示:

     using (IsolatedStorageFileStream fileStream =  IsolatedStorageFile.GetUserStoreForApplication).CreateFile(data.SavePath))                     
{                         
args.Result.Seek(0, SeekOrigin.Begin);
args.Result.CopyTo(fileStream);
AudioPlayer.SetSource(fileStream); 
AudioPlayer.Play();

我可以发誓我早就试过了,但没用。这是我的解决办法。在参数后添加音频播放器代码,如:
使用(IsolatedStorageFileStream fileStream=IsolatedStorageFile.GetUserStoreForApplication().CreateFile(data.SavePath)){args.Result.Seek(0,SeekOrigin.Begin);args.Result.CopyTo(fileStream);AudioPlayer.SetSource(文件流);AudioPlayer.Play();