/// <summary>
        /// Launches Equitrac with the specified authenticator using the given authentication mode
        /// </summary>
        /// <param name="authenticator">The authenticator.</param>
        /// <param name="authenticationMode">The authentication mode, eager or lazy.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        public override void Launch(IAuthenticator authenticator, AuthenticationMode authenticationMode)
        {
            bool communicateSuccess = false;

            if (authenticationMode.Equals(AuthenticationMode.Eager))
            {
                if (authenticator.Provider != AuthenticationProvider.Card)
                {
                    RecordEvent(DeviceWorkflowMarker.DeviceButtonPress, "Sign In");
                    _controlPanel.PressWait(JediWindjammerLaunchHelper.SIGNIN_BUTTON, JediWindjammerLaunchHelper.SIGNIN_FORM);
                }
                Authenticate(authenticator, JediWindjammerLaunchHelper.HOMESCREEN_FORM);

                RecordEvent(DeviceWorkflowMarker.AppButtonPress, "Equitrac " + SolutionButtonTitle);
                communicateSuccess = _controlPanel.ScrollPressWait("mAccessPointDisplay", "Title", SolutionButtonTitle, JediWindjammerLaunchHelper.OxpdFormIdentifier, StringMatch.Contains, TimeSpan.FromSeconds(50));
            }
            else // AuthenticationMode.Lazy
            {
                RecordEvent(DeviceWorkflowMarker.AppButtonPress, "Equitrac " + SolutionButtonTitle);
                if (_controlPanel.ScrollPressWait("mAccessPointDisplay", "Title", SolutionButtonTitle, JediWindjammerLaunchHelper.SIGNIN_FORM, TimeSpan.FromSeconds(50)) == true)
                {
                    communicateSuccess = Authenticate(authenticator, JediWindjammerLaunchHelper.OxpdFormIdentifier);
                }
            }

            if (!communicateSuccess)
            {
                throw new DeviceCommunicationException("Unable to communicate with the Equitrac server within 50 seconds.");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Launches Blueprint with the specified authenticator using the given authentication mode
        /// </summary>
        /// <param name="authenticator">The authenticator.</param>
        /// <param name="authenticationMode">The authentication mode, eager or lazy.</param>
        public override void Launch(IAuthenticator authenticator, AuthenticationMode authenticationMode)
        {
            if (authenticationMode.Equals(AuthenticationMode.Eager))
            {
                RecordEvent(DeviceWorkflowMarker.DeviceButtonPress, "Sign In");
                _controlPanel.PressWait(JediWindjammerLaunchHelper.SIGNIN_BUTTON, JediWindjammerLaunchHelper.SIGNIN_FORM);
                Authenticate(authenticator, JediWindjammerLaunchHelper.HOMESCREEN_FORM);

                RecordEvent(DeviceWorkflowMarker.AppButtonPress, SolutionButtonTitle);
                _controlPanel.ScrollPressWait("mAccessPointDisplay", "Title", SolutionButtonTitle, JediWindjammerLaunchHelper.OxpdFormIdentifier, StringMatch.Contains, TimeSpan.FromSeconds(30));
            }
            else // AuthenticationMode.Lazy
            {
                RecordEvent(DeviceWorkflowMarker.AppButtonPress, SolutionButtonTitle);
                _controlPanel.ScrollPressWait("mAccessPointDisplay", "Title", SolutionButtonTitle, JediWindjammerLaunchHelper.SIGNIN_FORM, TimeSpan.FromSeconds(30));
                Authenticate(authenticator, JediWindjammerLaunchHelper.OxpdFormIdentifier);
            }
        }
        /// <summary>
        /// Presses the copy with quickset.
        /// </summary>
        /// <param name="quickSetName">Name of the quick set.</param>
        /// <returns></returns>
        /// <exception cref="DeviceWorkflowException">
        /// Could not launch copy application.
        /// or
        /// Copy application button was not found on device home screen.
        /// or
        /// or
        /// or
        /// </exception>
        private bool PressCopyWithQuickset(string quickSetName)
        {
            bool signInScreenLoaded;

            try
            {
                if (!string.IsNullOrEmpty(quickSetName))
                {
                    if (ExistQuickSetButton(quickSetName))
                    {
                        // on a front page
                        signInScreenLoaded = _controlPanel.ScrollPressWait("mAccessPointDisplay", "Title", quickSetName, JediWindjammerLaunchHelper.SIGNIN_FORM, TimeSpan.FromSeconds(7));
                    }
                    else // in the quickset folder
                    {
                        _controlPanel.PressToNavigate("NLevelApp", "NLevelHomeScreenForm", true);
                        signInScreenLoaded = _controlPanel.PressWait(quickSetName, "SignInForm", TimeSpan.FromSeconds(7));
                    }
                }
                else
                {
                    signInScreenLoaded = _controlPanel.PressWait("CopyApp", "SignInForm", TimeSpan.FromSeconds(1));
                }
                if (!signInScreenLoaded)
                {
                    if (!_controlPanel.WaitForForm("CopyAppMainForm", TimeSpan.FromSeconds(3)))
                    {
                        throw new DeviceWorkflowException("Could not launch copy application.");
                    }
                }
                RecordEvent(DeviceWorkflowMarker.QuickSetListReady);
            }
            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 Copy application from {currentForm}.", ex);
                }
            }
            catch (WindjammerInvalidOperationException ex)
            {
                switch (_controlPanel.CurrentForm())
                {
                case "CopyAppMainForm":
                    // 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);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Launches The Hpcr solution with the given authenticator with either eager or lazy authentication.
        /// </summary>
        /// <param name="authenticator">The authenticator.</param>
        /// <param name="authenticationMode">The authentication mode.</param>
        /// <exception cref="System.ArgumentNullException">authenticator</exception>
        /// <exception cref="DeviceWorkflowException">Application button was not found on device home screen.</exception>
        /// <exception cref="DeviceInvalidOperationException">
        /// </exception>
        public override void Launch(IAuthenticator authenticator, AuthenticationMode authenticationMode)
        {
            if (authenticator == null)
            {
                throw new ArgumentNullException(nameof(authenticator));
            }

            // Press the desired HPCR Button type
            try
            {
                if (authenticationMode.Equals(AuthenticationMode.Eager))
                {
                    UpdateStatus("Pressing {0}", JediWindjammerLaunchHelper.SIGNIN_BUTTON);
                    RecordEvent(DeviceWorkflowMarker.DeviceButtonPress, "Sign In");
                    _controlPanel.PressWait(JediWindjammerLaunchHelper.SIGNIN_BUTTON, JediWindjammerLaunchHelper.SIGNIN_FORM);
                    Authenticate(authenticator, JediWindjammerLaunchHelper.HOMESCREEN_FORM);

                    UpdateStatus("Pressing {0}", _buttonTitle);
                    RecordEvent(DeviceWorkflowMarker.AppButtonPress, "HPCR " + _buttonTitle);
                    _controlPanel.ScrollPressWait("mAccessPointDisplay", "Title", _buttonTitle, JediWindjammerLaunchHelper.OxpdFormIdentifier, StringMatch.Contains, TimeSpan.FromSeconds(30));
                }
                else // AuthenticationMode.Lazy
                {
                    UpdateStatus("Pressing {0}", _buttonTitle);
                    RecordEvent(DeviceWorkflowMarker.AppButtonPress, "HPCR " + _buttonTitle);
                    _controlPanel.ScrollPressWait("mAccessPointDisplay", "Title", _buttonTitle, JediWindjammerLaunchHelper.SIGNIN_FORM, TimeSpan.FromSeconds(30));
                    Authenticate(authenticator, JediWindjammerLaunchHelper.OxpdFormIdentifier);
                }
                RecordEvent(DeviceWorkflowMarker.AppShown);
            }
            catch (ControlNotFoundException ex)
            {
                string currentForm = _controlPanel.CurrentForm();
                if (currentForm == "HomeScreenForm")
                {
                    throw new DeviceWorkflowException("The HPCR application button was not found on device home screen.", ex);
                }
                else
                {
                    throw new DeviceInvalidOperationException(string.Format("Could not launch the HPCR application from {0}.", currentForm), ex);
                }
            }
            catch (WindjammerInvalidOperationException ex)
            {
                var currentForm = _controlPanel.CurrentForm();
                if (currentForm.StartsWith(JediWindjammerLaunchHelper.OxpdFormIdentifier, StringComparison.OrdinalIgnoreCase))
                {
                    // The application launched without prompting for credentials.
                }

                switch (currentForm)
                {
                case "OneButtonMessageBox":
                    string message = _controlPanel.GetProperty("mMessageLabel", "Text");
                    throw new DeviceInvalidOperationException(string.Format("Could not launch the HPCR application: {0}", message), ex);

                default:
                    throw new DeviceInvalidOperationException(string.Format("Could not launch the HPCR application: {0}", ex.Message), ex);
                }
            }
        }