/// <summary> /// Selects the menu item. /// </summary> /// <param name = "menuItems">The menu items.</param> /// <param name = "itemPath">The 'path' to the menu item.</param> private static void SelectMenuItemStatic(AutomationElementCollection menuItems, Collection <string> itemPath) { foreach (AutomationElement item in menuItems) { /* Expand top menu */ try { string name = item.Current.Name; if (string.Compare(name, itemPath[0], true, CultureInfo.CurrentCulture) != 0) { continue; } ExpandCollapseHelper.Expand(item); FindItemStatic(item, itemPath); } catch (InvalidOperationException err) { throw new ProdOperationException(err.Message, err); } catch (ElementNotAvailableException err) { throw new ProdOperationException(err.Message, err); } } }
/// <summary> /// Finds an AutomationElement in a list. /// </summary> /// <param name = "item">The item to search for.</param> /// <param name = "itemPath">The 'path' to the menu item.</param> private static void FindItemStatic(AutomationElement item, Collection <string> itemPath) { /* Loop through supplied menu path */ for (int i = 1; i < itemPath.Count; i++) { try { /* Get next item */ AutomationElement ael = item.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, itemPath[i], PropertyConditionFlags.IgnoreCase)); /* Expand next item */ ExpandCollapseHelper.Expand(ael); ael.SetFocus(); InvokePatternHelper.Invoke(ael); } catch (InvalidOperationException err) { throw new ProdOperationException(err.Message, err); } catch (ElementNotAvailableException err) { throw new ProdOperationException(err.Message, err); } } return; }
public animateExpandingInnerClass(View view, IListViewWrapper listViewWrapper) { mlist = listViewWrapper; mview = view; listViewHeight = listViewWrapper.getListView().Height; listViewBottomPadding = listViewWrapper.getListView().PaddingBottom; v = ExpandCollapseHelper.findDirectChild(view, listViewWrapper.getListView()); }
private void toggle(View contentParent) { if (mListViewWrapper == null) { throw new Java.Lang.IllegalStateException("No ListView set!"); } bool isVisible = contentParent.Visibility == ViewStates.Visible; bool shouldCollapseOther = !isVisible && mLimit > 0 && mExpandedIds.Count >= mLimit; if (shouldCollapseOther) { long firstId = mExpandedIds[0]; int firstPosition = findPositionForId(firstId); View firstEV = getContentParent(firstPosition); if (firstEV != null) { ExpandCollapseHelper.animateCollapsing(firstEV); } mExpandedIds.Remove(firstId); if (mExpandCollapseListener != null) { mExpandCollapseListener.onItemCollapsed(firstPosition); } } long id = (long)contentParent.Tag; int position = findPositionForId(id); if (isVisible) { ExpandCollapseHelper.animateCollapsing(contentParent); mExpandedIds.Remove(id); if (mExpandCollapseListener != null) { mExpandCollapseListener.onItemCollapsed(position); } } else { ExpandCollapseHelper.animateExpanding(contentParent, mListViewWrapper); mExpandedIds.Add(id); if (mExpandCollapseListener != null) { mExpandCollapseListener.onItemExpanded(position); } } }
public void CollapseNode(int index) { LogText = "Index: " + index; try { RegisterEvent(ExpandCollapsePattern.ExpandCollapseStateProperty); SelectNode(index); AutomationElement retVal = GetSelectedNode(); ExpandCollapseHelper.Collapse(retVal); } catch (ProdOperationException err) { throw; } }
public void ExpandNode(string itemText) { LogText = "Item: " + itemText; try { RegisterEvent(ExpandCollapsePattern.ExpandCollapseStateProperty); SelectNode(itemText); AutomationElement retVal = GetSelectedNode(); ExpandCollapseHelper.Expand(retVal); } catch (ProdOperationException err) { throw; } }
/// <summary> /// Expands the menu item. /// </summary> /// <param name="menuItems">The menu items.</param> /// <param name="itemPath">The item path.</param> private static void ExpandMenuItem(AutomationElementCollection menuItems, string[] itemPath) { foreach (AutomationElement item in menuItems) { /* Expand top menu */ try { string name = item.Current.Name; if (string.Compare(name, itemPath[_ctr], true, CultureInfo.CurrentCulture) != 0) { continue; } if (CommonUIAPatternHelpers.CheckPatternSupport(ExpandCollapsePattern.Pattern, item) != null) { ExpandCollapseHelper.Expand(item); AutomationElementCollection items = GetChildMenuItems(item); _ctr++; ExpandMenuItem(items, itemPath); } if (CommonUIAPatternHelpers.CheckPatternSupport(InvokePattern.Pattern, item) == null) { return; } InvokePatternHelper.Invoke(item); } catch (InvalidOperationException err) { throw new ProdOperationException(err.Message, err); } catch (ElementNotAvailableException err) { throw new ProdOperationException(err.Message, err); } } }
/// <summary> /// Enumerates all nodes ion the TreeView and adds to a collection /// </summary> /// <param name = "aeRoot">The root tree node.</param> private void EnumControlElements(AutomationElement aeRoot) { while (aeRoot != null) { AllNodes.Add(aeRoot); _chk++; int ret = ExpandCollapseHelper.Expand(aeRoot); if (ret == -1) { ExpandCollapseHelper.Collapse(AllNodes[_treeIndex]); aeRoot = TreeWalker.ControlViewWalker.GetNextSibling(AllNodes[_treeIndex]); _treeIndex = _chk; } else { aeRoot = TreeWalker.ControlViewWalker.GetFirstChild(aeRoot); } EnumControlElements(aeRoot); aeRoot = null; } return; }
private static System.Windows.Automation.ExpandCollapseState UiaExpandCollapseState(BaseProdControl control) { return(ExpandCollapseHelper.ExpandCollapseState(control.UIAElement)); }
private static void UiaCollapse(BaseProdControl control) { ExpandCollapseHelper.Collapse(control.UIAElement); }