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); }
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); }