Esempio n. 1
0
        private void OnStreamClick(object sender, RoutedEventArgs e)
        {
            ErrorReporting.Log("OnStreamClick");

            var lecture = (Lecture)((Button)sender).DataContext;

            ErrorReporting.Log("Lecture = " + lecture.Title + " [" + lecture.Id + "]");

            if (videoLazyBlocks.ContainsKey(lecture.Id))
            {
                ErrorReporting.Log("Already fetching video url");
            }
            else
            {
                videoLazyBlocks.Add(lecture.Id, new LazyBlock <string>(
                                        "video location",
                                        null,
                                        lecture.VideoUrl,
                                        _ => false,
                                        new LazyBlockUI <string>(
                                            this,
                                            videoUrl =>
                {
                    ErrorReporting.Log("Launching video from url");
                    VideoPage.LaunchVideoFromUrl(this, videoUrl);
                },
                                            () => false,
                                            null),
                                        false,
                                        null,
                                        _ => videoLazyBlocks.Remove(lecture.Id),
                                        null));
            }
        }
Esempio n. 2
0
        private void OnPlayOrDownloadOrCancelClick(object sender, RoutedEventArgs e)
        {
            ErrorReporting.Log("OnPlayOrDownloadOrCancelClick");

            var lecture = (Lecture)((Button)sender).DataContext;

            ErrorReporting.Log("Lecture = " + lecture.Title + " [" + lecture.Id + "]");

            if (videoLazyBlocks.ContainsKey(lecture.Id))
            {
                ErrorReporting.Log("Already fetching video url");
            }
            else if (lecture.DownloadInfo.Downloading)
            {
                ErrorReporting.Log("Cancelling download");
                ((DownloadInfo)lecture.DownloadInfo).Monitor.RequestCancel();
            }
            else if (lecture.DownloadInfo.Downloaded)
            {
                ErrorReporting.Log("Launching downloaded video");
                VideoPage.LaunchDownloadedVideo(this, lecture.DownloadInfo);
            }
            else
            {
                StartDownload(lecture);
            }
        }
Esempio n. 3
0
        private void OnPlayClick(object sender, RoutedEventArgs e)
        {
            ErrorReporting.Log("OnPlayClick");

            var downloadInfo = (DownloadInfo)((Button)sender).DataContext;

            ErrorReporting.Log("Course = " + downloadInfo.CourseTopicName + " [" + downloadInfo.CourseId + "] Lecture = " + downloadInfo.LectureTitle + " [" + downloadInfo.LectureId + "]");

            VideoPage.LaunchDownloadedVideo(this, downloadInfo);
        }