public List <DesignerItemAutomationPeer> GetSelectedAutomationPeers(Selection newSel) { List <DesignerItemAutomationPeer> list = new List <DesignerItemAutomationPeer>(newSel.SelectionCount); if (newSel.SelectionCount == 0) { return(list); } DesignerItemAutomationPeer itemAutomationPeer = (DesignerItemAutomationPeer)null; ModelItem root = this.ModelService.Root; if (root != this._root) { this._root = root; this.PopulateDataChildren(); } if (root != null) { itemAutomationPeer = (DesignerItemAutomationPeer)this._dataChildren[(object)root]; } foreach (ModelItem modelItem in newSel.SelectedObjects) { if (this._dataChildren.ContainsKey((object)modelItem) && itemAutomationPeer != null) { list.Add(itemAutomationPeer); } List <DesignerItemAutomationPeer> selectedAutomationPeers = itemAutomationPeer.GetSelectedAutomationPeers((object)modelItem); list.AddRange((IEnumerable <DesignerItemAutomationPeer>)selectedAutomationPeers); } return(list); }
public List <DesignerItemAutomationPeer> GetSelectedAutomationPeers(object selectedObj) { if (this._dataChildren == null) { this.GetChildren(); } List <DesignerItemAutomationPeer> list = new List <DesignerItemAutomationPeer>(); if (this._dataChildren.ContainsKey(selectedObj)) { DesignerItemAutomationPeer itemAutomationPeer = this._dataChildren[selectedObj] as DesignerItemAutomationPeer; if (itemAutomationPeer != null) { list.Add(itemAutomationPeer); } } else { foreach (DictionaryEntry dictionaryEntry in this._dataChildren) { DesignerItemAutomationPeer itemAutomationPeer = dictionaryEntry.Value as DesignerItemAutomationPeer; if (itemAutomationPeer != null) { list.AddRange((IEnumerable <DesignerItemAutomationPeer>)itemAutomationPeer.GetSelectedAutomationPeers(selectedObj)); } } } return(list); }