Beispiel #1
0
 public void SwitchPages()
 {
     _showRotator = !_showRotator;
     if (_showRotator)
     {
         if (CurrentVideo == null)
         {
             throw new Exception("No video loaded and the program switched to the rotator.");
         }
         VideoThumbnail = CurrentVideo.GetThumbnail();
         TempFiles.Add(VideoThumbnail.Path);
         MainFrame.NavigationService.Navigate(new RotatorPage());
     }
     else
     {
         ClearTemporaryData();
         MainFrame.NavigationService.Navigate(new DragDropPage());
     }
 }
        public void Clear()
        {
            CurrentVideo?.Dispose();
            CurrentVideo = null;
            OnPropertyChanged(nameof(CurrentVideo));

            NextVideo?.Dispose();
            NextVideo = null;
            OnPropertyChanged(nameof(NextVideo));


            if (Videos != null)
            {
                foreach (var item in Videos)
                {
                    item.Dispose();
                }
                Videos.Clear();
                OnPropertyChanged(nameof(Videos));
            }

            _IsInitialized = false;
        }
        public async Task InitializeRelatedVideos(INicoVideoDetails currentVideo)
        {
            NowLoading = true;
            OnPropertyChanged(nameof(NowLoading));
            try
            {
                using (var releaser = await _InitializeLock.LockAsync())
                {
                    if (_IsInitialized)
                    {
                        return;
                    }
                    _IsInitialized = true;

                    var result = await _relatedVideoContentsAggregator.GetRelatedContentsAsync(currentVideo);

                    CurrentVideo?.Dispose();
                    CurrentVideo = new VideoListItemControlViewModel(currentVideo);
                    OnPropertyChanged(nameof(CurrentVideo));

                    Videos = result.OtherVideos;
                    OnPropertyChanged(nameof(Videos));

                    if (currentVideo.Series?.Video.Next is not null and NvapiVideoItem nextSeriesVideo)
                    {
                        NextVideo?.Dispose();
                        NextVideo = new VideoListItemControlViewModel(nextSeriesVideo);
                        OnPropertyChanged(nameof(NextVideo));
                    }
                }
            }
            finally
            {
                NowLoading = false;
                OnPropertyChanged(nameof(NowLoading));
            }
        }
 public override void Dispose()
 {
     CurrentVideo?.Dispose();
     NextVideo?.Dispose();
     base.Dispose();
 }