public static OverwriteFileDialog Wait(VisualStudioApp app) { var hwnd = app.WaitForDialog(); Assert.AreNotEqual(IntPtr.Zero, hwnd, "Did not find OverwriteFileDialog"); var element = AutomationElement.FromHandle(hwnd); try { Assert.IsNotNull(element.FindFirst( TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "_allItems") ), "Not correct dialog - missing '_allItems'"); Assert.IsNotNull(element.FindFirst( TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "_yes") ), "Not correct dialog - missing '_yes'"); var res = new OverwriteFileDialog(app, element); element = null; return(res); } finally { if (element != null) { AutomationWrapper.DumpElement(element); } } }
public static AutomationDialog WaitForDialog(VisualStudioApp app) { return(new AutomationDialog(app, AutomationElement.FromHandle(app.WaitForDialog()))); }