/// <summary> /// /// </summary> public void test(AT t) { try { AutomationElement aaa = GetTopLevelWindow(t.GetMe()); } catch (Exception ex) { throw new Exception("GetElementFromHwnd error. " + ex.Message); } }
/// <summary> /// /// </summary> /// <param name="elePara"></param> public WindowEvents(AT elePara) { this.elePara = elePara; try { WindowPattern = (WindowPattern)elePara.GetMe().GetCurrentPattern(WindowPattern.Pattern); } catch (Exception) { throw new Exception("Failed to get WindowEvents."); } }
/// <summary> /// /// </summary> /// <param name="elePara"></param> public ScrollEvents(AT elePara) { this.elePara = elePara; try { scrollPattern = (ScrollPattern)elePara.GetMe().GetCurrentPattern(ScrollPattern.Pattern); } catch (Exception) { //throw new Exception("Failed to get scrollable item."); } }
/// <summary> /// /// </summary> /// <returns></returns> public bool IsSelected() { try { SelectionItemPattern t = (SelectionItemPattern)elePara.GetMe().GetCurrentPattern(SelectionItemPattern.Pattern); return(t.Current.IsSelected); } catch (Exception ex) { throw new Exception(string.Format("Failed to get isSelected status. {0}", ex)); } }
/// <summary> /// /// </summary> /// <param name="elePara"></param> public CurrentElement(AT elePara) { this.elePara = elePara; this.current = elePara.GetMe().Current; }