Esempio n. 1
0
 ///  <summary>
 ///
 ///       Adds the contents of another <see cref="ToolboxLibrary.ToolboxItemCollection"/> to the end of the collection.
 ///
 ///  </summary>
 ///  <param name="value">
 ///    A <see cref="ToolboxLibrary.ToolboxItemCollection"/> containing the objects to add to the collection.
 ///  </param>
 ///  <remarks><seealso cref="ToolboxLibrary.ToolboxItemCollection.Add"/></remarks>
 ///  <history>
 ///      [dineshc] 3/26/2003  Created
 ///  </history>
 public void AddRange(ToolboxItemCollection value)
 {
     for (int i = 0; (i < value.Count); i = (i + 1))
     {
         this.Add(value[i]);
     }
 }
        private void UpdateToolboxItems(int tabIndex)
        {
            Toolbox.ToolsListBox.Items.Clear();
            Toolbox.ToolsListBox.Items.Add(pointer);
            if (Toolbox.Tabs.Count <= 0)
            {
                return;
            }

            ToolboxTab            toolboxTab   = Toolbox.Tabs[tabIndex];
            ToolboxItemCollection toolboxItems = toolboxTab.ToolboxItems;

            foreach (ToolboxItem toolboxItem in toolboxItems)
            {
                Type type = toolboxItem.Type;
                System.Drawing.Design.ToolboxItem     tbi = new System.Drawing.Design.ToolboxItem(type);
                System.Drawing.ToolboxBitmapAttribute tba = TypeDescriptor.GetAttributes(type)[typeof(System.Drawing.ToolboxBitmapAttribute)] as System.Drawing.ToolboxBitmapAttribute;

                if (tba != null)
                {
                    tbi.Bitmap = (System.Drawing.Bitmap)tba.GetImage(type);
                }

                Toolbox.ToolsListBox.Items.Add(tbi);
            }
        }
        private void PopulateToolboxItems(XmlNode tabNode, ToolboxTab toolboxTab)
        {
            if (tabNode == null)
            {
                return;
            }

            XmlNode toolboxItemCollectionNode = tabNode[Strings.ToolboxItemCollection];

            if (toolboxItemCollectionNode == null)
            {
                return;
            }

            XmlNodeList toolboxItemNodeList = toolboxItemCollectionNode.ChildNodes;

            if (toolboxItemNodeList == null)
            {
                return;
            }

            ToolboxItemCollection toolboxItems = new ToolboxItemCollection();

            foreach (XmlNode toolboxItemNode in toolboxItemNodeList)
            {
                if (toolboxItemNode == null)
                {
                    continue;
                }

                XmlNode typeNode = toolboxItemNode[Strings.Type];
                if (typeNode == null)
                {
                    continue;
                }

                bool found = false;
                System.Reflection.Assembly[] loadedAssemblies = System.AppDomain.CurrentDomain.GetAssemblies();
                for (int i = 0; i < loadedAssemblies.Length && !found; i++)
                {
                    System.Reflection.Assembly assembly = loadedAssemblies[i];
                    System.Type[] types = assembly.GetTypes();
                    for (int j = 0; j < types.Length && !found; j++)
                    {
                        System.Type type = types[j];
                        if (type.FullName == typeNode.InnerXml.ToString())
                        {
                            ToolboxItem toolboxItem = new ToolboxItem();
                            toolboxItem.Type = type;
                            toolboxItems.Add(toolboxItem);
                            found = true;
                        }
                    }
                }
            }
            toolboxTab.ToolboxItems = toolboxItems;
            return;
        }
        private void PopulateToolboxItems(ToolboxTab toolboxTab)
        {
            if (toolboxTab == null)
            {
                return;
            }

            Type[] typeArray = null;

            switch (toolboxTab.Name)
            {
            case Strings.WindowsForms:
                typeArray = windowsFormsToolTypes;
                break;

            case Strings.Components:
                typeArray = componentsToolTypes;
                break;

            case Strings.Data:
                typeArray = dataToolTypes;
                break;

            case Strings.UserControls:
                typeArray = userControlsToolTypes;
                break;

            case Strings.RibbonControls:
                typeArray = ribbonControlsToolTypes;
                break;

            default:
                break;
            }

            ToolboxItemCollection toolboxItems = new ToolboxItemCollection();

            for (int i = 0; i < typeArray.Length; i++)
            {
                ToolboxItem toolboxItem = new ToolboxItem();

                toolboxItem.Type = typeArray[i];
                toolboxItem.Name = typeArray[i].Name;
                toolboxItems.Add(toolboxItem);
            }

            toolboxTab.ToolboxItems = toolboxItems;
        }
 ///  <summary>
 ///       Initializes a new instance of <see cref="ToolboxLibrary.ToolboxItemCollection"/> based on another <see cref="ToolboxLibrary.ToolboxItemCollection"/>.
 ///  </summary>
 ///  <param name="value">
 ///       A <see cref="ToolboxLibrary.ToolboxItemCollection"/> from which the contents are copied
 ///  </param>
 ///  <remarks></remarks>
 ///  <history>
 ///      [dineshc] 3/26/2003  Created
 ///  </history>
 public ToolboxItemCollection(ToolboxItemCollection value) {
     this.AddRange(value);
 }
 public ToolboxItemEnumerator(ToolboxItemCollection mappings) {
     this.temp = ((IEnumerable)(mappings));
     this.baseEnumerator = temp.GetEnumerator();
 }
 ///  <summary>
 ///     
 ///       Adds the contents of another <see cref="ToolboxLibrary.ToolboxItemCollection"/> to the end of the collection.
 ///    
 ///  </summary>
 ///  <param name="value">
 ///    A <see cref="ToolboxLibrary.ToolboxItemCollection"/> containing the objects to add to the collection.
 ///  </param>
 ///  <remarks><seealso cref="ToolboxLibrary.ToolboxItemCollection.Add"/></remarks>
 ///  <history>
 ///      [dineshc] 3/26/2003  Created
 ///  </history>
 public void AddRange(ToolboxItemCollection value) {
     for (int i = 0; (i < value.Count); i = (i + 1)) {
         this.Add(value[i]);
     }
 }
		private void PopulateToolboxItems(XmlNode tabNode, ToolboxTab toolboxTab)
		{
			if(tabNode==null)
				return;

			XmlNode toolboxItemCollectionNode = tabNode[Strings.ToolboxItemCollection];
			if(toolboxItemCollectionNode==null)
				return;

			XmlNodeList toolboxItemNodeList = toolboxItemCollectionNode.ChildNodes;
			if(toolboxItemNodeList==null)
				return;

			ToolboxItemCollection toolboxItems = new ToolboxItemCollection();

			foreach(XmlNode toolboxItemNode in toolboxItemNodeList)
			{
				if(toolboxItemNode==null)
					continue;

				XmlNode typeNode = toolboxItemNode[Strings.Type];
				if(typeNode==null)
					continue;

				bool found = false;
				System.Reflection.Assembly[] loadedAssemblies = System.AppDomain.CurrentDomain.GetAssemblies();
				for(int i=0; i<loadedAssemblies.Length && !found;i++)
				{
					System.Reflection.Assembly assembly = loadedAssemblies[i];
					System.Type[] types = assembly.GetTypes();
					for(int j=0;j<types.Length && !found;j++)
					{
						System.Type type = types[j];
						if(type.FullName == typeNode.InnerXml.ToString()) 
						{
							ToolboxItem toolboxItem = new ToolboxItem();
							toolboxItem.Type = type;
							toolboxItems.Add(toolboxItem);
							found = true;
						}
					}
				}
			}
			toolboxTab.ToolboxItems = toolboxItems;
			return;
		}
Esempio n. 9
0
 ///  <summary>
 ///       Initializes a new instance of <see cref="ToolboxLibrary.ToolboxItemCollection"/> based on another <see cref="ToolboxLibrary.ToolboxItemCollection"/>.
 ///  </summary>
 ///  <param name="value">
 ///       A <see cref="ToolboxLibrary.ToolboxItemCollection"/> from which the contents are copied
 ///  </param>
 ///  <remarks></remarks>
 ///  <history>
 ///      [dineshc] 3/26/2003  Created
 ///  </history>
 public ToolboxItemCollection(ToolboxItemCollection value)
 {
     this.AddRange(value);
 }
Esempio n. 10
0
 public ToolboxItemEnumerator(ToolboxItemCollection mappings)
 {
     this.temp           = ((IEnumerable)(mappings));
     this.baseEnumerator = temp.GetEnumerator();
 }