void FillMembersComboBox() { IClass c = GetCurrentSelectedClass(); if (c != null && lastClassInMembersComboBox != c) { lastClassInMembersComboBox = c; ArrayList items = new ArrayList(); bool partialMode = false; IClass currentPart = c; if (c.IsPartial) { CompoundClass cc = c.GetCompoundClass() as CompoundClass; if (cc != null) { partialMode = true; c = cc; } } lock (c) { int lastIndex = 0; IComparer comparer = new Comparer(System.Globalization.CultureInfo.InvariantCulture); foreach (IMethod m in c.Methods) { items.Add(new ComboBoxItem(m, m.Name, (int)ScriptControl.GetIcon(m), partialMode ? currentPart.Methods.Contains(m) : true)); } items.Sort(lastIndex, c.Methods.Count, comparer); lastIndex = items.Count; foreach (IProperty p in c.Properties) { items.Add(new ComboBoxItem(p, p.Name, (int)ScriptControl.GetIcon(p), partialMode ? currentPart.Properties.Contains(p) : true)); } items.Sort(lastIndex, c.Properties.Count, comparer); lastIndex = items.Count; foreach (IField f in c.Fields) { items.Add(new ComboBoxItem(f, f.Name, (int)ScriptControl.GetIcon(f), partialMode ? currentPart.Fields.Contains(f) : true)); } items.Sort(lastIndex, c.Fields.Count, comparer); lastIndex = items.Count; foreach (IEvent evt in c.Events) { items.Add(new ComboBoxItem(evt, evt.Name, (int)ScriptControl.GetIcon(evt), partialMode ? currentPart.Events.Contains(evt) : true)); } items.Sort(lastIndex, c.Events.Count, comparer); lastIndex = items.Count; } membersComboBox.BeginUpdate(); membersComboBox.Items.Clear(); membersComboBox.Items.AddRange(items.ToArray()); membersComboBox.EndUpdate(); UpdateMembersComboBox(); } }
void AddClasses(ArrayList items, ICollection classes) { foreach (IClass c in classes) { items.Add(new ComboBoxItem(c, c.FullyQualifiedName, (int)ScriptControl.GetIcon(c), true)); AddClasses(items, c.InnerClasses); } }