public DialogsViewModel(ISpeechDialogs dialogs, ITextToSpeech tts) { this.List = new List <ListItemViewModel> { new ListItemViewModel { Text = "Actions", Command = new Command(() => dialogs.Actions(new ActionsConfig("Choose your destiny") .SetShowDialog(this.ShowDialogs) .SetSpeakChoices(true) .Choice("Fatality", () => tts.Speak("Flawless Victory")) .Choice("Friendship", () => tts.Speak("Friendship")) .Choice("Bability", () => tts.Speak("Cute")) )) }, new ListItemViewModel { Text = "Confirm", Command = new Command(async() => { var result = await dialogs.Confirm("Shutdown your phone?", "Yes", "No", this.ShowDialogs); tts.Speak(result ? "Your phone will now self destruct" : "Too Bad"); }) }, new ListItemViewModel { Text = "Prompt", Command = new Command(async() => { var result = await dialogs.Prompt("Tell me your life story.... quickly!"); tts.Speak(result + " - BORING"); }) } }; }
public ProductsViewModel(IProductsService productsService, ITextToSpeech textToSpeech) { _productsService = productsService; _textToSpeech = textToSpeech; DownloadProducts(); _textToSpeech.Speak("IoC and DI"); }
public RepeatingWordsViewModel(INavigationService navigationServcie, IDialogService dialogService, IUnitOfWork unitOfWork, IAnimationService animationService, ITextToSpeech speechService, IFirstLanguage firstLanguageService) : base(navigationServcie, dialogService) { _animationService = animationService; _unitOfWork = unitOfWork; _firstLanguageService = firstLanguageService; _speechService = speechService; Model = new RepeatingWordsModel(); VoiceActingCommand = new Command(async() => await _speechService.Speak(Model.CurrentWord.EngWord)); EditCurrentWordCommand = new Command(async() => { _isEditing = true; await NavigationService.NavigateToAsync <CreateWordViewModel>(Model.CurrentWord); }); EnterTranslateCommand = new Command(async() => { await _animationService.AnimationFade(WorkContainerView, 0); await ShowEnterTranslate(); await _animationService.AnimationFade(WorkContainerView, 1); }); SelectFromWordsCommand = new Command(async() => { await _animationService.AnimationFade(WorkContainerView, 0); await ShowSelectFromWords(); await _animationService.AnimationFade(WorkContainerView, 1); }); LearningCardsCommand = new Command(async() => { await _animationService.AnimationFade(WorkContainerView, 0); await ShowLearningCards(); await _animationService.AnimationFade(WorkContainerView, 1); }); AppearingCommand = new Command(async() => await AppearingPage()); }
void SayHello() { var task = new Task(() => MakeLongWebServiceCall()); task.Start(); textToSpeech.Speak($"Hello {Name}"); }
async void OnItemSelected(object sender, SelectedItemChangedEventArgs args) { var item = args.SelectedItem as Item; if (item == null) { return; } if (speech != null) { speech.Speak(item.Text); } if (item.Action == "New") { await Navigation.PushAsync(new View.Editor()); } else if (item.Action == "Open") { await DisplayAlert("Alert", "Coming Soon", "OK"); } else if (item.Action == "Interpret") { await DisplayAlert("Alert", "Coming Soon", "OK"); } else if (item.Action == "Chat") { await DisplayAlert("Alert", "Coming Soon", "OK"); } else if (item.Action == "Docs") { Device.OpenUri(new Uri("https://juliar.org/documentation")); } else if (item.Action == "Share") { await DisplayAlert("Alert", "Coming Soon", "OK"); await Navigation.PushAsync(new ItemDetailPage(new ItemDetailViewModel(item))); } else if (item.Action == "Contact") { Device.OpenUri(new Uri("mailto:[email protected]?subject=Questions%20about%20Dream")); } else if (item.Action == "Help") { Device.OpenUri(new Uri("https://juliar.org/help")); } else if (item.Action == "Settings") { await Navigation.PushAsync(new View.Settings()); } // Manually deselect item. ItemsListView.SelectedItem = null; }
public async Task <List <ItemModel> > GetStoryList() { var items = await _hackerNewsService.GetStoryList(); await _storyRepository.Insert(items); _textToSpeech.Speak(); return(items); }
private void Execute(string _txt) { _textToSpeech.Speak(_txt); // DependencyService.Get<ITextToSpeech>().Speak(_txt); NavigationService.NavigateAsync("StudentDetails"); //var _Par = new NavigationParameters(); //_Par.Add("_selectedStudent", SelectedStudent); //NavigationService.NavigateAsync("StudentDetails", _Par); }
private void ConnectToBluetooth() { if (bluetoothConnectorIsBusy || bluetoothService.IsConnected) { return; //we dont wont to try to connect twice, or if we are already connected } Task.Run(async() => { bluetoothConnectorIsBusy = true; textToSpeechService.Speak("Connecting to belt, please wait"); StartActivityIndicator(Color.DeepSkyBlue); string status; if (await bluetoothService.ConnectAsync()) //As soon as we are connected we need to pull from the values { status = "Bionic Eye is now connected to belt"; StopActivityIndicator(); textToSpeechService.Speak(status); await ListenToArduinoAsync(); bluetoothConnectorIsBusy = false; //should get here only if listen thread is finished, and so the bluetooth connector is no longer busy } else { status = "Failed to connect via bluetooth"; StopActivityIndicator(); bluetoothConnectorIsBusy = false; textToSpeechService.Speak(status); } }); }
public Task SpeechAsync(string text, string language = null) { CrossLocale?locale = null; if (language != null) { locale = synthesizer.GetInstalledLanguages().FirstOrDefault(l => l.Language.StartsWith(language)); locale = locale.Value.Language != null ? locale : null; } synthesizer.Speak(text, crossLocale: locale); return(Task.FromResult <object>(null)); }
public void SayQuote(GreatQuoteViewModel quote) { if (quote == null) { throw new ArgumentNullException("No Quote Set"); } if (tts != null) { string text = $"{(quote.Author != null ? $"{quote.Author} said: " : "" )}{quote.QuoteText}"; tts.Speak(text); } }
private void button_Clicked(object sender, EventArgs e) { game.SetButton((Button)sender); if (game.CheckWinner(buttons)) { ITextToSpeech speech = DependencyService.Get <ITextToSpeech>(); if (speech != null) { speech.Speak("Game over"); } GameOverStackLayout.IsVisible = true; } }
public ChatViewModel(ITextToSpeech tts, ISpeechRecognizer speech, ISpeechDialogs dialogs) { this.tts = tts; speech.WhenListeningStatusChanged().Subscribe(x => this.IsListening = x); this.Start = new Command(async() => { if (speech.Status != SpeechRecognizerStatus.Available) { await tts.Speak("Problem with speech recognition engine - " + speech.Status); return; } var granted = await speech.RequestPermission(); if (!granted) { await tts.Speak("Hey Dummy! Ya you! You didn't enable permissions for the microphone"); return; } var answer = await dialogs.Prompt("Hello, please tell me your name?"); await tts.Speak($"Hello {answer}"); }); }
public void SayQuote() { ITextToSpeech tts = ServiceLocator.Instance.Resolve <ITextToSpeech>(); if (tts != null) { string text = QuoteText; if (!string.IsNullOrEmpty(Author)) { text += " by " + Author; } tts.Speak(text); } }
public MainPage() { InitializeComponent(); string welcome = AppResources.welcome; if (speech != null && welcome != null) { speech.Speak(welcome); } else { Debug.WriteLine("welcome is null"); } }
private void btnPlay_Click(object sender, EventArgs e) { if (_current != null && !_current.IsStopped()) { MessageBox.Show("Trình phát giọng nói vẫn đang chạy!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (_current != null) { _current.Stop(); } _current = chkVietnamese.Checked ? new Factory().MakeVNSpeech(txtContent.Text) : new Factory().MakeLocal(txtContent.Text); _current.Speak(); }
public void SayQuote(GreatQuoteViewModel quote) { if (quote == null) { throw new ArgumentNullException("No quote set"); } if (tts != null) { var text = quote.QuoteText; if (!string.IsNullOrWhiteSpace(quote.Author)) { text += $" by {quote.Author}"; } tts.Speak(text); } }
public void SayQuote(GreatQuote quote) { if (quote == null) { throw new ArgumentNullException("quote"); } if (tts != null) { string text = quote.QuoteText; if (!string.IsNullOrWhiteSpace(quote.Author)) { text += " by " + quote.Author; } tts.Speak(text); } }
public Task SpeechAsync(string text, string language = null) { CrossLocale?locale = null; language = language ?? Language; if (language != null) { locale = new CrossLocale { Language = language, Country = language } } ; synthesizer.Speak(text, crossLocale: locale); return(Task.FromResult <object>(null)); } }
public void SayQuote(GreatQuote quote) { if (quote == null) { throw new ArgumentNullException("quote"); } ITextToSpeech tts = ServiceLocator.Instance.Resolve <ITextToSpeech>(); var text = quote.QuoteText; if (!string.IsNullOrWhiteSpace(quote.Author)) { text += $" by {quote.Author}"; } tts.Speak(text); }
public void SayQuote(GreatQuote quote) { // var textToSpeech = ServiceLocator.Instance.Resolve<ITextToSpeech>(); if (_textToSpeech == null) { throw new ArgumentNullException(nameof(quote)); } string message = quote.QuoteText; if (!string.IsNullOrWhiteSpace(quote.Author)) { message = $"{message} by {quote.Author}"; } _textToSpeech.Speak(message); }
public void SayQuote(Quote quote) { if (quote == null) { throw new ArgumentNullException(nameof(quote)); } ITextToSpeech tts = DependencyService.Get <ITextToSpeech>(); if (tts != null) { string text = quote.QuoteText; if (!string.IsNullOrWhiteSpace(quote.Author)) { text += "; by " + quote.Author; } tts.Speak(text); } }
public DependencyPage() { var label = new Label { Text = FirstTextBlock }; var button = new Button { Text = "Dependency Locator", TextColor = Color.White, BackgroundColor = Color.FromHex("#8BC34A") }; button.Clicked += (sender, e) => { ITextToSpeech speaker = DependencyService.Get <ITextToSpeech> (); if (speaker != null) { speaker.Speak(FirstTextBlock); } }; var button2 = new Button { Text = "From Plugin", TextColor = Color.White, BackgroundColor = Color.FromHex("#8BC34A") }; button2.Clicked += (sender, e) => { label.Text = SecondTextBlock; CrossTextToSpeech.Current.Speak(label.Text); }; Content = new StackLayout { Padding = new Thickness(10), Spacing = 10, Children = { label, button, button2 } }; }
private void Speak() { textToSpeech.Speak(upComingMovies.title); }
void SayHello() { textToSpeech.Speak($"Hello {Name}"); }
private void SetUpSubscribes() { MessagingCenter.Subscribe <ISpeechToText, string>(this, "STT", (sender, args) => { Text += args + " "; UpdateText(); }); MessagingCenter.Subscribe <MainPage>(this, "Speech_Clicked", (sender) => { try { SpeechToText.StartSpeechToText(); } catch (Exception ex) { Text = ex.Message; UpdateText(); } }); MessagingCenter.Subscribe <IMessageSender, string>(this, "STT", (sender, args) => { Text = Text + args + " "; UpdateText(); }); MessagingCenter.Subscribe <NewGroupPage, GroupOfItems>(this, "AddGroup", async(sender, group) => { var newItem = group as GroupOfItems; Groups.Add(newItem); // await DataStore.AddItemAsync(newItem); }); MessagingCenter.Subscribe <NewItemPage, Item>(this, "AddItem", (sender, item) => { var newItem = item as Item; Groups[item.WhichGroup].Items.Add(newItem); }); MessagingCenter.Subscribe <MainPage, Item>(this, "ClickPicture", (obj, item) => { Text += item.Text + " "; UpdateText(); }); MessagingCenter.Subscribe <MainPage>(this, "Delete_Clicked", (sender) => { if (Text.Length < 1) { return; } Text = Text.Remove(Text.Length - 1, 1); if (Text.Contains(" ")) { Text = Text.Remove(Text.LastIndexOf(" ")); Text += " "; } else { Text = ""; } UpdateText(); }); MessagingCenter.Subscribe <MainPage>(this, "Listen_Clicked", (sender) => { TextToSpeech.Speak(Text); }); }
private void Speak() { _textToSpeech.Speak(TextToSay); }
public void InitSpeak() { TextToSpeech.Speak(""); }
public void Speak() { _textToSpeech.Speak(_textToSay); }
public SpeakPageViewModel(INavigationService navigationService) : base(navigationService) { _textToSpeech = DependencyService.Get <ITextToSpeech>(); SpeakCommand = new DelegateCommand(() => _textToSpeech.Speak(TextToSay)); }
public MainPageViewModel(ITextToSpeech textToSpeech) { _textToSpeech = textToSpeech; _speakCommand = new Command((c) => textToSpeech.Speak(this.SpeakText)); }