예제 #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            string url;

            if (NavigationContext.QueryString.TryGetValue("url", out url))
            {
                mediaPlayer.Source = new Uri(url);
            }
            else
            {
                var filename = NavigationContext.QueryString["filename"];
                stateFile = DownloadInfo.GetStateFile(filename);
                mediaPlayer.SetSource(IsolatedStorage.OpenFileToRead(filename));
            }

            // only restore position for downloaded videos
            if (stateFile != null)
            {
                if (!position.HasValue && IsolatedStorage.FileExists(stateFile))
                {
                    position = TimeSpan.FromTicks(long.Parse(IsolatedStorage.ReadAllText(stateFile), CultureInfo.InvariantCulture));
                }
                if (position.HasValue)
                {
                    mediaPlayer.RestoreMediaState(new MediaState
                    {
                        IsPlaying = true,
                        IsStarted = true,
                        Position  = position.Value,
                    });
                }
            }
        }
예제 #2
0
 public void RefreshStatus()
 {
     Downloaded = IsolatedStorage.FileExists(GetBaseFilename() + DoneSuffix);
 }