コード例 #1
0
 public MetroTileImage(WebImageOCC webImage)
 {
     try
     {
         this.Logo = webImage;
         Height    = this.Logo.Height;
         Width     = this.Logo.Width;
     }
     catch
     {
         // ???
     }
 }
コード例 #2
0
        private MetroTileImage SponsorToDoubleMetroTile(Service.Webhost.Services.Sponsor sponsor)
        {
            // Only create a tile if the sponsor has a Name AND an image.
            // Also, if the sponsor image is corrupted for some reason, don't add it.
            WebImageOCC image = ImageUtils.ImageFromBytes(sponsor.Image);

            if (!string.IsNullOrEmpty(sponsor.Name) && image != null)
            {
                return(new MetroTileImage(image)
                {
                    AltText = sponsor.Name,
                    Title = string.Format("{0} ({1} sponsor)", sponsor.Name, sponsor.SponsorshipLevel.Replace("sponsor", String.Empty)),
                    AnchorTagUri = sponsor.WebsiteUrl
                });
            }
            else
            {
                return(null);
            }
        }