示例#1
0
        /// <summary>
        /// One large square image with four smaller square images to its right, no text.
        /// http://msdn.microsoft.com/en-us/library/windows/apps/hh761491#TileWideImageCollection
        /// </summary>
        /// <param name="item">The current Note item, this will allow us to get the notebooks for the image collection.</param>
        private static void TryCreateCollectionTile(NoteDataCommon item)
        {
            var totalImages = item.NoteBook.Items.SelectMany(i => i.Images).ToList();

            if (totalImages.Count >= 5)
            {
                ITileWide310x150ImageCollection tileContent = TileContentFactory.CreateTileWide310x150ImageCollection();
                for (var i = 0; i < 5; i++)
                {
                    var imgUrl = totalImages[i].ToBaseUrl();
                    switch (i)
                    {
                    case 0:
                        tileContent.ImageMain.Src = imgUrl;
                        tileContent.ImageMain.Alt = item.NoteBook.Title;
                        break;

                    case 1:
                        tileContent.ImageSmallColumn1Row1.Src = imgUrl;
                        tileContent.ImageSmallColumn1Row1.Alt = item.NoteBook.Title;
                        break;

                    case 2:
                        tileContent.ImageSmallColumn1Row2.Src = imgUrl;
                        tileContent.ImageSmallColumn1Row2.Alt = item.NoteBook.Title;
                        break;

                    case 3:
                        tileContent.ImageSmallColumn2Row1.Src = imgUrl;
                        tileContent.ImageSmallColumn2Row1.Alt = item.NoteBook.Title;
                        break;

                    case 4:
                        tileContent.ImageSmallColumn2Row2.Src = imgUrl;
                        tileContent.ImageSmallColumn2Row2.Alt = item.NoteBook.Title;
                        break;
                    }
                }

                ITileSquare150x150PeekImageAndText04 squareTileContent = TileContentFactory.CreateTileSquare150x150PeekImageAndText04();
                squareTileContent.Image.Src         = totalImages[0].ToBaseUrl();
                squareTileContent.Image.Alt         = item.Title;
                squareTileContent.TextBodyWrap.Text = item.Title;
                tileContent.Square150x150Content    = squareTileContent;

                ScheduledTileNotification schduleTile = new ScheduledTileNotification(tileContent.GetXml(), DateTime.Now.AddSeconds(10));
                TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
                TileUpdateManager.CreateTileUpdaterForApplication().AddToSchedule(schduleTile);
            }
        }