-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVisualitzationWordPage.xaml.cs
55 lines (43 loc) · 1.27 KB
/
VisualitzationWordPage.xaml.cs
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
using Microsoft.Web.WebView2.Core;
using System.Net;
using System.Text;
namespace PracticaPalabrasMAUI;
public partial class VisualitzationWordPage : ContentPage, IQueryAttributable
{
private string word;
private Speak speak;
private bool can;
public VisualitzationWordPage()
{
word= string.Empty;
InitializeComponent();
BindingContext = this;
speak = new Speak();
}
public string Word { get => word; set { word = value;OnPropertyChanged(); } }
public bool Can { get => can; set { can = value; } }
protected override void OnNavigatedFrom(NavigatedFromEventArgs args)
{
base.OnNavigatedFrom(args);
Can = false;
}
public void ApplyQueryAttributes(IDictionary<string, object> query)
{
speak.Config();
if (query.ContainsKey(nameof(Word)))
{
Can = true;
Word = WebUtility.UrlDecode(query[nameof(Word)].ToString()).ToUpper();
Task.Run(async() =>
{
string word = Word;
await Task.Delay(1000 * 5);
await speak.Read(word,this);
if (Can)
{
await Navigation.PopAsync();
}
});
}
}
}