Esempio n. 1
0
		/// <summary>
		/// Gets the appropriate icon overlay resource name to indicate an unavailable action.
		/// </summary>
		/// <param name="iconSize">The desired version of the icon overlay.</param>
		/// <returns>The requested icon overlay as an <see cref="Image"/>.</returns>
		private Image GetOverlayIcon(IconSize iconSize)
		{
			var resourceResolver = new ApplicationThemeResourceResolver(GetType().Assembly);
			switch (iconSize)
			{
				case IconSize.Small:
					return new Bitmap(resourceResolver.OpenResource("Icons.UnavailableToolOverlaySmall.png"));
				case IconSize.Medium:
					return new Bitmap(resourceResolver.OpenResource("Icons.UnavailableToolOverlayMedium.png"));
				case IconSize.Large:
				default:
					return new Bitmap(resourceResolver.OpenResource("Icons.UnavailableToolOverlayLarge.png"));
			}
		}
Esempio n. 2
0
        /// <summary>
        /// Gets the appropriate icon overlay resource name to indicate an unavailable action.
        /// </summary>
        /// <param name="iconSize">The desired version of the icon overlay.</param>
        /// <returns>The requested icon overlay as an <see cref="Image"/>.</returns>
        private Image GetOverlayIcon(IconSize iconSize)
        {
            var resourceResolver = new ApplicationThemeResourceResolver(GetType().Assembly);

            switch (iconSize)
            {
            case IconSize.Small:
                return(new Bitmap(resourceResolver.OpenResource("Icons.UnavailableToolOverlaySmall.png")));

            case IconSize.Medium:
                return(new Bitmap(resourceResolver.OpenResource("Icons.UnavailableToolOverlayMedium.png")));

            case IconSize.Large:
            default:
                return(new Bitmap(resourceResolver.OpenResource("Icons.UnavailableToolOverlayLarge.png")));
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Gets a statically cached image resource.
 /// </summary>
 internal static Image GetImageResource(string resourceName)
 {
     // simple static resource caching - the progress bar graphical elements only total about 6 kilobytes
     if (!_cachedImageResources.ContainsKey(resourceName))
     {
         var resourceResolver = new ApplicationThemeResourceResolver(Assembly.GetExecutingAssembly());
         var image            = Image.FromStream(resourceResolver.OpenResource(resourceName));
         _cachedImageResources.Add(resourceName, image);
     }
     return(_cachedImageResources[resourceName]);
 }