/// <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."); } }
/// <summary> /// Selects the Optimize text or pitcure for the scanned file /// </summary> /// <param name="optimizeTextOrPicture">Selects the text or pitcure</param> public void SelectOptimizeTextOrPicture(OptimizeTextPic optimizeTextOrPicture) { ScrollToOption("CopyOptimizeTextPictureDialogButton"); if (_controlPanel.GetControls().Contains("CopyOptimizeTextPictureDialogButton")) { _controlPanel.PressWait("CopyOptimizeTextPictureDialogButton", "CopyOptimizeTextPictureDialog"); var controls = _controlPanel.GetControls().ToList(); if (controls.Contains("m_RadioButton")) { switch (optimizeTextOrPicture) { case OptimizeTextPic.Mixed: _controlPanel.Press("Mixed"); break; case OptimizeTextPic.Photo: _controlPanel.Press("Photo"); break; case OptimizeTextPic.Text: _controlPanel.Press("Text"); break; case OptimizeTextPic.Glossy: default: _controlPanel.Press("Glossy"); break; } _controlPanel.Press("m_OKButton"); } } }
private void ActivateViaSignIn(IAuthenticator authenticator) { if (_controlPanel.PressWait(JediWindjammerLaunchHelper.SIGNIN_BUTTON, JediWindjammerLaunchHelper.SIGNIN_FORM)) { Authenticate(authenticator, JediWindjammerLaunchHelper.HOMESCREEN_FORM); OnHomeScreen = true; } }
/// <summary> /// Sets the Orientation - Portrait or Landscape /// </summary> /// <param name="orientation">Orientation type set Potrait or Landscape </param> public void SetOrientation(ContentOrientation orientation) { ScrollToOption("CopyContentOrientationDialogButton"); _controlPanel.PressWait("CopyContentOrientationDialogButton", "ContentOrientationDialog", _waitTimeSpan); _controlPanel.Press(orientation.ToString().ToLower(CultureInfo.InvariantCulture)); _controlPanel.PressWait("m_OKButton", "CopyAppMainForm", _waitTimeSpan); }
/// <summary> /// Launches the Copy application using the specified authenticator, authentication mode, and quickset. /// </summary> /// <param name="authenticator">The authenticator.</param> /// <param name="authenticationMode">The authentication mode.</param> /// <param name="quickSetName">Name of the quick set.</param> public void LaunchFromQuickSet(IAuthenticator authenticator, AuthenticationMode authenticationMode, string quickSetName) { if (authenticationMode.Equals(AuthenticationMode.Eager)) { RecordEvent(DeviceWorkflowMarker.DeviceButtonPress, "Sign In"); _controlPanel.PressWait(JediWindjammerLaunchHelper.SIGNIN_BUTTON, JediWindjammerLaunchHelper.SIGNIN_FORM); Authenticate(authenticator, JediWindjammerLaunchHelper.HOMESCREEN_FORM); PressCopyWithQuickset(quickSetName); } else // AuthenticationMode.Lazy { if (PressCopyWithQuickset(quickSetName)) { // authentication required Authenticate(authenticator, "CopyAppMainForm"); } } }
/// <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); } }
private void AuthenticateWindjammer(string deviceIP, string userName) { IDevice device = DeviceFactory.Create(deviceIP, "!QAZ2wsx"); AuthenticationCredential credential = new AuthenticationCredential(userName, "1qaz2wsx", "etl.boi.rd.hpicorp.net"); JediWindjammerPreparationManager prepMgr = new JediWindjammerPreparationManager(((JediWindjammerDevice)device)); JediWindjammerControlPanel controlPanel = ((JediWindjammerDevice)device).ControlPanel; // Set up the device for Authentication //prepMgr.Reset(); controlPanel.PressWait(JediWindjammerLaunchHelper.SIGNIN_BUTTON, JediWindjammerLaunchHelper.SIGNIN_FORM); //IEnumerable<string> controls = controlPanel.GetControls(); //foreach (string s in controls) //{ // System.Diagnostics.Debug.WriteLine(s); //} IAuthenticator authenticator = AuthenticatorFactory.Create(device, credential, AuthenticationProvider.Auto); authenticator.Authenticate(); }
/// <summary> /// Sets the copy count. /// </summary> /// <param name="numCopies">The number copies.</param> public override void SetCopyCount(int numCopies) { LogDebug("Setting Copy count for Windjammer."); if (IsNewVersion()) { LogInfo("SafeComGo new version"); ProcessCopyCount(); } else { LogInfo("SafeCom server 2016 version"); ProcessCopyCount("buttonText"); } Thread.Sleep(1000); _controlPanel.Type(SpecialCharacter.Backspace); _controlPanel.Type(numCopies.ToString()); // The name of the OK button differs depending on the screen resolution string okButton = _controlPanel.GetControls().Contains("ok") ? "ok" : "mOkButton"; // moved to press wait to handle the no click event within five (5) seconds _controlPanel.PressWait(okButton, JediWindjammerLaunchHelper.OxpdFormIdentifier, StringMatch.Contains, TimeSpan.FromSeconds(6)); }
/// <summary> /// Executes the currently configured scan job. /// </summary> /// <param name="executionOptions">The execution options.</param> /// <param name="appMainForm">The name of the application main form.</param> /// <returns><c>true</c> if the job finishes (regardless of its ending status), <c>false</c> otherwise.</returns> public bool ExecuteScanJob(ScanExecutionOptions executionOptions, string appMainForm) { bool done = false; if (executionOptions == null) { throw new ArgumentNullException(nameof(executionOptions)); } try { if (executionOptions.JobBuildSegments > 1) { RecordEvent(DeviceWorkflowMarker.JobBuildBegin); } _controlPanel.PressToNavigate("mStartButton", "BaseJobStartPopup", ignorePopups: false); } catch (WindjammerInvalidOperationException) { if (_controlPanel.CurrentForm() == "ConflictDialog") { string message = _controlPanel.GetProperty("mDetailsBrowser", "PageContent"); throw new DeviceWorkflowException($"Could not start job: {message}"); } else { // Let it flow on through. It might be another dialog we can handle. } } while (!done) { string currentForm = _controlPanel.CurrentForm(); switch (currentForm) { case "BaseJobStartPopup": done = MonitorExecutingJob(); break; case "JobBuildPrompt": if (_jobBuildSegmentsScanned < executionOptions.JobBuildSegments) { _controlPanel.PressToNavigate("m_OKButton", "BaseJobStartPopup", ignorePopups: true); SetPerformanceMarker(DeviceWorkflowMarker.ScanJobBegin.GetDescription(), ""); _jobBuildSegmentsScanned++; } else { try { RecordEvent(DeviceWorkflowMarker.JobBuildEnd); _controlPanel.PressToNavigate("mFinishButton", "BaseJobStartPopup", ignorePopups: false); } catch (WindjammerInvalidOperationException) { // Do nothing - will loop back around and try to handle the dialog } } break; case "FlatbedAutoDetectPrompt": _controlPanel.PressToNavigate("m_OKButton", "BaseJobStartPopup", ignorePopups: true); break; case "AddressBookBatchAddDialog": // Could take us to either the BaseJobStartPopup screen or the FlatbedAutoDetectPrompt _controlPanel.PressWait("m_CancelButton", "BaseJobStartPopup", TimeSpan.FromSeconds(5)); break; case "HPProgressPopup": try { _controlPanel.WaitForForm("BaseJobStartPopup", ignorePopups: false); } catch (WindjammerInvalidOperationException) { // Do nothing - will loop back around and try to handle the dialog } break; default: if (currentForm == appMainForm) { // Sometimes the main form flashes in between other screens // Only return if the form stays steady for a few seconds if (!Wait.ForChange(_controlPanel.CurrentForm, appMainForm, TimeSpan.FromSeconds(3))) { done = true; } } else { return(done); } break; } } return(done); }
/// <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); } } }