private static int UiaSelectedIndex(BaseProdControl control) { AutomationElement[] element = SelectionPatternHelper.SelectedItems(control.UIAElement); int retVal = SelectionItemPatternHelper.FindIndexByItem(control.UIAElement, element[0].Current.Name); LogController.ReceiveLogMessage(new LogMessage(retVal.ToString(CultureInfo.CurrentCulture))); return(retVal); }
private static int UiaGetSelectedItemCount(BaseProdControl control) { if (!UiaCanSelectMultiple(control)) { throw new ProdOperationException("Does not support multiple selection"); } AutomationElement[] selectedItems = SelectionPatternHelper.SelectedItems(control.UIAElement); LogController.ReceiveLogMessage(new LogMessage("Count: " + selectedItems.Length)); return(selectedItems.Length); }
private static Collection <string> UiaGetSelectedItems(BaseProdControl control) { if (!UiaCanSelectMultiple(control)) { throw new ProdOperationException("Does not support multiple selection"); } AutomationElement[] selectedItems = SelectionPatternHelper.SelectedItems(control.UIAElement); Collection <string> retList = new Collection <string>(); foreach (AutomationElement item in selectedItems) { retList.Add(item.Current.Name); } LogController.ReceiveLogMessage(new LogMessage("Selected Items", new Collection <object>(selectedItems))); return(retList); }
/// <summary> /// Gets the selected indexes using UIA /// </summary> /// <param name="control">The base ProdUI control</param> /// <returns> /// A List of all the indexes of currently selected list items. /// </returns> private static Collection <int> UiaGetSelectedIndexes(BaseProdControl control) { if (!UiaCanSelectMultiple(control)) { throw new ProdOperationException("Does not support multiple selection"); } AutomationElement[] selectedItems = SelectionPatternHelper.SelectedItems(control.UIAElement); Collection <object> retList = new Collection <object> { (selectedItems) }; Collection <int> selectedIndexes = new Collection <int>(); foreach (AutomationElement item in selectedItems) { selectedIndexes.Add(SelectionItemPatternHelper.FindIndexByItem(control.UIAElement, item.Current.Name)); } LogController.ReceiveLogMessage(new LogMessage("Selected Indexes", retList)); return(selectedIndexes); }
private static AutomationElement UiaGetSelectedItem(BaseProdControl control) { AutomationElement[] retVal = SelectionPatternHelper.SelectedItems(control.UIAElement); LogController.ReceiveLogMessage(new LogMessage("Item " + retVal[0])); return(retVal[0]); }