/// <summary> /// Presses the panel button. /// </summary> /// <param name="btnTitle">Title of the button to be pressed</param> private void PressPanelButton(string btnTitle) { if (_engine.WaitForHtmlContains(btnTitle, DefaultScreenWait)) { // find the actual panel button to be pressed List <string> btnTitles = GetBtnTitles(_engine.GetBrowserHtml()); int buttonIdx = btnTitles.FindIndex(t => t.Equals(btnTitle)); Coordinate btnCoord = GetButtonCoordinates(btnTitles, buttonIdx); int footerPos = GetFooterTop("footerOXPd"); // the panel actually extends under the footer. In order to press the correct button // we need to scroll down so that it is visible. Coordinate scrollbar = GetScrollbarCoordinates(); // if the button y coordinate is below the footer, need to press the scroll down. while (btnCoord.Y > footerPos) { _controlPanel.PressScreen(scrollbar); btnCoord = GetButtonCoordinates(btnTitles, buttonIdx); } _controlPanel.PressScreen(btnCoord); } else { string msg = "Unknown HPCR folder requested, " + _scanDestination; UpdateStatus(msg); throw new DeviceWorkflowException(msg); } }
/// <summary> /// Monitors an executing job. /// </summary> /// <returns><c>true</c> if the job finishes (regardless of its ending status), <c>false</c> otherwise.</returns> public bool MonitorExecutingJob() { List <string> endingStatuses = new List <string>() { "Success", "Failed", "Partial Success", "Scheduled" }; string performanceMarker = string.Empty; var ctlrs = _controlPanel.GetControls(); int timeCount = 0; DateTime dt = DateTime.Now.AddSeconds(55); try { while (true) { string status = _controlPanel.GetProperty("mStatusTextLine1", "Text"); if (status != _lastStatus || string.IsNullOrEmpty(performanceMarker)) { performanceMarker = SetPerformanceMarker(performanceMarker, status); _lastStatus = status; } if (endingStatuses.Contains(status, StringComparer.OrdinalIgnoreCase)) { SetPerformanceMarkerEnd(performanceMarker); return(true); } else { Thread.Sleep(TimeSpan.FromMilliseconds(250)); } if (dt < DateTime.Now && timeCount < 4) { timeCount++; _controlPanel.PressScreen(5, 5); dt = DateTime.Now.AddSeconds(55); } } } catch (ControlNotFoundException) { // Return false to indicate that another dialog has appeared SetPerformanceMarkerEnd(performanceMarker); return(false); } }