private bool PressDssSolutionButton()
        {
            bool   promptedForCredentials = true;
            string appButton   = FindWorkflowAppButton();
            string desiredFrom = JediWindjammerLaunchHelper.OxpdBaseForm + "|" + JediWindjammerLaunchHelper.SIGNIN_FORM + "|" + JediWindjammerLaunchHelper.OxpdFormIdentifier + ".*";

            try
            {
                RecordEvent(DeviceWorkflowMarker.AppButtonPress, "DSS Workflow");
                _controlPanel.ScrollPressWait(JediWindjammerLaunchHelper.ScrollAccessPointDisplay, appButton, desiredFrom, StringMatch.Regex);

                string formName = _controlPanel.CurrentForm();

                if (formName.Equals(JediWindjammerLaunchHelper.OxpdBaseForm) || formName.Contains(JediWindjammerLaunchHelper.OxpdFormIdentifier))
                {
                    promptedForCredentials = false;
                    RecordEvent(DeviceWorkflowMarker.AppShown);
                }

                Pacekeeper.Pause();
            }
            catch (WindjammerInvalidOperationException ex)
            {
                string currentForm = _controlPanel.CurrentForm();
                desiredFrom = JediWindjammerLaunchHelper.OxpdBaseForm + "|" + JediWindjammerLaunchHelper.OxpdFormIdentifier + ".*";

                //"OxpBaseForm|OxpUIAppMainForm.*"

                if (StringMatcher.IsMatch(desiredFrom, currentForm, StringMatch.Regex, false))
                {
                    // The application launched without prompting for credentials.
                    RecordEvent(DeviceWorkflowMarker.AppShown);
                    Pacekeeper.Reset();
                    promptedForCredentials = false;
                }
                else
                {
                    switch (currentForm)
                    {
                    case "OneButtonMessageBox":
                    case "OxpDialogForm":
                        string message = _controlPanel.GetProperty("mMessageLabel", "Text");
                        throw new DeviceWorkflowException($"Could not launch Workflow application: {message}", ex);

                    default:
                        throw new DeviceWorkflowException($"Could not launch Workflow application: {ex.Message}", ex);
                    }
                }
            }

            return(promptedForCredentials);
        }
Esempio n. 2
0
        private bool PressSaveToUsbButton()
        {
            bool signInScreenLoaded = false;

            try
            {
                RecordEvent(DeviceWorkflowMarker.AppButtonPress, "Save To USB");
                signInScreenLoaded = _controlPanel.PressWait("SaveToUsb", "SignInForm", TimeSpan.FromSeconds(3));

                if (!signInScreenLoaded)
                {
                    if (!_controlPanel.WaitForForm(SAVE_TO_USB_FORM, TimeSpan.FromSeconds(3)))
                    {
                        throw new DeviceWorkflowException("Could not launch Save to USB application.");
                    }
                }
            }
            catch (ControlNotFoundException ex)
            {
                string currentForm = _controlPanel.CurrentForm();
                if (currentForm == "HomeScreenForm")
                {
                    throw new DeviceWorkflowException("Copy application button was not found on device home screen.", ex);
                }
                else
                {
                    throw new DeviceWorkflowException($"Cannot launch the Save to USB application from {currentForm}.", ex);
                }
            }
            catch (WindjammerInvalidOperationException ex)
            {
                switch (_controlPanel.CurrentForm())
                {
                case SAVE_TO_USB_FORM:
                    // The application launched without prompting for credentials.
                    RecordEvent(DeviceWorkflowMarker.AppShown);
                    Pacekeeper.Reset();
                    return(false);

                case "OneButtonMessageBox":
                    string message = _controlPanel.GetProperty("mMessageLabel", "Text");
                    throw new DeviceWorkflowException($"Could not launch Copy application: {message}", ex);

                default:
                    throw new DeviceWorkflowException($"Could not launch Copy application: {ex.Message}", ex);
                }
            }
            return(signInScreenLoaded);
        }