Ejemplo n.º 1
0
        /// <summary>
        /// Set the optional background image that stays behind the tile notification.
        /// </summary>
        /// <param name="backgroundImage">An instance of <see cref="TileBackgroundImage"/> as the background image for the tile.</param>
        /// <param name="size">The tile size that the background image should be applied to. Default to all currently supported tile size.</param>
        /// <returns>The current instance of <see cref="TileContentBuilder"/></returns>
        public TileContentBuilder SetBackgroundImage(TileBackgroundImage backgroundImage, TileSize size = AllSize)
        {
            // Set to any available tile at the moment of calling.
            if (size.HasFlag(TileSize.Small) && SmallTile != null)
            {
                GetAdaptiveTileContent(SmallTile).BackgroundImage = backgroundImage;
            }

            if (size.HasFlag(TileSize.Medium) && MediumTile != null)
            {
                GetAdaptiveTileContent(MediumTile).BackgroundImage = backgroundImage;
            }

            if (size.HasFlag(TileSize.Wide) && WideTile != null)
            {
                GetAdaptiveTileContent(WideTile).BackgroundImage = backgroundImage;
            }

            if (size.HasFlag(TileSize.Large) && LargeTile != null)
            {
                GetAdaptiveTileContent(LargeTile).BackgroundImage = backgroundImage;
            }

            return(this);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Set the optional background image that stays behind the tile notification.
        /// </summary>
        /// <param name="imageUri">Source of the background image</param>
        /// <param name="size">The tile size that the background image should be applied to. Default to all currently supported tile size.</param>
        /// <param name="alternateText">Description of the background image, for user of assistance technology</param>
        /// <param name="addImageQuery">
        /// Indicating whether Windows should append a query string to the image URI supplied in the Tile notification.
        /// Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string.
        /// This query string specifies scale, contrast setting, and language.
        /// </param>
        /// <param name="hintOverlay">The opacity of the black overlay on the background image.</param>
        /// <param name="hintCrop">Desired cropping of the image.</param>
        /// <returns>The current instance of <see cref="TileContentBuilder"/></returns>
        public TileContentBuilder SetBackgroundImage(Uri imageUri, TileSize size = AllSize, string alternateText = default(string), bool?addImageQuery = default(bool?), int?hintOverlay = default(int?), TileBackgroundImageCrop hintCrop = TileBackgroundImageCrop.Default)
        {
            TileBackgroundImage backgroundImage = new TileBackgroundImage();

            backgroundImage.Source   = imageUri.OriginalString;
            backgroundImage.HintCrop = hintCrop;

            if (alternateText != default(string))
            {
                backgroundImage.AlternateText = alternateText;
            }

            if (addImageQuery != default(bool?))
            {
                backgroundImage.AddImageQuery = addImageQuery;
            }

            if (hintOverlay != default(int?))
            {
                backgroundImage.HintOverlay = hintOverlay;
            }

            return(SetBackgroundImage(backgroundImage, size));
        }