public void LoadToolboxItems(string fileName, ToolboxCategoryItems container, bool resetContainer)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                throw FxTrace.Exception.AsError(new ArgumentNullException("fileName"));
            }

            if (null == container)
            {
                throw FxTrace.Exception.AsError(new ArgumentNullException("container"));
            }

            if (resetContainer)
            {
                container.Clear();
            }

            using (StreamReader reader = File.OpenText(fileName))
            {
                string          entry    = null;
                ToolboxCategory category = null;
                while (null != (entry = reader.ReadLine()))
                {
                    entry = entry.Trim();
                    if (entry.Length > 1 && (entry[0] != ';' && entry[0] != '#'))
                    {
                        if (entry.StartsWith("[", StringComparison.CurrentCulture) && entry.EndsWith("]", StringComparison.CurrentCulture))
                        {
                            string categoryName = entry.Substring(1, entry.Length - 2);
                            category = GetCategoryItem(container, categoryName);
                        }
                        else
                        {
                            if (null == category)
                            {
                                category = GetCategoryItem(container, DefaultCategory);
                            }
                            string[] toolDefinition = entry.Split(';');

                            string toolName    = null;
                            string assembly    = null;
                            string displayName = null;
                            string bitmap      = null;

                            if (GetToolAssemblyAndName(toolDefinition, ref toolName, ref assembly))
                            {
                                GetBitmap(toolDefinition, ref bitmap);
                                GetDisplayName(toolDefinition, ref displayName);
                                category.Add(new ToolboxItemWrapper(toolName, assembly, bitmap, displayName));
                            }
                            else
                            {
                                throw FxTrace.Exception.AsError(new ArgumentOutOfRangeException(FormatExceptionText));
                            }
                        }
                    }
                }
            }
        }
        ToolboxCategory GetCategoryItem(ToolboxCategoryItems container, string categoryName)
        {
            foreach (ToolboxCategory category in container)
            {
                if (0 == string.Compare(category.CategoryName, categoryName, true, CultureInfo.CurrentUICulture))
                {
                    return(category);
                }
            }
            ToolboxCategory newCategory = new ToolboxCategory(categoryName);

            container.Add(newCategory);
            return(newCategory);
        }
        public ToolboxControl()
        {
            var callback = new NotifyCollectionChangedEventHandler(this.OnCategoryCollectionChanged);

            this.categories = new ToolboxCategoryItems(callback);
        }