예제 #1
0
        private async void UpdateTileOnNewTrack(IPlayerTrack track)
        {
            try
            {
                string artistImage = await _imagesCacheService.GetCachedArtistImage(track.Artist);

                var images = await _imagesCacheService.GetCachedAlbumsImages(3);

                if (images.Count == 1)
                {
                    images.Add("ms-appx:///Assets/Images/PlayerLogo2.png");
                }

                int count = 5 - images.Count;
                for (int i = 1; i <= count; i++)
                {
                    images.Add($"ms-appx:///Assets/Images/PlayerLogo{i}.png");
                }

                var wideTile = TileContentFactory.CreateTileWide310x150PeekImageCollection01();
                wideTile.TextBodyWrap.Text = track.Title;
                wideTile.TextHeading.Text  = track.Artist;

                wideTile.ImageMain.Src             = images[0];
                wideTile.ImageSmallColumn1Row1.Src = images[1];
                wideTile.ImageSmallColumn1Row2.Src = images[2];
                wideTile.ImageSmallColumn2Row1.Src = images[3];
                wideTile.ImageSmallColumn2Row2.Src = images[4];

                var squareTile = TileContentFactory.CreateTileSquare150x150PeekImageAndText02();
                squareTile.TextBodyWrap.Text = track.Title;
                squareTile.TextHeading.Text  = track.Artist;
                squareTile.Image.Src         = String.IsNullOrEmpty(artistImage) ? images[0] : artistImage;

                wideTile.RequireSquare150x150Content = true;
                wideTile.Square150x150Content        = squareTile;

                var tileNotification = wideTile.CreateNotification();

                if (_manager.CurrentTrack.Equals(track))
                {
                    TileUpdateManager.CreateTileUpdaterForApplication("App").Update(tileNotification);
                }
            }
            catch (Exception ex)
            {
                _logService.LogText($"Tile update exception: {ex.ToString()}");
            }
        }
예제 #2
0
        public void CreateTileWide310x150PeekImageCollection01(string backTitle, string backContent)
        {
            var tileContent = TileContentFactory.CreateTileWide310x150PeekImageCollection01();

            tileContent.ImageMain.Src               = "ms-appdata:///local/" + conImageFolderName + "/image1.jpg";
            tileContent.TextHeading.Text            = backTitle;
            tileContent.TextBodyWrap.Text           = backContent;
            tileContent.ImageSmallColumn1Row1.Src   = "ms-appdata:///local/" + conImageFolderName + "/image2.jpg";
            tileContent.ImageSmallColumn1Row2.Src   = "ms-appdata:///local/" + conImageFolderName + "/image3.jpg";
            tileContent.ImageSmallColumn2Row1.Src   = "ms-appdata:///local/" + conImageFolderName + "/image4.jpg";
            tileContent.ImageSmallColumn2Row2.Src   = "ms-appdata:///local/" + conImageFolderName + "/image5.jpg";
            tileContent.RequireSquare150x150Content = false;
            var tileNotification = tileContent.CreateNotification();

            Windows.UI.Notifications.TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
        }