Пример #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());
        }
Пример #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);
        }
Пример #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);
        }
Пример #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;
 }
Пример #6
0
 protected BasicAutomationElementBase(AutomationBase automation)
 {
     Automation = automation;
 }
 protected BasicAutomationElementBase(AutomationBase automation)
 {
     Automation = automation;
     Properties = new AutomationElementPropertyValues(this);
 }