/// <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); } }
private void EnterUserName() { UiSelector userNameSelector = new UiSelector().ResourceId("username"); string userNametext = _controller.GetText(userNameSelector); if (string.IsNullOrEmpty(userNametext)) { OnStatusUpdate("Enter user name."); if (!_controller.SetText(userNameSelector, Credential.UserName)) { throw new DeviceWorkflowException("Failed to enter user name."); } } UiSelector rememberSelector = new UiSelector().ResourceId("RememberMe"); if (!_controller.IsChecked(rememberSelector)) { OnStatusUpdate("Set 'Remember Me' checkbox."); _controller.Click(rememberSelector); } }
/// <summary> /// Click Print Button /// </summary> public void Print() { if (!_mobile.Click(new UiSelector().ResourceId("com.printeron.droid.phone:id/print_action_print_button"))) { throw new MobileWorkflowException("Can not click Print button"); } if (!string.IsNullOrEmpty(_name)) { _mobile.SetText(new UiSelector().ResourceId("com.printeron.droid.phone:id/fragment_print_job_accounting_network_login_edit"), _name); } if (!string.IsNullOrEmpty(_email)) { _mobile.SetText(new UiSelector().ResourceId("com.printeron.droid.phone:id/fragment_print_job_accounting_email_address_edit"), _email); } if (!_mobile.Click(new UiSelector().ResourceId("com.printeron.droid.phone:id/fragment_print_setting_button_ok"))) { throw new MobileWorkflowException("Can not file OK button at Print option popup"); } }
/// <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}"); } }