Ejemplo n.º 1
0
        /// <summary>
        /// Gets all top level windows from the application
        /// </summary>
        public Window[] GetAllTopLevelWindows(AutomationBase automation)
        {
            var desktop       = automation.GetDesktop();
            var foundElements = desktop.FindAllChildren(cf => cf.ByControlType(ControlType.Window).And(cf.ByProcessId(ProcessId)));

            return(foundElements.Select(x => x.AsWindow()).ToArray());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the main window of the application's process
        /// </summary>
        public Window GetMainWindow(AutomationBase automation)
        {
            var mainWindow = automation.FromHandle(MainWindowHandle).AsWindow();

            if (mainWindow != null)
            {
                mainWindow.IsMainWindow = true;
            }
            return(mainWindow);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the main window of the application's process
        /// </summary>
        /// <param name="automation">The automation object to use.</param>
        /// <param name="waitTimeout">An optional timeout. If null is passed, the timeout is infinite.</param>
        /// <returns>The main window object as <see cref="Window" /> or null if no main window was found within the timeout.</returns>
        public Window GetMainWindow(AutomationBase automation, TimeSpan?waitTimeout = null)
        {
            WaitWhileMainHandleIsMissing(waitTimeout);
            var mainWindowHandle = MainWindowHandle;

            if (mainWindowHandle == IntPtr.Zero)
            {
                return(null);
            }
            var mainWindow = automation.FromHandle(mainWindowHandle).AsWindow();

            if (mainWindow != null)
            {
                mainWindow.IsMainWindow = true;
            }
            return(mainWindow);
        }
Ejemplo n.º 4
0
 public Window GetMainWindow(AutomationBase automation)
 {
     return(automation.FromHandle(MainWindowHandle).AsWindow());
 }
 /// <summary>
 /// Create a framework automation element with the given <see cref="AutomationBase"/>.
 /// </summary>
 /// <param name="automation">The <see cref="AutomationBase"/>.</param>
 protected FrameworkAutomationElementBase(AutomationBase automation)
 {
     Automation = automation;
 }
Ejemplo n.º 6
0
 protected BasicAutomationElementBase(AutomationBase automation)
 {
     Automation = automation;
 }
 protected BasicAutomationElementBase(AutomationBase automation)
 {
     Automation = automation;
     Properties = new AutomationElementPropertyValues(this);
 }