コード例 #1
0
        public string GetErrorMessage()
        {
            var loginScreen = GetLoginScreen();
            var errorLabel  = DelegateExtensions.ExecuteWithResult(() =>
                                                                   loginScreen.Get <Label>(SearchCriteria.ByAutomationId("Login_FailureTextBlock")), r => r.Text,
                                                                   new[] { null, string.Empty });

            return(errorLabel.Text);
        }
コード例 #2
0
        internal Window GetShell()
        {
            var application = ApplicationContext.Application;
            var shellScreen =
                DelegateExtensions.ExecuteWithResult(
                    () => application.GetWindow(SearchCriteria.ByAutomationId("Shell_Window"), InitializeOption.NoCache));

            shellScreen.WaitWhileBusy();
            return(shellScreen);
        }
コード例 #3
0
        internal Window GetShell()
        {
            var application = ApplicationContext.Application;

            application.WaitWhileBusy();
            using (var automation = new UIA3Automation())
            {
                var shellScreen =
                    DelegateExtensions.ExecuteWithResult(
                        () => application.GetAllTopLevelWindows(automation)
                        .FirstOrDefault(t => t.Properties.AutomationId == "Shell_Window"));
                return(shellScreen);
            }
        }