Exemplo n.º 1
0
        public void UpdateLiveTiles(IList <Uri> imageUris)
        {
            if (imageUris.Count == 0)
            {
                return;
            }
            // square

            var squareXml = GetTemplate(mediumTemplate);

            // sets the first image in the list as the square tile image
            TileUtil.SetImage(squareXml, imageUris.First());

            // wide

            // if there are 5 (or more) images, displays an image collection in the wide tile, otherwise displays just one image
            XmlDocument wideXml = null;

            if (imageUris.Count < 5)
            {
                wideXml = GetTemplate(wideImageTemplate);
                SetImage(wideXml, imageUris.First());
            }
            else
            {
                wideXml = GetTemplate(wideImageCollectionTemplate);
                SetImageCollection(wideXml, imageUris);
            }
            Embed(squareXml, wideXml);
            BeforeMediumWideUpdate(wideXml, imageUris);
            Update(wideXml);
        }
Exemplo n.º 2
0
        public static async Task UpdateLiveTiles(TileUtil util)
        {
            await EnsureCoverFolderExists();

            var fileUtils = new AppLocalFolderFileUtils();
            var images    = (await fileUtils.ListFilesAsUris(CoverArtFolderPath))
                            .OrderBy(uri => Guid.NewGuid()) // randomizes
                            .Take(5)                        // at most 5 images are needed
                            .ToList();

            util.UpdateLiveTiles(images);
        }