private void UpdateView() { listView.Items.Clear(); DisposeImages(); if (ExternalCommandConfig.Commands != null) { listView.ListViewItemSorter = new ListviewComparer(); var imageList = new ImageList(); listView.SmallImageList = imageList; var imageNr = 0; foreach (var commando in ExternalCommandConfig.Commands) { ListViewItem item; var iconForExe = IconCache.IconForCommand(commando, DpiHandler.Dpi > 100); if (iconForExe != null) { var image = iconForExe.ScaleIconForDisplaying(DpiHandler.Dpi); if (!Equals(image, iconForExe)) { _images.Add(image); } imageList.Images.Add(image); item = new ListViewItem(commando, imageNr++); } else { item = new ListViewItem(commando); } item.Tag = commando; listView.Items.Add(item); } } // Fix for bug #1484, getting an ArgumentOutOfRangeException as there is nothing selected but the edit button was still active. button_edit.Enabled = listView.SelectedItems.Count > 0; }
public override Bitmap GetDisplayIcon(double dpi) { return(IconCache.IconForCommand(_presetCommand, dpi > 100)); }
/// <inheritdoc /> public override Bitmap GetDisplayIcon(double dpi) { return(IconCache.IconForCommand(_externalCommandDefinition, dpi > 100)); }