Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ComponentType"/> class.
        /// </summary>
        /// <param name="components">The components that will be offered.</param>
        public ComponentType(IEnumerable <ComponentInfo> components)
        {
            InitializeComponent();

            foreach (var component in components)
            {
                //display all ocmponents
                var componentType = component.ComponentType;

                var item = new ListBoxItem();
                var text = DrawingTools.GetText(componentType.TypeName);
                item.Content         = text;
                item.BorderThickness = new Thickness(1);
                item.Padding         = new Thickness(10);
                item.BorderBrush     = Brushes.Gray;
                item.FontSize        = 15;

                var assemblyText = DrawingTools.GetHeadingText("Assembly", component.DefiningAssembly.ToString());
                DrawingTools.SetToolTip(item, assemblyText);

                item.Selected += (s, e) =>
                {
                    SelectedComponent = componentType;
                    DialogResult      = true;
                };

                ComponentTypes.Items.Add(item);
            }
        }