public static bool CanSelectMultiple(ProdWindow prodwindow, string automationId) { try { AutomationElement control = InternalUtilities.GetHandlelessElement(prodwindow, automationId); return(SelectionPatternHelper.CanSelectMultiple(control)); } catch (InvalidOperationException err) { throw new ProdOperationException(err.Message, err); } catch (ElementNotAvailableException err) { throw new ProdOperationException(err.Message, err); } catch (ArgumentException err) { throw new ProdOperationException(err.Message, err); } }
public static int SelectedItemCount(IntPtr controlHandle) { try { AutomationElement control = CommonUIAPatternHelpers.Prologue(SelectionPattern.Pattern, controlHandle); if (!SelectionPatternHelper.CanSelectMultiple(control)) { return(-1); } AutomationElement[] selectedItems = SelectionPatternHelper.GetSelection(control); if (selectedItems == null) { if (CanSelectMultiple(controlHandle)) { /* Call native function */ return(ProdListBoxNative.GetSelectedItemCountNative(controlHandle)); } } if (selectedItems == null) { return(-1); } LogController.ReceiveLogMessage(new LogMessage("List selection count: " + selectedItems.Length)); return(selectedItems.Length); } catch (InvalidOperationException err) { throw new ProdOperationException(err.Message, err); } catch (ElementNotAvailableException err) { throw new ProdOperationException(err.Message, err); } catch (ArgumentException err) { throw new ProdOperationException(err.Message, err); } }
public static bool CanSelectMultiple(IntPtr controlHandle) { try { AutomationElement control = CommonUIAPatternHelpers.Prologue(SelectionPattern.Pattern, controlHandle); LogController.ReceiveLogMessage(new LogMessage(control.Current.Name)); return(SelectionPatternHelper.CanSelectMultiple(control)); } catch (InvalidOperationException err) { throw new ProdOperationException(err.Message, err); } catch (ElementNotAvailableException err) { throw new ProdOperationException(err.Message, err); } catch (ArgumentException err) { throw new ProdOperationException(err.Message, err); } }
private static bool UiaCanSelectMultiple(BaseProdControl control) { return(SelectionPatternHelper.CanSelectMultiple(control.UIAElement)); }