예제 #1
0
        public void Handle(UpdateTileMessage message)
        {
            var url = message.Image.MediaUrl;

            if (message.Image.Width > 800 || message.Image.Height > 800)
            {
                // after much testing it appears that images > 800px cannot be used as tiles
                url = message.Image.Thumbnail.MediaUrl;
            }

            var content = TileContentFactory.CreateTileWidePeekImageAndText01();

            content.TextBodyWrap.Text = message.Image.Title;
            content.Image.Src         = url;
            content.Image.Alt         = message.Image.Title;

            // Square image substitute
            var squareContent = TileContentFactory.CreateTileSquareImage();

            squareContent.Image.Src = url;
            squareContent.Image.Alt = message.Image.Title;

            content.SquareContent = squareContent;

            _tileUpdateManager.UpdatePrimaryTile(content);

            _statusService.TemporaryMessage = "Tile Update sent for " + message.Image.Title;
        }
        public void Handle(UpdateTileImageCollectionMessage message)
        {
            if (_history.Contains(message.Instance))
            {
                return;
            }

            var content = TileContentFactory.CreateTileWidePeekImageCollection06();

            content.RequireSquareContent = false;
            content.TextHeadingWrap.Text = "Search for " + message.Instance.Query;

            var images = message.Instance.GetRandomImages(6).ToList();

            UpdateImage(content.ImageMain, images[0]);
            UpdateImage(content.ImageSecondary, images[1]);
            UpdateImage(content.ImageSmallColumn1Row1, images[2]);
            UpdateImage(content.ImageSmallColumn1Row2, images[3]);
            UpdateImage(content.ImageSmallColumn2Row1, images[4]);
            UpdateImage(content.ImageSmallColumn2Row2, images[5]);

            _tileUpdateManager.UpdatePrimaryTile(content);

            _history.Add(message.Instance);
        }