예제 #1
0
        protected async void OnSpellCheckButtonClicked(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(txtInput.Text))
                {
                    IsProcessing = true;
                    var spellCheckResult = await bingSpellCheckService.SpellCheckTextAsync(txtInput.Text);

                    foreach (var flaggedToken in spellCheckResult.FlaggedTokens)
                    {
                        txtOutput.Text += txtInput.Text.Replace(flaggedToken.Token, flaggedToken.Suggestions.FirstOrDefault().Suggestion);
                    }

                    IsProcessing = false;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
예제 #2
0
        async void OnSpellCheckButtonClicked(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(TodoItem.Name))
                {
                    IsProcessing = true;

                    var spellCheckResult = await bingSpellCheckService.SpellCheckTextAsync(TodoItem.Name);

                    foreach (var flaggedToken in spellCheckResult.FlaggedTokens)
                    {
                        TodoItem.Name = TodoItem.Name.Replace(flaggedToken.Token, flaggedToken.Suggestions.FirstOrDefault().Suggestion);
                    }
                    OnPropertyChanged("TodoItem");

                    IsProcessing = false;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
예제 #3
0
        async void OnSpellCheckButtonClicked(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(Context.Item.Description))
                {
                    activityIndicator.IsVisible = true;

                    var spellCheckResult = await bingSpellCheckService.SpellCheckTextAsync(Context.Item.Description);

                    foreach (var flaggedToken in spellCheckResult.FlaggedTokens)
                    {
                        Context.Item.Description = Context.Item.Description.Replace(flaggedToken.Token, flaggedToken.Suggestions.FirstOrDefault().Suggestion);
                    }
                    OnPropertyChanged("TodoItem");

                    activityIndicator.IsVisible = false;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
예제 #4
0
        async void analyticButton_Click(object sender, EventArgs e)
        {
            string translatedText = string.Empty;

            translatedText = analyticText.Text;
            try
            {
                if (!string.IsNullOrWhiteSpace(translatedText))
                {
                    //IsProcessing = true;
                    //textTranslationService = new TextTranslationService(new AuthenticationService(Constants.TextTranslatorApiKey));
                    //string t = await textTranslationService.TranslateTextAsync(translatedText);

                    //textAnalyticService = new TextAnalyticService(new AuthenticationService(Constants.TextAnalyticApiKey));
                    //string t = await textAnalyticService.AnalyticTextAsync(translatedText);

                    bingSpellCheckService = new BingSpellCheckService();
                    var spellCheckResult = await bingSpellCheckService.SpellCheckTextAsync(translatedText);

                    foreach (var flaggedToken in spellCheckResult.FlaggedTokens)
                    {
                        translatedText = translatedText.Replace(flaggedToken.Token, flaggedToken.Suggestions.FirstOrDefault().Suggestion);
                    }
                    analyticText.Text = translatedText;
                    //OnPropertyChanged("TodoItem");
                    //analyticText.Text = t;
                    //string t = "";
                    //IsProcessing = false;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                analyticText.Text += ex.Message; // " error";
            }
        }
예제 #5
0
        /// <summary>
        /// Ons the spell check.
        /// </summary>
        async void OnSpellCheck()
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(TextToValidate))
                {
                    IsBusy = true;

                    var spellCheckResult = await _bingSpellCheckService.SpellCheckTextAsync(TextToValidate);

                    foreach (var flaggedToken in spellCheckResult.FlaggedTokens)
                    {
                        TextToValidate =
                            TextToValidate.Replace(flaggedToken.Token, flaggedToken.Suggestions.FirstOrDefault().Suggestion);
                    }

                    IsBusy = false;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }