SelectionItemPattern(
     AutomationElement element,
     IUIAutomationSelectionItemPattern selectionItemPattern)
     : base(el: element)
 {
     this._selectionItemPattern = selectionItemPattern;
 }
Exemplo n.º 2
0
        public bool IsSelected()
        {
            object obj;

            pElement.GetCurrentPattern(UIA_SelectionItemPatternId, out obj);
            try {
                if (obj == null)
                {
                    return(false);
                }
                IUIAutomationSelectionItemPattern selprov = obj as IUIAutomationSelectionItemPattern;
                bool ret;
                selprov.get_CurrentIsSelected(out ret);
                return(ret);
            }
            catch (COMException) {
                return(false);
            }
            finally {
                if (obj != null)
                {
                    Marshal.ReleaseComObject(obj);
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// SelectionItemPattern.Select method. Used for Radio Buttons, Tabs so far.
 /// </summary>
 /// <param name="element"></param>
 /// <returns></returns>
 public static IUIAutomationElement xtSelectItem(this IUIAutomationElement element)
 {
     _SelectionItemPattern = (IUIAutomationSelectionItemPattern)element.GetCurrentPattern(UIA_PatternIds.UIA_SelectionItemPatternId);
     if (!element.xtIsItemSelected())
     {
         _SelectionItemPattern.Select();
     }
     return(element);
 }
Exemplo n.º 4
0
        protected override void Dispose(bool disposing)
        {
            if (Pattern != null)
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(Pattern);
                this.Pattern = null;
            }

            base.Dispose(disposing);
        }
 private SelectionItemPattern(AutomationElement el, IUIAutomationSelectionItemPattern pattern, bool cached)
     : base(el, cached)
 {
     Debug.Assert(pattern != null);
     this._pattern = pattern;
 }
 internal static SelectionItemPattern Wrap(
     AutomationElement element,
     IUIAutomationSelectionItemPattern selectionItemPattern)
 {
     return(new SelectionItemPattern(element: element, selectionItemPattern: selectionItemPattern));
 }
Exemplo n.º 7
0
 public UiAutomationSelectHint(IntPtr owningWindow, IUIAutomationSelectionItemPattern selectPattern, Rect boundingRectangle)
     : base(owningWindow, boundingRectangle)
 {
     _selectPattern = selectPattern;
 }
Exemplo n.º 8
0
        public SelectionItemPattern(A11yElement e, IUIAutomationSelectionItemPattern p) : base(e, PatternType.UIA_SelectionItemPatternId)
        {
            Pattern = p;

            PopulateProperties();
        }
 public SelectionItemPattern(IUIAutomationElement element, bool canSelectMultiple = false)
 {
     _canSelectMultiple    = canSelectMultiple;
     _selectionItemPattern =
         element.GetCurrentPattern(UIA_PatternIds.UIA_SelectionItemPatternId) as IUIAutomationSelectionItemPattern;
 }
Exemplo n.º 10
0
 public static bool xtIsItemSelected(this IUIAutomationElement element)
 {
     _SelectionItemPattern = (IUIAutomationSelectionItemPattern)element.GetCurrentPattern(UIA_PatternIds.UIA_SelectionItemPatternId);
     return(_SelectionItemPattern.CurrentIsSelected == 1); // CurrentIsSelected returns int 0 or 1 for binary true/false
 }