/// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        internal SelectionItemPatternWrapper(AutomationElement element, string testSuite, TestPriorities priority, TypeOfControl typeOfControl, TypeOfPattern typeOfPattern, string dirResults, bool testEvents, IApplicationCommands commands)
            :
            base(element, testSuite, priority, typeOfControl, typeOfPattern, dirResults, testEvents, commands)
        {
            _pattern = (SelectionItemPattern)GetPattern(m_le, m_useCurrent, SelectionItemPattern.Pattern);
            if (_pattern == null)
                throw new Exception(Helpers.PatternNotSupported + ": SelectionItemPattern");

            _selectionContainer = _pattern.Current.SelectionContainer;

            if (_selectionContainer != null)
            {
                _selectionPattern = _selectionContainer.GetCurrentPattern(SelectionPattern.Pattern) as SelectionPattern;
                if (_selectionPattern == null)
                    throw new ArgumentException("Could not find the SelectionContainer's SelectionPattern");
            }

        }
Example #2
0
        public static bool TrySelectItem(this AutomationElement el)
        {
            object selectionItem;

            if (el.TryGetCurrentPattern(SelectionItemPattern.Pattern, out selectionItem))
            {
                try
                {
                    SelectionItemPattern item = (SelectionItemPattern)selectionItem;
                    item.Select();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
            return(false);
        }
Example #3
0
 public GuiComboBoxItem(AutomationElement item)
 {
     _cmbItem = item;
     _selection = _cmbItem.GetPattern<SelectionItemPattern>(SelectionItemPattern.Pattern);
 }
Example #4
0
 internal SelectionItemPatternInformation(SelectionItemPattern pattern, bool cache)
 {
     this.pattern = pattern;
     this.cache   = cache;
 }
Example #5
0
 private GuiTabItem(AutomationElement ti, string automationId)
 {
     Window = ti;
     _selection = Window.GetPattern<SelectionItemPattern>(SelectionItemPattern.Pattern);
     AutomationId = automationId;
 }
Example #6
0
 public void VerifyIsCurrentTab()
 {
     _selection = Window.GetPattern<SelectionItemPattern>(SelectionItemPattern.Pattern);
     Assert.IsTrue(_selection.Current.IsSelected);
 }
Example #7
0
			internal SelectionItemPatternInformation (SelectionItemPattern pattern, bool cache)
			{
				this.pattern = pattern;
				this.cache = cache;
			}
 /// -------------------------------------------------------------------
 /// <summary></summary>
 /// -------------------------------------------------------------------
 public SelectionItemTests(AutomationElement element, TestPriorities priority, string dirResults, bool testEvents, TypeOfControl typeOfControl, IApplicationCommands commands)
     :
     base(element, TestSuite, priority, typeOfControl, TypeOfPattern.SelectionItem, dirResults, testEvents, commands)
 {
     _pattern = (SelectionItemPattern)element.GetCurrentPattern(SelectionItemPattern.Pattern);
     if (_pattern == null)
         throw new Exception(Helpers.PatternNotSupported);
 }