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); } }
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); } }
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); } }
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"; } }
/// <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); } }