コード例 #1
0
        /// <summary>
        /// Returns the existing stock icon from the internal cache, or creates a new one
        /// based on the current settings if it's not in the cache.
        /// </summary>
        /// <param name="stockIconIdentifier">Unique identifier for the requested stock icon</param>
        /// <returns>Stock Icon based on the identifier given (either from the cache or created new)</returns>
        private StockIcon GetStockIcon(StockIconIdentifier stockIconIdentifier)
        {
            // Check the cache first
            if (stockIconCache[stockIconIdentifier] != null)
            {
                return(stockIconCache[stockIconIdentifier]);
            }
            else
            {
                // Create a new icon based on our default settings
                StockIcon icon = new StockIcon(stockIconIdentifier, defaultSize, isLinkOverlay, isSelected);

                try
                {
                    // Add it to the cache
                    stockIconCache[stockIconIdentifier] = icon;
                }
                catch
                {
                    icon.Dispose();
                    throw;
                }

                // Return
                return(icon);
            }
        }
コード例 #2
0
        /// <summary>
        /// Returns the existing stock icon from the internal cache, or creates a new one
        /// based on the current settings if it's not in the cache.
        /// </summary>
        /// <param name="stockIconIdentifier">Unique identifier for the requested stock icon</param>
        /// <returns>Stock Icon based on the identifier given (either from the cache or created new)</returns>
        private StockIcon GetStockIcon(StockIconIdentifier stockIconIdentifier)
        {
            // Check the cache first
            if (stockIconCache[stockIconIdentifier] != null)
                return stockIconCache[stockIconIdentifier];
            else
            {
                // Create a new icon based on our default settings
                StockIcon icon = new StockIcon(stockIconIdentifier, defaultSize, isLinkOverlay, isSelected);

                try
                {
                    // Add it to the cache
                    stockIconCache[stockIconIdentifier] = icon;
                }
                catch
                {
                    icon.Dispose();
                    throw;
                }

                // Return 
                return icon;
            }
        }