private async Task CompleteFieldIfMissing()

in CSharp/BotBuilderLocation/Dialogs/LocationRequiredFieldsDialog.cs [56:89]


        private async Task<bool> CompleteFieldIfMissing(IDialogContext context, string prompt, LocationRequiredFields field, string name, string value)
        {
            if (!this.requiredFields.HasFlag(field) || !string.IsNullOrEmpty(value))
            {
                return false;
            }

            string message;

            if (this.lastInput == null)
            {
                string formattedAddress = this.location.GetFormattedAddress(this.ResourceManager.AddressSeparator);
                if (string.IsNullOrWhiteSpace(formattedAddress))
                {
                    message = string.Format(this.ResourceManager.AskForEmptyAddressTemplate, prompt);
                }
                else
                {
                    message = string.Format(this.ResourceManager.AskForPrefix, formattedAddress) +
                        string.Format(this.ResourceManager.AskForTemplate, prompt);
                }
            }
            else
            {
                message = string.Format(this.ResourceManager.AskForPrefix, this.lastInput) +
                    string.Format(this.ResourceManager.AskForTemplate, prompt);
            }

            this.currentFieldName = name;
            await context.PostAsync(message);
            context.Wait(this.MessageReceivedAsync);

            return true;
        }