private void InitializePanelControls() { this._selectLabel.Text = System.Design.SR.GetString("CreateDataSource_SelectType"); this._idLabel.Text = System.Design.SR.GetString("CreateDataSource_ID"); base.OKButton.Enabled = false; this.Text = System.Design.SR.GetString("CreateDataSource_Title"); this._descriptionBox.Text = System.Design.SR.GetString("CreateDataSource_SelectTypeDesc"); base.AccessibleDescription = System.Design.SR.GetString("CreateDataSource_Description"); base.CaptionLabel.Text = System.Design.SR.GetString("CreateDataSource_Caption"); this.UpdateFonts(); ISite site = this.GetSite(); if (site != null) { IComponentDiscoveryService service = (IComponentDiscoveryService)site.GetService(typeof(IComponentDiscoveryService)); IDesignerHost designerHost = (IDesignerHost)site.GetService(typeof(IDesignerHost)); if (service != null) { ICollection componentTypes = service.GetComponentTypes(designerHost, this._dataSourceType); if (componentTypes != null) { ImageList list = new ImageList { ColorDepth = ColorDepth.Depth32Bit }; System.Type[] array = new System.Type[componentTypes.Count]; componentTypes.CopyTo(array, 0); foreach (System.Type type in array) { System.ComponentModel.AttributeCollection attributes = TypeDescriptor.GetAttributes(type); Bitmap image = null; if (attributes != null) { ToolboxBitmapAttribute attribute = attributes[typeof(ToolboxBitmapAttribute)] as ToolboxBitmapAttribute; if ((attribute != null) && !attribute.Equals(ToolboxBitmapAttribute.Default)) { image = attribute.GetImage(type, true) as Bitmap; } } if (image == null) { image = new Bitmap(base.GetType(), "CustomDataSource.bmp"); } list.ImageSize = new Size(0x20, 0x20); list.Images.Add(type.FullName, image); this._dataSourceTypesListView.Items.Add(new DataSourceListViewItem(type)); } this._dataSourceTypesListView.Sort(); this._dataSourceTypesListView.LargeImageList = list; } } } }
public void Equals_Other_ReturnsExpected(ToolboxBitmapAttribute attribute, object other, bool expected) { Assert.Equal(expected, attribute.Equals(other)); Assert.Equal(attribute.GetHashCode(), attribute.GetHashCode()); }