예제 #1
0
        private static bool ArePromptLocationsCorrect(WidgetCollection widgets)
        {
            WidgetCollection prompts = widgets.OfType(WidgetType.Prompt);
            int distinctLocations    = prompts.Select(n => n.Location).Distinct().Count();

            return(distinctLocations == prompts.Count);
        }
예제 #2
0
        private static bool AreTextBoxLocationsCorrect(WidgetCollection widgets)
        {
            WidgetCollection textBoxes = widgets.OfType(WidgetType.EditBox);
            int distinctLocations      = textBoxes.Select(n => n.Location).Distinct().Count();

            return(distinctLocations == textBoxes.Count);
        }
예제 #3
0
        /// <summary>
        /// Enters the specified value for the specified workflow prompt.
        /// </summary>
        /// <param name="prompt">The prompt.</param>
        /// <param name="value">The value.</param>
        public void EnterPromptValue(string prompt, string value)
        {
            WidgetCollection     widgets = _controlPanel.GetWidgets();
            IEnumerable <string> prompts = widgets.OfType(WidgetType.Prompt).Select(n => n.Text);

            // Find the text box for the prompt and press it to navigate to the keyboard screen
            string promptMatch = StringMatcher.FindBestMatch(prompt, prompts, StringMatch.Contains, ignoreCase: true, ignoreWhiteSpace: true);

            if (promptMatch != null)
            {
                Widget label = widgets.Find(promptMatch);
                PressPrompt(widgets, label);
                _controlPanel.WaitForScreen(_workflowKeyboard, TimeSpan.FromSeconds(5));
                Pacekeeper.Sync();

                // Enter the parameter text, then navigate back to the parameter screen
                _controlPanel.TypeOnVirtualKeyboard(value);
                Pacekeeper.Sync();
                _controlPanel.Press("OK");
                _controlPanel.WaitForScreen(_workflowMain, TimeSpan.FromSeconds(5));
                Pacekeeper.Sync();
            }
            else
            {
                throw new DeviceWorkflowException($"Could not find workflow prompt '{prompt}'.");
            }
        }