示例#1
0
        /// <summary>
        /// Stays in a holding pattern with Hpec processes the job after scan.
        /// </summary>
        public bool ProcessJobAfterScan()
        {
            _controlPanel.WaitForValue(".hp-masthead-title:last", "innerText", OmniPropertyType.Property, "Processing...", StringMatch.Contains, TimeSpan.FromSeconds(3));

            // Doing the check here just in case the popup occurs first. This will save waiting 30 seconds for the notification panel to fail.
            if (_controlPanel.CheckState(".hp-popup-modal-overlay", OmniElementState.Exists))
            {
                ProcessScanError();
            }
            RecordEvent(DeviceWorkflowMarker.ProcessingJobBegin);
            if (_notificationPanel.WaitForState(OmniElementState.VisibleCompletely))
            {
                _notificationPanel.WaitForDisplaying("Processing...");
                _notificationPanel.WaitForNotDisplaying("Processing...");
            }
            else if (_controlPanel.CheckState(".hp-popup-modal-overlay", OmniElementState.Exists))
            {
                ProcessScanError();
            }

            _controlPanel.WaitForValue(".hp-masthead-title:last", "innerText", OmniPropertyType.Property, "Result", StringMatch.Contains, TimeSpan.FromSeconds(120));
            RecordEvent(DeviceWorkflowMarker.ProcessingJobEnd);

            if (!_engine.WaitForHtmlContains("Scanned pages", TimeSpan.FromSeconds(6)))
            {
                throw new DeviceWorkflowException("Unable to determine number of pages scanned.");
            }
            return(true);
        }
        private bool MarkSendingJob(string statusMsg)
        {
            bool completed = false;

            if (string.IsNullOrEmpty(statusMsg) || !statusMsg.Equals("Sending..."))
            {
                _notificationPanel.WaitForDisplaying(TimeSpan.FromSeconds(5), "Sending...");
                statusMsg = "Sending...";
            }

            if (!string.IsNullOrEmpty(statusMsg))
            {
                if (statusMsg == "Sending...")
                {
                    RecordEvent(DeviceWorkflowMarker.SendingJobBegin);
                    while (statusMsg == "Sending...")
                    {
                        statusMsg = _engine.ExecuteFunction("getStatusMessage").Trim('"');
                        Thread.Sleep(TimeSpan.FromMilliseconds(250));
                    }
                    RecordEvent(DeviceWorkflowMarker.SendingJobEnd);
                }
            }
            else
            {
                RecordEvent(DeviceWorkflowMarker.SendingJobBegin);
                completed = _masthead.WaitForActiveJobsButtonState(false, _idleTimeoutOffset);
                completed = _notificationPanel.WaitForNotDisplaying(_idleTimeoutOffset, "Sending...");
                RecordEvent(DeviceWorkflowMarker.SendingJobEnd);
            }
            statusMsg = _engine.ExecuteFunction("getStatusMessage").Trim('"');

            if (statusMsg.Contains("Job is successfully"))
            {
                completed = true;
            }
            else
            {
                throw new DeviceWorkflowException("Unknown DSS Workflow Status: '" + statusMsg + "'.");
            }
            return(completed);
        }