Ejemplo n.º 1
0
        private void OnTrackChanged(IPlayerHost playbackContext)
        {
            Dispatcher.InvokeAsync(() =>
            {
                foreach (var plugin in this.plugins)
                {
                    plugin.OnTrackChanged(playbackContext);
                }

                this.Title = $"Listening to {player.Track} by {player.Artist} on {player.ActiveDevice.Name}";

                var albumImageSource      = playbackContext.AlbumArtwork.ToBitmapImage(ImageFormat.Jpeg);
                using var background      = ImageProcessing.CalculateBackgroundSource(playbackContext.AlbumArtwork, (int) this.InitWidth, (int) this.InitHeight, 10);
                var albumBackgroundSource = ImageProcessing.ToSafeMemoryBrush(background as Bitmap);

                this.Icon = albumImageSource;
                this.AlbumImage.Source = albumImageSource;
                this.Background        = albumBackgroundSource;

                this.chroma?.LoadColor(this.player.AlbumArtwork);


                if (Properties.Settings.Default.ArtworkWallpaperEnable)
                {
                    wallpaper.Enable();
                }
                else
                {
                    wallpaper.Disable();
                }
            });
        }