protected override Atk.RelationSet OnRefRelationSet () { Atk.RelationSet relSet = base.OnRefRelationSet (); if (relSet == null) relSet = new Atk.RelationSet (); List<Atk.Relation> relsToRemove = new List<Atk.Relation> (); for (int i = 0; i < relSet.NRelations; i++) { Atk.Relation rel = relSet.GetRelation (i); if (relSet.GetRelation (i).RelationType == Atk.RelationType.MemberOf) relsToRemove.Add (rel); } foreach (Atk.Relation relation in relsToRemove) relSet.Remove (relation); if (Parent != null) { var rel = new Atk.Relation (((ComponentParentAdapter)Parent).RadioButtons.ToArray (), Atk.RelationType.MemberOf); relSet.Add (rel); } return relSet; }
public int GetSelectedRows (out int [] selected) { ISelectionProvider selection = (ISelectionProvider) resource.Provider.GetPatternProvider (SelectionPatternIdentifiers.Pattern.Id); if (selection == null) { selected = new int [0]; return 0; } IRawElementProviderSimple []items = selection.GetSelection (); List<int> selectedItems = new List <int> (); foreach (IRawElementProviderSimple item in items) { ISelectionItemProvider selectionItem = (ISelectionItemProvider) item.GetPatternProvider (SelectionItemPatternIdentifiers.Pattern.Id); IGridItemProvider gridItem = (IGridItemProvider) item.GetPatternProvider (GridItemPatternIdentifiers.Pattern.Id); if (selectionItem != null && gridItem != null) { if (selectionItem.IsSelected) selectedItems.Add (gridItem.Row); } } selected = selectedItems.ToArray (); return selectedItems.Count; }