Example #1
0
        /// <summary>
        /// Cover to the left, title, album, artist to the right.
        /// </summary>
        /// <param name="track"></param>
        /// <returns></returns>
        public override async Task Update(MusicItem track)
        {
            // wide
            var wideXml  = TileUpdateManager.GetTemplateContent(wideImageText02);
            var imageUri = await SetImageAndMeta(wideXml, track);

            // square
            var squareXml = TileUpdateManager.GetTemplateContent(squareText03);

            SetMeta(squareXml, track);

            TileUtil.Embed(squareXml, wideXml);

            BeforeSquareWideUpdate(wideXml, track, imageUri);

            var trackDuration        = track.Duration;
            var trackDurationSeconds = trackDuration.TotalSeconds;
            var isTrackDurationValid = trackDurationSeconds > 0 && trackDurationSeconds < 10000;
            var expiration           = isTrackDurationValid ? trackDuration : TimeSpan.FromMinutes(5);

            TileUtil.Update(wideXml, expiration);
        }