/// <summary> /// Creates a new StockIcon instance with the specified identifer and options. /// </summary> /// <param name="id">A value that identifies the icon represented by this instance.</param> /// <param name="size">A value that indicates the size of the stock icon.</param> /// <param name="isLinkOverlay">A bool value that indicates whether the icon has a link overlay.</param> /// <param name="isSelected">A bool value that indicates whether the icon is in a selected state.</param> public StockIcon(StockIconIdentifier id, StockIconSize size, bool isLinkOverlay, bool isSelected) { identifier = id; linkOverlay = isLinkOverlay; selected = isSelected; currentSize = size; invalidateIcon = true; }
/// <summary> /// Initialize a new instance of the <see cref="StockIcon" /> class /// to the specified stock icon ID, stock icon size, overlay flag and selected flag. /// </summary> /// <param name="stockIconId"></param> /// <param name="size"></param> /// <param name="isLinkOverlay"></param> /// <param name="isSelected"></param> internal StockIcon(SHSTOCKICONID stockIconId, StockIconSize size, bool isLinkOverlay, bool isSelected) { this.Id = stockIconId; this.Size = StockIconSize.Large; this.LinkOverlay = isLinkOverlay; this.Selected = isSelected; this.Size = size; }
private void UpdateStockIconSettings(StockIconSize newSize, bool isLinkOverlay, bool isSelected) { // Update all the stock icons in the collection with the latest settings foreach (StockIcon icon in stockIcons.AllStockIcons) { icon.CurrentSize = newSize; icon.LinkOverlay = isLinkOverlay; icon.Selected = isSelected; } }
/// <summary> /// Overloaded constructor that takes in size and Boolean values for /// link overlay and selected icon state. The settings are applied to /// all the stock icons in the collection. /// </summary> /// <param name="size">StockIcon size for all the icons in the collection.</param> /// <param name="linkOverlay">Link Overlay state for all the icons in the collection.</param> /// <param name="selected">Selection state for all the icons in the collection.</param> public StockIcons(StockIconSize size, bool linkOverlay, bool selected) { defaultSize = size; isLinkOverlay = linkOverlay; isSelected = selected; // Create an empty dictionary. Stock icons will be created when requested // or when they are enumerated on this collection stockIconCache = new Dictionary<StockIconIdentifier, StockIcon>(); Array allIdentifiers = Enum.GetValues(typeof(StockIconIdentifier)); foreach (StockIconIdentifier id in allIdentifiers) { stockIconCache.Add(id, null); } }
/// <summary> /// Overloaded constructor that takes in size and Boolean values for /// link overlay and selected icon state. The settings are applied to /// all the stock icons in the collection. /// </summary> /// <param name="size">StockIcon size for all the icons in the collection.</param> /// <param name="linkOverlay">Link Overlay state for all the icons in the collection.</param> /// <param name="selected">Selection state for all the icons in the collection.</param> public StockIcons(StockIconSize size, bool linkOverlay, bool selected) { defaultSize = size; isLinkOverlay = linkOverlay; isSelected = selected; // Create an empty dictionary. Stock icons will be created when requested // or when they are enumerated on this collection stockIconCache = new Dictionary <StockIconIdentifier, StockIcon>(); Array allIdentifiers = Enum.GetValues(typeof(StockIconIdentifier)); foreach (StockIconIdentifier id in allIdentifiers) { stockIconCache.Add(id, null); } }
private void UpdateStockIcon(StockIconSize newSize, bool isLinkOverlay, bool isSelected) { // Clear any existing items in the wrap panel // Using the updated UI settings, get all the stock icons and show them in an Image control wrapPanel1.Children.Clear(); // Update all the stock icons with these latest settings UpdateStockIconSettings(newSize, isLinkOverlay, isSelected); // Get the new bitmap source foreach (StockIcon icon in stockIcons.AllStockIcons) { Image img = new Image(); img.Tag = icon; img.Stretch = Stretch.None; img.Source = icon.BitmapSource; img.Margin = new Thickness(10); img.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(img_MouseLeftButtonDown); wrapPanel1.Children.Add(img); } stockIconsCount.Text = stockIcons.AllStockIcons.Count.ToString(); }
private void UpdateStockIcon(StockIconSize size, bool? isLinkOverlay, bool? isSelected) { UpdateStockIcon(size, isLinkOverlay == true, isSelected == true); }
private void UpdateStockIcon(StockIconSize size, bool?isLinkOverlay, bool?isSelected) { UpdateStockIcon(size, isLinkOverlay == true, isSelected == true); }