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; }
private ToolboxTabCollection PopulateToolboxTabs() { ToolboxTabCollection toolboxTabs = new ToolboxTabCollection(); string[] tabNames = { Strings.WindowsForms, Strings.Components, Strings.Data, Strings.Data1 }; for (int i = 0; i < tabNames.Length; i++) { ToolboxTab toolboxTab = new ToolboxTab(); toolboxTab.Name = tabNames[i]; PopulateToolboxItems(toolboxTab); toolboxTabs.Add(toolboxTab); } return(toolboxTabs); }
public void PopulateData() { ToolboxTab tab = null; tabDictionary = new Dictionary<string, ToolboxTab>(); foreach (var toolboxItem in toolboxItems) { if (tabDictionary.ContainsKey(toolboxItem.Metadata.Category)) tab = tabDictionary[toolboxItem.Metadata.Category]; else { tab = new ToolboxTab(); tab.Name = toolboxItem.Metadata.Category; tab.ToolboxItems = new Collection<ToolboxItem>(); tabDictionary.Add(toolboxItem.Metadata.Category, tab); } ToolboxItem ti = new ToolboxItem(); ti.Type = toolboxItem.Value; ti.Name = toolboxItem.Value.Name; tab.ToolboxItems.Add(ti); } }
public void PopulateData() { ToolboxTab tab = null; tabDictionary = new Dictionary <string, ToolboxTab>(); foreach (var toolboxItem in toolboxItems) { if (tabDictionary.ContainsKey(toolboxItem.Metadata.Category)) { tab = tabDictionary[toolboxItem.Metadata.Category]; } else { tab = new ToolboxTab(); tab.Name = toolboxItem.Metadata.Category; tab.ToolboxItems = new Collection <ToolboxItem>(); tabDictionary.Add(toolboxItem.Metadata.Category, tab); } ToolboxItem ti = new ToolboxItem(); ti.Type = toolboxItem.Value; ti.Name = toolboxItem.Value.Name; tab.ToolboxItems.Add(ti); } }
/// <summary> /// Removes a specific <see cref="ToolboxLibrary.ToolboxTab"/> from the /// <see cref="ToolboxLibrary.ToolboxTabCollection"/> . /// </summary> /// <param name="value">The <see cref="ToolboxLibrary.ToolboxTab"/> to remove from the <see cref="ToolboxLibrary.ToolboxTabCollection"/> .</param> /// <remarks><exception cref="System.ArgumentException"><paramref name="value"/> is not found in the Collection. </exception></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public void Remove(ToolboxTab value) { List.Remove(value); }
/// <summary> /// Inserts a <see cref="ToolboxLibrary.ToolboxTab"/> into the <see cref="ToolboxLibrary.ToolboxTabCollection"/> at the specified index. /// </summary> /// <param name="index">The zero-based index where <paramref name="value"/> should be inserted.</param> /// <param name=" value">The <see cref="ToolboxLibrary.ToolboxTab"/> to insert.</param> /// <remarks><seealso cref="ToolboxLibrary.ToolboxTabCollection.Add"/></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public void Insert(int index, ToolboxTab value) { List.Insert(index, value); }
/// <summary> /// Returns the index of a <see cref="ToolboxLibrary.ToolboxTab"/> in /// the <see cref="ToolboxLibrary.ToolboxTabCollection"/> . /// </summary> /// <param name="value">The <see cref="ToolboxLibrary.ToolboxTab"/> to locate.</param> /// <returns> /// The index of the <see cref="ToolboxLibrary.ToolboxTab"/> of <paramref name="value"/> in the /// <see cref="ToolboxLibrary.ToolboxTabCollection"/>, if found; otherwise, -1. /// </returns> /// <remarks><seealso cref="ToolboxLibrary.ToolboxTabCollection.Contains"/></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public int IndexOf(ToolboxTab value) { return(List.IndexOf(value)); }
/// <summary> /// Gets a value indicating whether the /// <see cref="ToolboxLibrary.ToolboxTabCollection"/> contains the specified <see cref="ToolboxLibrary.ToolboxTab"/>. /// </summary> /// <param name="value">The <see cref="ToolboxLibrary.ToolboxTab"/> to locate.</param> /// <returns> /// <see langword="true"/> if the <see cref="ToolboxLibrary.ToolboxTab"/> is contained in the collection; /// otherwise, <see langword="false"/>. /// </returns> /// <remarks><seealso cref="ToolboxLibrary.ToolboxTabCollection.IndexOf"/></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public bool Contains(ToolboxTab value) { return(List.Contains(value)); }
/// <summary> /// Removes a specific <see cref="ToolboxLibrary.ToolboxTab"/> from the /// <see cref="ToolboxLibrary.ToolboxTabCollection"/> . /// </summary> /// <param name="value">The <see cref="ToolboxLibrary.ToolboxTab"/> to remove from the <see cref="ToolboxLibrary.ToolboxTabCollection"/> .</param> /// <remarks><exception cref="System.ArgumentException"><paramref name="value"/> is not found in the Collection. </exception></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public void Remove(ToolboxTab value) { List.Remove(value); }
/// <summary> /// Gets a value indicating whether the /// <see cref="ToolboxLibrary.ToolboxTabCollection"/> contains the specified <see cref="ToolboxLibrary.ToolboxTab"/>. /// </summary> /// <param name="value">The <see cref="ToolboxLibrary.ToolboxTab"/> to locate.</param> /// <returns> /// <see langword="true"/> if the <see cref="ToolboxLibrary.ToolboxTab"/> is contained in the collection; /// otherwise, <see langword="false"/>. /// </returns> /// <remarks><seealso cref="ToolboxLibrary.ToolboxTabCollection.IndexOf"/></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public bool Contains(ToolboxTab value) { return List.Contains(value); }
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; }
/// <summary> /// Copies the <see cref="ToolboxLibrary.ToolboxTabCollection"/> values to a one-dimensional <see cref="System.Array"/> instance at the /// specified index. /// </summary> /// <param name="array">The one-dimensional <see cref="System.Array"/> that is the destination of the values copied from <see cref="ToolboxLibrary.ToolboxTabCollection"/> .</param> /// <param name="index">The index in <paramref name="array"/> where copying begins.</param> /// <remarks><exception cref="System.ArgumentException"><paramref name="array"/> is multidimensional. <para>-or-</para> <para>The number of elements in the <see cref="ToolboxLibrary.ToolboxTabCollection"/> is greater than the available space between <paramref name="arrayIndex"/> and the end of <paramref name="array"/>.</para></exception> /// <exception cref="System.ArgumentNullException"><paramref name="array"/> is <see langword="null"/>. </exception> /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="arrayIndex"/> is less than <paramref name="array"/>"s lowbound. </exception> /// <seealso cref="System.Array"/> /// </remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public void CopyTo(ToolboxTab[] array, int index) { List.CopyTo(array, index); }
public void AddTab(string tabName, Type[] types) { if (Tabs == null) Tabs = new ToolboxTabCollection(); ToolboxTab toolboxTab = new ToolboxTab(); toolboxTab.Name = tabName; ToolboxItemCollection toolboxItems = new ToolboxItemCollection(); for (int i = 0; i < types.Length; i++) { ToolboxItem toolboxItem = new ToolboxItem(); toolboxItem.Type = types[i]; toolboxItem.Name = types[i].Name; toolboxItems.Add(toolboxItem); } toolboxItems.SortByName(); toolboxTab.ToolboxItems = toolboxItems; Tabs.Add(toolboxTab); ToolboxUIManagerVS toolboxUIManagerVS = new ToolboxUIManagerVS(this); toolboxUIManagerVS.FillToolbox(); AddEventHandlers(); //PrintToolbox(); }
/// <summary> /// Copies the elements of an array to the end of the <see cref="ToolboxLibrary.ToolboxTabCollection"/>. /// </summary> /// <param name="value"> /// An array of type <see cref="ToolboxLibrary.ToolboxTab"/> containing the objects to add to the collection. /// </param> /// <remarks><seealso cref="ToolboxLibrary.ToolboxTabCollection.Add"/></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public void AddRange(ToolboxTab[] value) { for (int i = 0; (i < value.Length); i = (i + 1)) { this.Add(value[i]); } }
/// <summary> /// Returns the index of a <see cref="ToolboxLibrary.ToolboxTab"/> in /// the <see cref="ToolboxLibrary.ToolboxTabCollection"/> . /// </summary> /// <param name="value">The <see cref="ToolboxLibrary.ToolboxTab"/> to locate.</param> /// <returns> /// The index of the <see cref="ToolboxLibrary.ToolboxTab"/> of <paramref name="value"/> in the /// <see cref="ToolboxLibrary.ToolboxTabCollection"/>, if found; otherwise, -1. /// </returns> /// <remarks><seealso cref="ToolboxLibrary.ToolboxTabCollection.Contains"/></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public int IndexOf(ToolboxTab value) { return List.IndexOf(value); }
/// <summary> /// Adds a <see cref="ToolboxLibrary.ToolboxTab"/> with the specified value to the /// <see cref="ToolboxLibrary.ToolboxTabCollection"/> . /// </summary> /// <param name="value">The <see cref="ToolboxLibrary.ToolboxTab"/> to add.</param> /// <returns> /// The index at which the new element was inserted. /// </returns> /// <remarks><seealso cref="ToolboxLibrary.ToolboxTabCollection.AddRange"/></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public int Add(ToolboxTab value) { return List.Add(value); }
/// <summary> /// Initializes a new instance of <see cref="ToolboxLibrary.ToolboxTabCollection"/> containing any array of <see cref="ToolboxLibrary.ToolboxTab"/> objects. /// </summary> /// <param name="value"> /// A array of <see cref="ToolboxLibrary.ToolboxTab"/> objects with which to intialize the collection /// </param> /// <remarks></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public ToolboxTabCollection(ToolboxTab[] value) { this.AddRange(value); }
/// <summary> /// Adds a <see cref="ToolboxLibrary.ToolboxTab"/> with the specified value to the /// <see cref="ToolboxLibrary.ToolboxTabCollection"/> . /// </summary> /// <param name="value">The <see cref="ToolboxLibrary.ToolboxTab"/> to add.</param> /// <returns> /// The index at which the new element was inserted. /// </returns> /// <remarks><seealso cref="ToolboxLibrary.ToolboxTabCollection.AddRange"/></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public int Add(ToolboxTab value) { return(List.Add(value)); }
private ToolboxTabCollection PopulateToolboxTabs(XmlDocument xmlDocument) { if (xmlDocument == null) { return(null); } XmlNode toolboxNode = xmlDocument.FirstChild; if (toolboxNode == null) { return(null); } XmlNode tabCollectionNode = toolboxNode.FirstChild; if (tabCollectionNode == null) { return(null); } XmlNodeList tabsNodeList = tabCollectionNode.ChildNodes; if (tabsNodeList == null) { return(null); } ToolboxTabCollection toolboxTabs = new ToolboxTabCollection(); foreach (XmlNode tabNode in tabsNodeList) { if (tabNode == null) { continue; } XmlNode propertiesNode = tabNode.FirstChild; if (propertiesNode == null) { continue; } XmlNode nameNode = propertiesNode[Strings.Name]; if (nameNode == null) { continue; } ToolboxTab toolboxTab = new ToolboxTab(); toolboxTab.Name = nameNode.InnerXml.ToString(); PopulateToolboxItems(tabNode, toolboxTab); toolboxTabs.Add(toolboxTab); } if (toolboxTabs.Count == 0) { return(null); } return(toolboxTabs); }
// 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; // 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; // } private ToolboxTabCollection PopulateToolboxTabs(XmlDocument xmlDocument) { if(xmlDocument==null) return null; XmlNode toolboxNode = xmlDocument.FirstChild; if(toolboxNode==null) return null; XmlNode tabCollectionNode = toolboxNode.FirstChild; if(tabCollectionNode==null) return null; XmlNodeList tabsNodeList = tabCollectionNode.ChildNodes; if(tabsNodeList==null) return null; ToolboxTabCollection toolboxTabs = new ToolboxTabCollection(); foreach(XmlNode tabNode in tabsNodeList) { if(tabNode==null) continue; XmlNode propertiesNode = tabNode.FirstChild; if(propertiesNode==null) continue; XmlNode nameNode = propertiesNode[Strings.Name]; if(nameNode==null) continue; ToolboxTab toolboxTab = new ToolboxTab(); toolboxTab.Name = nameNode.InnerXml.ToString(); PopulateToolboxItems(tabNode, toolboxTab); toolboxTabs.Add(toolboxTab); } if(toolboxTabs.Count==0) return null; return toolboxTabs; }
/// <summary> /// Inserts a <see cref="ToolboxLibrary.ToolboxTab"/> into the <see cref="ToolboxLibrary.ToolboxTabCollection"/> at the specified index. /// </summary> /// <param name="index">The zero-based index where <paramref name="value"/> should be inserted.</param> /// <param name=" value">The <see cref="ToolboxLibrary.ToolboxTab"/> to insert.</param> /// <remarks><seealso cref="ToolboxLibrary.ToolboxTabCollection.Add"/></remarks> /// <history> /// [dineshc] 3/26/2003 Created /// </history> public void Insert(int index, ToolboxTab value) { List.Insert(index, value); }