/// <summary> Converts an inputType to an acr input type. </summary> /// <exception cref="ArgumentOutOfRangeException"> Thrown when one or more arguments are outside /// the required range. </exception> /// <param name="inputType"> Type of the input. </param> /// <returns> The given data converted to an acr input type. </returns> private AcrDialogs.InputType ConvertToAcrInputType(UserDialogInputType inputType) { switch (inputType) { case UserDialogInputType.Default: return(AcrDialogs.InputType.Default); //break; case UserDialogInputType.Email: return(AcrDialogs.InputType.Email); //break; case UserDialogInputType.Name: return(AcrDialogs.InputType.Name); //break; case UserDialogInputType.Number: return(AcrDialogs.InputType.Number); //break; case UserDialogInputType.DecimalNumber: return(AcrDialogs.InputType.DecimalNumber); //break; case UserDialogInputType.Password: return(AcrDialogs.InputType.Password); //break; case UserDialogInputType.NumericPassword: return(AcrDialogs.InputType.NumericPassword); //break; case UserDialogInputType.Phone: return(AcrDialogs.InputType.Phone); //break; case UserDialogInputType.Url: return(AcrDialogs.InputType.Url); //break; default: throw new ArgumentOutOfRangeException(nameof(inputType), inputType, null); } }
/// <summary> Prompt asynchronous. </summary> /// <param name="message"> The message. </param> /// <param name="title"> (Optional) The title. </param> /// <param name="okText"> (Optional) The ok text. </param> /// <param name="cancelText"> (Optional) The cancel text. </param> /// <param name="placeholder"> (Optional) The placeholder. </param> /// <param name="inputType"> (Optional) Type of the input. </param> /// <param name="cancelToken"> (Optional) The cancel token. </param> /// <returns> The asynchronous result that yields an UserDialogPromptResult. </returns> public async Task <UserDialogPromptResult> PromptAsync(string message, string title = null, string okText = null, string cancelText = null, string placeholder = "", UserDialogInputType inputType = UserDialogInputType.Default, CancellationToken?cancelToken = null) { AcrDialogs.PromptResult result = await AcrDialogs.UserDialogs.Instance.PromptAsync(message, title, okText, cancelText, placeholder, ConvertToAcrInputType(inputType), cancelToken); return(ConvertPromptResult(result)); }