示例#1
0
        protected bool ToggleFavourite()
        {
            if (this.currentPlayingVideo != null)
            {
                var fav = dataService.IsFavourite(this.currentPlayingVideo.Parent);
                if (!fav)
                {
                    dataService.AddToFavourite(this.currentPlayingVideo.Parent);
                }
                else
                {
                    dataService.DeleteFromFavourite(this.currentPlayingVideo.Parent);
                }

                if (this.ToggelFavourite != null)
                {
                    this.ToggelFavourite(this, new ToggleFavouriteEventArgs
                    {
                        IsFavourite = !fav,
                        Video       = this.currentPlayingVideo.Parent
                    });
                }
                return(!fav);
            }
            return(false);
        }