private bool NeedToSwipe(string buttonId) { bool swipeNeeded = false; BoundingBox panel = _engine.GetBoundingAreaById("HPOXPd-options-list-panel"); BoundingBox button = _engine.GetBoundingAreaById(buttonId); if (_controlPanel.GetScreenSize().Width.Equals(480)) { Coordinate pl = new Coordinate(panel.Left, panel.Top); Size ps = new Size(panel.Width, 270); panel = new BoundingBox(pl, ps); } if ((panel.Bottom < button.Bottom) || (panel.Top > button.Top)) { swipeNeeded = true; if (panel.Bottom < button.Bottom) { SwipeOptionPanelUp(); } else { SwipeOptionPanelDown(); } swipeNeeded = NeedToSwipe(buttonId); } return(swipeNeeded); }
/// <summary> /// Presses the given control. /// </summary> /// <param name="objectId">string</param> private void PressElement(string objectId) { BoundingBox boundingBox = _engine.GetBoundingAreaById(objectId); if (boundingBox.Left == 0 && boundingBox.Right == 0) { boundingBox = _engine.GetBoundingAreaById(objectId); } _engine.PressElementByBoundingArea(boundingBox); }
/// <summary> /// Enters credentials on the device by entering the PIN. /// </summary> public override void EnterCredentials() { string codeTextboxId = (_hpacVersion16_6 == true) ? _codeTextBox[1] : _codeTextBox[0]; BoundingBox box = _engine.GetBoundingAreaById(codeTextboxId); _engine.PressElementByBoundingArea(box); ControlPanel.Type(Credential.Pin); ControlPanel.WaitForControl("ok", TimeSpan.FromSeconds(5)); ControlPanel.Press("ok"); }
private Coordinate GetButtonCoordinates(string buttonId, int cntBtnTitles, int buttonIdx) { BoundingBox boundingBox = _engine.GetBoundingAreaById(buttonId); // middle of the table containing the folder buttons int coordX = boundingBox.Width / 2 + boundingBox.Left; int folderHgt = boundingBox.Height / cntBtnTitles; int coordY = boundingBox.Top + (folderHgt / 2) + (buttonIdx * folderHgt) + _yOffset; return(new Coordinate(coordX, coordY)); }
/// <summary> /// Gets the scrollbar coordinates. /// </summary> /// <returns>Coordinate</returns> private Coordinate GetScrollbarCoordinates() { BoundingBox table = _engine.GetBoundingAreaById("scrollingContent"); BoundingBox div = _engine.GetBoundingAreaById("scrollingPanel"); int scrollBarWidth = div.Right - table.Right; int scrollBarCenter = scrollBarWidth / 2 + table.Right; // Move the y coordinate to about the middle of the down arrow. // the button for the arrows have a height around 40 pixels. return(new Coordinate(scrollBarCenter, div.Bottom + _yOffset - 25)); }
/// <summary> /// Finds a valid element in the specified element list and presses it using the OxpdBrowserEngine. /// </summary> /// <param name="elementIds"></param> protected void PressElementOxpd(List <string> elementIds) { OxpdBrowserEngine engine = new OxpdBrowserEngine(ControlPanel); BoundingBox boundingBox = new BoundingBox(); for (int i = 0; i < elementIds.Count; i++) { try { boundingBox = engine.GetBoundingAreaById(elementIds[i]); break; // Found the element so stop iterating the list } catch (DeviceWorkflowException) { if (i == elementIds.Count - 1) { //If this is the last element, rethrow the exception throw; } } } engine.PressElementByBoundingArea(boundingBox); }