-
Notifications
You must be signed in to change notification settings - Fork 493
Expand file tree
/
Copy pathSpeechToTextPage.xaml
More file actions
102 lines (85 loc) · 3.86 KB
/
SpeechToTextPage.xaml
File metadata and controls
102 lines (85 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?xml version="1.0" encoding="utf-8" ?>
<pages:BasePage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
x:Class="CommunityToolkit.Maui.Sample.Pages.Essentials.SpeechToTextPage"
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Essentials"
xmlns:essentials="clr-namespace:CommunityToolkit.Maui.Sample.Pages.Essentials"
xmlns:media="clr-namespace:Microsoft.Maui.Media;assembly=Microsoft.Maui.Essentials"
x:TypeArguments="vm:SpeechToTextViewModel"
x:DataType="vm:SpeechToTextViewModel"
Title="SpeechToText">
<ContentPage.Resources>
<essentials:PickerLocaleDisplayConverter x:Key="PickerLocaleDisplayConverter" />
</ContentPage.Resources>
<ScrollView>
<VerticalStackLayout
Spacing="20"
Padding="30,0">
<Label
Text="SpeechToText allows the user to convert speech to text in real time"
HorizontalTextAlignment="Center"/>
<Label
Text="Locale"
FontAttributes="Bold"/>
<Picker
ItemsSource="{Binding Locales}"
SelectedItem="{Binding CurrentLocale}"
ItemDisplayBinding="{Binding ., x:DataType={x:Type media:Locale}, Converter={StaticResource PickerLocaleDisplayConverter}}"/>
<Label
Text="State"
FontAttributes="Bold"/>
<Label
Text="{Binding State}"
FontSize="18"
HorizontalOptions="Center"
HorizontalTextAlignment="Center"
MinimumHeightRequest="100" />
<Label
Text="Language Output"
FontAttributes="Bold"/>
<Label
Text="{Binding RecognitionText}"
FontSize="18"
HorizontalOptions="Center"
HorizontalTextAlignment="Center"
MinimumHeightRequest="100" />
<Button
Text="Play"
Command="{Binding PlayCommand}"
HorizontalOptions="Center" />
<Border
StrokeThickness="2"
Stroke="#808080"
StrokeShape="RoundRectangle 8,8,8,8"
Padding="12">
<Border.Content>
<Grid RowDefinitions="*,60"
ColumnDefinitions="*,*"
RowSpacing="12"
ColumnSpacing="12">
<Button
Grid.Row="0"
Grid.Column="0"
Text="StartListenAsync"
Command="{Binding StartListenCommand}"
HorizontalOptions="End" />
<Button
Grid.Row="0"
Grid.Column="1"
Text="StopListenAsync"
Command="{Binding StopListenCommand}"
HorizontalOptions="Start" />
<Label
Grid.Row="1"
Grid.ColumnSpan="2"
Text="The `StartListenAsync` API starts the speech-to-text service and shares the results using `RecognitionResultUpdated` event and `RecognitionResultCompleted` event."
HorizontalOptions="Center"
HorizontalTextAlignment="Center"
FontSize="12"/>
</Grid>
</Border.Content>
</Border>
</VerticalStackLayout>
</ScrollView>
</pages:BasePage>