private async Task TryHandleSpecialCommandResponse()

in CSharp/BotBuilderLocation/Dialogs/LocationDialogBase.cs [114:156]


        private async Task<bool> TryHandleSpecialCommandResponse(IDialogContext context, LocationDialogResponse response)
        {
            if (response == null)
            {
                context.Done<T>(null);
                return true;
            }

            if (StringComparer.OrdinalIgnoreCase.Equals(response.Message, this.resourceManager.CancelCommand))
            {
                await context.PostAsync(this.ResourceManager.CancelPrompt);
                context.Done<T>(null);
                return true;
            }

            if (StringComparer.OrdinalIgnoreCase.Equals(response.Message, this.resourceManager.HelpCommand))
            {
                await context.PostAsync(this.ResourceManager.HelpMessage);
                context.Wait(this.MessageReceivedAsync);
                return true;
            }

            // If response is a reset, check whether this is the root dialog or not
            // if yes, claim it and rerun the start method, otherwise pass it up
            // to parent dialog to handle it.
            if (StringComparer.OrdinalIgnoreCase.Equals(response.Message, this.resourceManager.ResetCommand ))
            {
                if (this.IsRootDialog)
                {
                    await context.PostAsync(this.ResourceManager.ResetPrompt);
                    await this.StartAsync(context);
                }
                else
                {
                    context.Done(response);
                }

                return true;
            }

            // This is not a special command, return false.
            return false;
        }