/// <summary> /// Initializes a new instance of the <see cref="T:XamarinCognitiveServices.ViewModels.TextApiViewModel"/> class. /// </summary> public TextApiViewModel() { _bingSpellCheckService = new BingSpellCheckService(); _textTranslationService = new TextTranslationService(new AuthenticationService(Constants.TextTranslatorApiKey)); SpellCheckCommand = new Command(OnSpellCheck); TranslateCommand = new Command(OnTranslate); }
public TodoItemPage() { InitializeComponent(); bingSpeechService = new BingSpeechService(new AuthenticationService(Constants.BingSpeechApiKey), Device.RuntimePlatform); bingSpellCheckService = new BingSpellCheckService(); textTranslationService = new TextTranslationService(new AuthenticationService(Constants.TextTranslatorApiKey)); }
public AddPage() { InitializeComponent(); Context = this.BindingContext as AddPageViewModel; bingSpeechService = new BingSpeechService(new AuthenticationService(Constants.BingSpeechApiKey), Device.RuntimePlatform); bingSpellCheckService = new BingSpellCheckService(); textTranslationService = new TextTranslationService(new AuthenticationService(Constants.TextTranslatorApiKey)); audioRecordingService = new AudioRecorderService(); }
public TodoItemPage(TodoItem item) { InitializeComponent(); this.BackgroundColor = Color.FromHex("#FFFFFF"); this.reteived = item; BindingContext = item; bingSpeechService = new BingSpeechService(new AuthenticationService(Constants.BingSpeechApiKey), Device.OS.ToString()); bingSpellCheckService = new BingSpellCheckService(); textTranslationService = new TextTranslationService(new AuthenticationService(Constants.TextTranslatorApiKey)); }
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"; } }
public SpellRecognition() { InitializeComponent(); bingSpellCheckService = new BingSpellCheckService(); }