예제 #1
0
        private async void RefreshGroup(GroupFactory groupFactory)
        {
            // only tracking need build group info.
            if (!this.Source.IsTracking)
            {
                return;
            }

            int?episode;

            this.VideoGroup = groupFactory.GetGroup(this.Source, out episode);
            Debug.Assert(this.VideoGroup != null);

            if (this.VideoGroup.Mode == GroupMode.Today)
            {
                var playing = this.todayPlaying = new WatchedInfo(episode);
                if (playing.Episode.HasValue)
                {
                    var isWatched = await Task.Run(async() =>
                    {
                        var user = await this.GetManagers().UserWatchInfoManager.FindAsync(this.Source.Id);
                        return(user.Watcheds?.Contains(playing.Episode.Value));
                    });

                    if (isWatched != null && playing.IsWatched != isWatched.Value)
                    {
                        playing.IsWatched = isWatched.Value;
                        IsWatchedUpdated?.Invoke(this, this);
                        //this.NotifyPropertyChanged(nameof(this.TodayPlaying));
                        this.NotifyPropertyChanged(nameof(this.IsEnableWatchedButton));
                    }
                }
            }
            else
            {
                this.todayPlaying = null;
            }

            base.RefreshProperties();
        }