コード例 #1
0
 SelectionItemPattern(
     AutomationElement element,
     IUIAutomationSelectionItemPattern selectionItemPattern)
     : base(el: element)
 {
     this._selectionItemPattern = selectionItemPattern;
 }
コード例 #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);
                }
            }
        }
コード例 #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);
 }
コード例 #4
0
        protected override void Dispose(bool disposing)
        {
            if (Pattern != null)
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(Pattern);
                this.Pattern = null;
            }

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

            PopulateProperties();
        }
コード例 #9
0
 public SelectionItemPattern(IUIAutomationElement element, bool canSelectMultiple = false)
 {
     _canSelectMultiple    = canSelectMultiple;
     _selectionItemPattern =
         element.GetCurrentPattern(UIA_PatternIds.UIA_SelectionItemPatternId) as IUIAutomationSelectionItemPattern;
 }
コード例 #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
 }