/// <summary> /// Selects all documents and presses the Print button. /// </summary> public void PrintAll() { SelectAllDocuments(string.Empty); Thread.Sleep(_pause); //Press the Print Button _controlPanel.Press("fb_footerRight"); Thread.Sleep(_pause); }
/// <summary> /// Checks device against list of known popup screens. If one is found, it is handled and message text returned. /// </summary> /// <returns>Handled message text. Empty string if no popup found.</returns> private string HandleKnownPopups(ScreenInfo screenInfo) { foreach (PopupHandlerMapItem item in _popupMap) { Widget popup = screenInfo.Widgets.FirstOrDefault(w => w.WidgetType == WidgetType.StaticText && w.Id == item.ScreenId); if (popup != null) { // Close the popup by pressing the button to move past the screen. _controlPanel.Press(item.ButtonId); return(item.HandledText); } } // Found no known popups return(string.Empty); }
/// <summary> /// Enters the name to use for the scanned file. /// </summary> /// <param name="fileName">The file name.</param> public void EnterFileName(string fileName) { try { if (_controlPanel.WaitForScreenLabel("Scan_NetworkFolder_HomeGlass")) { _controlPanel.Press("item2"); Pacekeeper.Pause(); _controlPanel.SetValue("slineedit", fileName); Pacekeeper.Pause(); _controlPanel.Press("_done"); Pacekeeper.Pause(); } Pacekeeper.Sync(); } catch (SiriusInvalidOperationException ex) { if (_controlPanel.GetScreenInfo().ScreenLabels.FirstOrDefault() == "Scan_Status_Error") { throw new DeviceWorkflowException("Error entering file name.", ex); } } }
/// <summary> /// Executes the currently configured scan job. /// </summary> /// <param name="executionOptions">The execution options.</param> /// <param name="appMainForm">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) { string documentType = string.Empty; try { // if (_controlPanel.GetScreenInfo().ScreenLabels.FirstOrDefault().Equals(appMainForm)) if (_controlPanel.WaitForScreenLabel(appMainForm)) { if (_controlPanel.WaitForWidget("fb_settings", _shortWaitTimeSpan) != null) { _controlPanel.Press("fb_settings"); Thread.Sleep(_shortWaitTimeSpan); } if (_controlPanel.GetScreenInfo().ScreenLabels.Contains("Scan_Glass_Settings") || _controlPanel.GetScreenInfo().ScreenLabels.Contains("Scan_ADF_Settings")) { //_controlPanel.Press("command.save_as"); ScreenInfo screen = _controlPanel.GetScreenInfo(); Widget widget = screen.Widgets.First(n => n.Id == "command.save_as"); if (widget.Values["secondarytext"] == "JPEG") { documentType = "JPEG"; } _controlPanel.PressKey(SiriusSoftKey.Back); Thread.Sleep(_shortWaitTimeSpan); } RecordEvent(DeviceWorkflowMarker.ScanJobBegin); _controlPanel.Press("fb_start_scan"); Thread.Sleep(_shortWaitTimeSpan); while (_controlPanel.WaitForScreenLabel("Scan_Status_Connecting", _shortWaitTimeSpan)) { //wait for this screen to get over Thread.Sleep(200); } while (_controlPanel.WaitForScreenLabel("Scan_Status_ScanningPage", _shortWaitTimeSpan)) { Thread.Sleep(200); } if (_controlPanel.GetScreenInfo().ScreenLabels.FirstOrDefault().Equals("Scan_Status_Error")) { string exceptionMessage = string.Empty; try { Widget controlInfo = _controlPanel.GetScreenInfo().Widgets.Find("text"); if (controlInfo != null) { exceptionMessage = controlInfo.Values.FirstOrDefault().Value; } } catch (Exception) { //ignore } throw new DeviceWorkflowException($"Scan Error occurred.{exceptionMessage}"); } ExecuteScan(executionOptions, appMainForm, documentType); RecordEvent(DeviceWorkflowMarker.ScanJobEnd); } CheckForScanError(); } catch (SiriusInvalidOperationException) { if (_controlPanel.GetScreenInfo().ScreenLabels.FirstOrDefault().Equals("Scan_Status_Error")) { Widget controlInfo = _controlPanel.GetScreenInfo().Widgets.Find("email_error_msg"); string message = "Cannot connect to server. Check server name and address."; if (controlInfo.HasValue(message)) { throw new DeviceWorkflowException($"Could not start job: {message}"); } } return(false); } return(true); }
/// <summary> /// Launches the Email application using the specified authenticator and authentication mode. /// </summary> /// <param name="authenticator">The authenticator.</param> /// <param name="authenticationMode">The authentication mode.</param> public void Launch(IAuthenticator authenticator, AuthenticationMode authenticationMode) { if (authenticationMode.Equals(AuthenticationMode.Lazy)) { try { _controlPanel.ScrollPress("sfolderview_p", "group.group.scan"); _controlPanel.WaitForScreenLabel("Home", _shortTimeSpan); //Scan To Page Pacekeeper.Pause(); _controlPanel.ScrollPress("sfolderview_p", "command.scan_email"); Pacekeeper.Pause(); if (!_controlPanel.WaitForScreenLabel("Scan_Email_EmailPageGlass", _shortTimeSpan)) { //if there are two sender's profile, we will have this intermediate screen which needs to be handled, selecting the first one as default if (_controlPanel.WaitForScreenLabel("Scan_Email_SenderProfile", _shortTimeSpan)) { _controlPanel.Press("model.ScanEmailProfilesModel.0"); Pacekeeper.Pause(); } if (_controlPanel.WaitForScreenLabel("AnA_Login_With_Windows_Authentication", _shortTimeSpan) || _controlPanel.WaitForScreenLabel("AnA_Login_With_LDAP_Authentication", _shortTimeSpan)) //Scan To Page { Pacekeeper.Pause(); } } if (_controlPanel.GetScreenInfo().ScreenLabels.FirstOrDefault() != "Scan_Email_EmailPageGlass") { if (authenticator == null) { throw new DeviceWorkflowException("Credentials are not supplied"); } authenticator.Authenticate(); } _controlPanel.WaitForScreenLabel("Scan_Email_EmailPageGlass", _longTimeSpan); //Email Form Pacekeeper.Pause(); } catch (ElementNotFoundException ex) { string currentForm = _controlPanel.GetScreenInfo().ScreenLabels.FirstOrDefault(); if (currentForm.Equals("Home")) { throw new DeviceWorkflowException($"Email application button was not found on device home screen.", ex); } else { throw new DeviceWorkflowException($"Cannot launch the Email application from {currentForm}.", ex); } } catch (SiriusInvalidOperationException ex) { switch (_controlPanel.GetScreenInfo().ScreenLabels.FirstOrDefault()) { case "Scan_Email_EmailPageGlass": // The application launched successfully. This happens sometimes. break; case "AnA_Login_With_Windows_Authentication;AnA_Login_With_LDAP_Authentication": { throw new DeviceWorkflowException($"Sign-in required to launch the Email application.", ex); } case "Scan_Email_NotSetup": { throw new DeviceWorkflowException("Scan To Email is not configured"); } default: { throw new DeviceWorkflowException($"Could not launch Email application: {ex.Message}", ex); } } } } else // AuthenticationMode.Eager { throw new NotImplementedException("Eager Authentication has not been implemented in SiriusUIv3EmailApp."); } }
/// <summary> /// Presses a button within an HPCR workflow. /// </summary> /// <param name="buttonTitle"></param> private void PressPanelButton(string buttonTitle) { UpdateStatus("Pressing button that starts with '{0}'", buttonTitle); _controlPanel.WaitForWidgetByValue(buttonTitle); _controlPanel.Press(_controlPanel.GetScreenInfo().Widgets.FindByValue(buttonTitle).Id); }