JryVideo.Viewer.VideoViewer.VideoViewerViewModel.ReloadEpisodes C# (CSharp) Méthode

ReloadEpisodes() public méthode

public ReloadEpisodes ( ) : void
Résultat void
        public async void ReloadEpisodes()
        {
            var user = await this.GetManagers().UserWatchInfoManager.FindAsync(this.InfoView.Source.Id);
            var episodesCount = this.InfoView.Source.EpisodesCount;
            var watcheds = Enumerable.Range(1, episodesCount)
                .Select(z => new WatchedEpisodeChecker(z))
                .ToArray();
            if (user.Watcheds != null)
            {
                foreach (var ep in user.Watcheds.Where(z => z <= episodesCount))
                {
                    watcheds[ep - 1].IsWatched = true;
                }
            }
            var min = Math.Min(episodesCount, this.Watcheds.Count);
            if (min > 0)
            {
                for (var i = 0; i < min; i++)
                {
                    watcheds[i].IsWatched = this.Watcheds[i].IsWatched;
                }
            }
            this.Watcheds.Reset(watcheds);
        }