Example #1
0
 private void _showNewVideoCapturedNotification(Youtube_Video video)
 {
     Application.Current.Dispatcher.Invoke((Action) delegate
     {
         var notificationVideoCard = new NotificationVideoCard(video);
         NotificationContainerWindow notificationWindow = new NotificationContainerWindow(notificationVideoCard);
         notificationWindow.Show();
     });
 }
        private async Task _showDownloadAskingDialog(YoutubeVideoManager manager)
        {
            // making sure the video info is populated
            if (manager.Video.VideoInfo is null)
            {
                YTrackLogger.Log($"Starting to download the rest of {manager.Video.VideoFingerPrint} before the info was populated ... ignoring download");
                return;
            }

            var thumbnail = await Common.FetchThumbnail(manager.Video.VideoInfo.ThumbnailUrl);

            var thumbBytes = Helpers.Misc.ToImage(thumbnail.thumbnailBytes);

            // check if video is currently saved in database
            // if so .. I won't display store notification dialog
            if (_videosIds.Contains(manager.Video.VideoInfo.Id))
            {
                return;
            }

            // check if the current video download dialog is already shown before
            if (_alreadyDownloadDialogedVideos.Contains(manager.Video.VideoInfo.Id))
            {
                return;
            }

            var dialog = new NotificationYNDialog(manager.Video.VideoInfo.Title, thumbBytes);
            NotificationContainerWindow notificationWindow = new NotificationContainerWindow(dialog);

            notificationWindow.Show();

            dialog.OnDialogResultAvailable += (sender, dialogResult) =>
            {
                // add to already dialog list ... to make sure the dialog doesn't show for the same video twice
                _alreadyDownloadDialogedVideos.Add(manager.Video.VideoInfo.Id);

                if (dialogResult == NotificationDialogResult.Yes || ((dialogResult == NotificationDialogResult.NotChoosen) && Settings.Default.KeepIncompleteCaptureByDefault))
                {
                    _startDownloadingVideo(manager);
                }
            };
        }