예제 #1
0
        public static bool Click(AutomationElement element)
        {
            try
            {
                if (AutomationElement.IsInvokePatternAvailableProperty.In(element))
                {
                    element.As<InvokePattern>(InvokePattern.Pattern).Invoke();
                }
                else if (AutomationElement.IsTogglePatternAvailableProperty.In(element))
                {
                    element.AsTogglePattern().Toggle();
                }
                else if (AutomationElement.IsSelectionItemPatternAvailableProperty.In(element))
                {
                    element.AsSelectionItem().Select();
                }

                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return false;
            }
        }
예제 #2
0
        private static void SingleSelect(AutomationElement element)
        {
            var selectionItem = element.AsSelectionItem();

            try
            {
                Clicker.MouseClick(element);
            }
            catch { }

            if (!selectionItem.Current.IsSelected)
                selectionItem.Select();
        }
예제 #3
0
 private static bool IsSelected(AutomationElement tabItem)
 {
     return tabItem.AsSelectionItem().Current.IsSelected;
 }
예제 #4
0
 private static void MultipleSelect(AutomationElement element)
 {
     element.AsSelectionItem().AddToSelection();
 }
예제 #5
0
 private static bool IsSelected(AutomationElement element)
 {
     return element.AsSelectionItem().Current.IsSelected;
 }