示例#1
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}'.");
            }
        }
示例#2
0
        /// <summary>
        /// Selects the workflow with the specified name from the default workflow menu.
        /// </summary>
        /// <param name="workflowName">The workflow name.</param>
        public void SelectWorkflow(string workflowName)
        {
            Widget groupWidget = _controlPanel.GetWidgets().Find("1.", StringMatch.StartsWith);

            _controlPanel.Press(groupWidget);

            // Wait for the workflows to load, then let it settle for a moment
            Wait.ForNotNull(() => _controlPanel.GetWidgets().Find("Workflow >", StringMatch.StartsWith), TimeSpan.FromSeconds(20));
            Thread.Sleep(TimeSpan.FromSeconds(2));
            Pacekeeper.Sync();

            // Find the workflow and select it
            WidgetCollection workflowWidgets = _controlPanel.GetWidgets().OfType(WidgetType.HelpListItem);
            string           workflowMatch   = StringMatcher.FindBestMatch(workflowName, workflowWidgets.Select(n => n.Text), StringMatch.Contains, ignoreCase: true);

            if (workflowMatch != null)
            {
                Widget workflow = _controlPanel.ScrollToItem("StringContent1", workflowMatch);
                _controlPanel.Press(workflow);
            }
            else
            {
                throw new DeviceWorkflowException($"Could not find workflow named '{workflowName}'.");
            }

            // Wait for the parameters to load, then let it settle for a moment
            _controlPanel.WaitForScreen(_workflowMain, TimeSpan.FromSeconds(20));
            Thread.Sleep(TimeSpan.FromSeconds(2));
            Pacekeeper.Sync();
        }
        private void EnterPromptValueLegacy(string prompt, string value)
        {
            // Get a list of the displayed fields and their corresponding text box controls
            Dictionary <string, string> fields = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            foreach (string label in _controlPanel.GetControls().Where(n => n.StartsWith("OxpDataEntryControl", StringComparison.OrdinalIgnoreCase) &&
                                                                       n.EndsWith("Label", StringComparison.OrdinalIgnoreCase)))
            {
                string labelText = RemoveWhiteSpace(_controlPanel.GetProperty(label, "Text").TrimStart('*'));
                string textBox   = label.Replace("_Label", "_TextBox");
                fields.Add(labelText, textBox);
            }

            string promptMatch = StringMatcher.FindBestMatch(prompt, fields.Keys, StringMatch.Contains, ignoreCase: true, ignoreWhiteSpace: true);

            if (promptMatch != null)
            {
                _controlPanel.PressToNavigate(fields[promptMatch], "OxpDataEntryKeyboardForm", ignorePopups: false);
                Pacekeeper.Pause();
                _controlPanel.TypeOnVirtualKeyboard("m_Keyboard", value);
                Pacekeeper.Sync();
                _controlPanel.PressToNavigate("ok", "OxpBaseForm", ignorePopups: false);
            }
            else
            {
                throw new DeviceWorkflowException($"Could not find workflow prompt '{prompt}'.");
            }
        }
示例#4
0
        /// <summary>
        /// Selects the folder quickset with the specified name.
        /// </summary>
        /// <param name="quicksetName">The quickset name.</param>
        public void SelectQuickset(string quicksetName)
        {
            WidgetCollection quicksetWidgets = _controlPanel.GetWidgets().OfType(WidgetType.HelpListItem);
            string           bestMatch       = StringMatcher.FindBestMatch(quicksetName, quicksetWidgets.Select(n => n.Text),
                                                                           StringMatch.StartsWith, ignoreCase: true, ignoreWhiteSpace: true, allowPartialMatch: true);

            if (bestMatch != null)
            {
                Widget quickset = _controlPanel.ScrollToItem("StringContent1", bestMatch);
                _controlPanel.Press(quickset);
                Pacekeeper.Sync();
            }
            else
            {
                throw new DeviceWorkflowException($"Could not find the quickset '{quicksetName}'.");
            }
        }