private void Ready()
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         Messenger.Default.Send(ScreenLock.Release());
         if (App.DataCacheServiceInstance != null &&
             App.DataCacheServiceInstance.Videos != null)
         {
             var parameters = this.NavigationViewService.GetParametersFromUri();
             var id = Int32.Parse(parameters.First().Value);
             this.currentVideo = App.DataCacheServiceInstance.VideosVisible.FirstOrDefault(x => x.Id == id);
             this.SetVideo(this.currentVideo);
         }
     });
 }
 private void DeleteVideoMediaInternal(VideoMedia entity)
 {
     base.VideoMediaDataService.Delete(entity);
     this.Videos.Remove(entity);
 }
        public void SetVideo(VideoMedia video)
        {
            try
            {
                // Set Video
                using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    this.currentStream = store.OpenFile(Path.Combine(this.MediaSupportService.GetStorageDirectory(), video.FilesystemId), FileMode.Open);
                }
                this.mediaElement.SetSource(this.currentStream);

                // Stop Progress Timer
                if (this.progressTimer != null)
                {
                    if (this.progressTimer.IsEnabled)
                    {
                        this.progressTimer.Stop();
                    }
                }
            }
            catch (Exception e)
            {
                this.MediaFailed();
            }
        }
 private void AddVideoMediaInternal(string title, string filesystemId, bool isProtected)
 {
     var videoEntity = new VideoMedia() { Title = title, FilesystemId = filesystemId, IsProtected = isProtected };
     base.VideoMediaDataService.Insert(videoEntity);
     this.Videos.Add(videoEntity);
 }
 public DataAsyncResult UpdateVideoMedia(VideoMedia entity, string title, bool isProtected, TaskParam taskParam)
 {
     return this.EnqueueRequest(taskParam, () =>
     {
         entity.Title = title;
         entity.IsProtected = isProtected;
         base.VideoMediaDataService.Update(entity);
         return null;
     });
 }
 public DataAsyncResult SendToAudioLibrary(VideoMedia entity, TaskParam taskParam)
 {
     return this.EnqueueRequest(taskParam, () =>
     {
         var title = entity.Title;
         var fileSystemId = entity.FilesystemId;
         var isProtected = entity.IsProtected;
         this.DeleteVideoMediaInternal(entity);
         this.AddAudioMediaInternal(title, string.Empty, string.Empty, fileSystemId, isProtected);
         return null;
     });
 }
 public DataAsyncResult DeleteVideoMedia(VideoMedia entity, TaskParam taskParam)
 {
     return this.EnqueueRequest(taskParam, () =>
     {
         DeleteVideoMediaInternal(entity);
         return null;
     });
 }
 public void Play(VideoMedia media)
 {
     this.NavigationViewService.NavigateTo("/UI/Pages/VideoPlayerPage.xaml",
                                                                              new NavigationParameter("videoId", media.Id.ToString()));
 }