/// <summary> /// Set Filename of scan output /// </summary> /// <param name="fileName">File name to set</param> /// <param name="resourceId">Ui selector resource id to insput file name</param> public void SetFileName(string fileName, string resourceId = null) { if (!_controller.DoesScreenContains(new UiSelector().ResourceId($"{_packageName}:id/bt_hide_options"))) { throw new DeviceWorkflowException("App screen is not on the option setting"); } if ("Hide Options".Equals(_controller.GetText(new UiSelector().ResourceId($"{_packageName}:id/bt_hide_options")))) { _controller.Click(new UiSelector().ResourceId($"{_packageName}:id/bt_hide_options")); } if (System.String.IsNullOrEmpty(resourceId)) { if (!_controller.SetText(new UiSelector().ResourceId($"{_packageName}:id/editTextDescription"), fileName)) { throw new DeviceWorkflowException($"File name setting failed to {fileName}"); } } else { if (!_controller.SetText(new UiSelector().ResourceId($"{_packageName}:id/{resourceId}"), fileName)) { throw new DeviceWorkflowException($"File name setting failed to {fileName}"); } } }
/// <summary> /// Set file name /// </summary> /// <param name="fileName">file name to set</param> public void SetFileName(string fileName) { if (!string.IsNullOrEmpty(fileName)) { if (!_controller.DoesScreenContains(new UiSelector().ResourceId($"{_packageName}:id/scan_fileName_input"))) { throw new DeviceWorkflowException($"Can not find control for scan to usb job :: file name"); } if (!_controller.SetText(new UiSelector().ResourceId($"{_packageName}:id/scan_fileName_input"), fileName)) { throw new DeviceWorkflowException($"Can not set file name :: {fileName}"); } Thread.Sleep(2000); _linkUI.Controller.PressKey(KeyCode.KEYCODE_BACK); } }
/// <summary> /// Set number of coipes for print /// </summary> /// <param name="copies">number of copies</param> public void SetNumberOfCopies(int copies) { if (!_controller.DoesScreenContains(new UiSelector().ResourceId($"{_packageName}:id/et_number_of_copies"))) { throw new DeviceWorkflowException("Can not find contorl :: Number of copies"); } bool result = true; result = _controller.SetText(new UiSelector().ResourceId($"{_packageName}:id/et_number_of_copies"), copies.ToString()); if (!result) { throw new DeviceWorkflowException($"Can not set option :: Number of copies to {copies}"); } }
/// <summary>Returns if the given resource identifier exists.</summary> /// <param name="resourceId">The resource identifier.</param> /// <returns>boolean</returns> public bool ExistResourceId(string resourceId) { return(_controller.DoesScreenContains(new UiSelector().ResourceId(resourceId))); }
public void CloseApp() { int count = 0; _mobile.SetTimeout(1); while (!_mobile.DoesScreenContains(new UiSelector().ResourceId("com.printeron.droid.phone:id/main_entry_function_panel"))) { _mobile.PressKey(4); count++; if (count > 5) { _mobile.ExecuteADBCommand($"shell am force-stop {PACKAGE_NAME}"); _mobile.SetTimeout(DEFAULT_TIMEOUT); return; } } _mobile.SetTimeout(DEFAULT_TIMEOUT); _mobile.PressKey(4); }