示例#1
0
        private async Task <bool> ProcessValidationResponseAsync(ValidationResponse response, Func <ValidationResponse, Task <bool> > getConfirmation)
        {
            if (response.HasError)
            {
                this.Output = response.Message;
                return(await getConfirmation(response));
            }

            return(true);
        }
示例#2
0
        private async Task <ValidationResponse> CheckSentimentAsync()
        {
            this.Output = "Evaluating tweet sentiment...";

            var sentiment = await _cognitiveService.GetSentimentAnalysisAsync(this.Tweet);

            var isOK = sentiment >= this.Settings.Text.NegativeSentimentThreshold;

            this.Output = $"Your text sentiment score is {sentiment:P2}! {(isOK ? PositiveEmoji : NegativeEmoji)}";

            var result = new ValidationResponse
            {
                HasError = !isOK,
                Message  = isOK ? string.Empty : NegativeSentimentMessage
            };

            return(result);
        }