1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 14:35:45 +00:00

TextToSpeech

This commit is contained in:
Yan Maniez 2019-09-21 00:39:14 +02:00
parent d639280bd2
commit 637803184e
3 changed files with 17 additions and 0 deletions

View file

@ -392,5 +392,20 @@ namespace AideDeJeu.ViewModels
await Navigation.PushAsync(page, true);
}
private Command<Item> _SpeakItemCommand = null;
public Command<Item> SpeakItemCommand
{
get
{
return _SpeakItemCommand ?? (_SpeakItemCommand = new Command<Item>(async (item) => await ExecuteSpeakItemommandAsync(item)));
}
}
public async Task ExecuteSpeakItemommandAsync(Item item)
{
var md = item.Markdown;
await Xamarin.Essentials.TextToSpeech.SpeakAsync(md);
}
}
}

View file

@ -16,6 +16,7 @@
<ContentPage.ToolbarItems>
<ToolbarItem Name="AddToFavorites" Text="Ajouter aux favoris" Order="Primary" Icon="round_star.png" Command="{Binding Main.Navigator.AddToFavoritesCommand}" />
<ToolbarItem Name="Print" Text="Générer un PDF" Order="Primary" Icon="scroll_unfurled.png" Command="{Binding Main.Navigator.GeneratePDFCommand}" CommandParameter="{Binding Item.Markdown}" />
<ToolbarItem Name="Speak" Text="Écouter" Order="Secondary" Command="{Binding Main.Navigator.SpeakItemCommand}" CommandParameter="{Binding Item}" />
</ContentPage.ToolbarItems>
<Grid>
<ScrollView Orientation="Vertical" BackgroundColor="{StaticResource HDWhite}">

View file

@ -19,6 +19,7 @@
<ContentPage.ToolbarItems>
<ToolbarItem Name="AddToFavorites" Text="Ajouter aux favoris" Order="Primary" Icon="round_star.png" Command="{Binding Main.Navigator.AddToFavoritesCommand}" />
<ToolbarItem Name="Print" Text="Générer un PDF" Order="Primary" Icon="scroll_unfurled.png" Command="{Binding Main.Navigator.GeneratePDFCommand}" CommandParameter="{Binding BindingContext.Items.Markdown, Source={x:Reference This}}" />
<ToolbarItem Name="Speak" Text="Écouter" Order="Secondary" Command="{Binding Main.Navigator.SpeakItemCommand}" CommandParameter="{Binding BindingContext.Items, Source={x:Reference This}}" />
</ContentPage.ToolbarItems>
<Grid>
<ScrollView Orientation="Vertical">