예제 #1
0
    private bool IsElementVisible(AutomationElement elem)
    {
        try
        {
            AccessibilityState state = elem.Patterns.LegacyIAccessible.Pattern.State.Value;
            if (state.HasFlag(AccessibilityState.STATE_SYSTEM_INVISIBLE))
            {
                return(false);
            }

            return(true);
        }
        catch {}

        return(false);
    }
예제 #2
0
    private AutomationElement GetSelectedItem(AutomationElement current, DesktopManager desktop)
    {
        Thread.Sleep(136);

        AutomationElement[] items = GetListItemElements(desktop);
        foreach (AutomationElement item in items)
        {
            try
            {
                AccessibilityState state = item.Patterns.LegacyIAccessible.Pattern.State.Value;
                if (state.HasFlag(AccessibilityState.STATE_SYSTEM_SELECTED))
                {
                    if (item.Equals(current))
                    {
                        return(null);
                    }
                    return(item);
                }
            }
            catch { }
        }
        return(null);
    }