protected void InvokeValidationHandlers(List<Func<bool>> handlers) { DateTime expiration = DateTime.Now.Add(TimeSpan.FromSeconds(60)); bool authNotified = false; // Will only run the loop for one minute. If longer, then will break and an error will eventually be thrown while (!authNotified && (DateTime.Now < expiration)) { try { bool tempPopupHandled = _popupManager.HandleTemporaryPopup("Signing", TimeSpan.FromSeconds(15)); System.Diagnostics.Debug.WriteLine($"{DateTime.Now}: Popup with text 'Signing' found: {tempPopupHandled}."); authNotified = handlers.Any(n => n.Invoke() == true); // Give the device a break before looping back through the handler list if (!authNotified) { Thread.Sleep(250); } } catch (ElementNotFoundException) { // Did not find the element (Failed dialog, Sign In button, etc). Allow to continue checking. //System.Diagnostics.Debug.WriteLine(ex.ToString()); } catch (Exception) { // Some unknown error that we may want to look at during debug testing //System.Diagnostics.Debug.WriteLine(ex.ToString()); } } }
private bool ProcessNoStatusBanner(ScanExecutionOptions executionOptions) { if (_popupManager.WaitForPopup("Contacting Quota server", TimeSpan.FromSeconds(2))) { _popupManager.HandleTemporaryPopup("Contacting Quota server", TimeSpan.FromSeconds(30)); } _notificationPanel.WaitForNotDisplaying("Initiating job"); _notificationPanel.WaitForNotDisplaying("Pending"); RecordEvent(DeviceWorkflowMarker.ProcessingJobEnd); if (executionOptions.JobBuildSegments == 0) { RecordEvent(DeviceWorkflowMarker.ScanJobBegin); _notificationPanel.WaitForNotDisplaying(_idleTimeoutOffset, "Scanning"); RecordEvent(DeviceWorkflowMarker.ScanJobEnd); } return(MarkSendingJob(statusMsg: string.Empty)); }