示例#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;
 }