protected override async Task OnLoadedAsync() { await RunTaskAsync(async() => { EventList = await EventsLoaderService.GetEventsJsonAsync(10); }) .ContinueWith(async task => { if (!task.IsFaulted) { await VoiceInterface.SayEventsAvailable(); } await VoiceInterface.ListeningCancellation(); Messenger.Default.Register <SpeechResultGeneratedMessage>(this, async e => { if (e.Result.Constraint.Tag == "constraint_abord_words") { if (e.Result.Text.Contains("au-revoir") || e.Result.Text.Contains("bonne journée")) { await DispatcherHelper.RunAsync(async() => await GoBackToMainExecute()); } else { await DispatcherHelper.RunAsync(async() => await GoBackToMenuExecute()); } } }); }); }
protected override async Task OnLoadedAsync() { List <Carousel> ListCarousel = new List <Carousel>(); await RunTaskAsync(async() => { string _carousel; foreach (Attachment attachment in Attachments) { _carousel = JsonConvert.SerializeObject(attachment.Content); ListCarousel.Add(JsonConvert.DeserializeObject <Carousel>(_carousel)); } await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { CarouselList = ListCarousel; } ); }) .ContinueWith(async task => { await VoiceInterface.ListeningCancellation(); Messenger.Default.Register <SpeechResultGeneratedMessage>(this, async e => { if (e.Result.Constraint.Tag == "constraint_abord_words") { await DispatcherHelper.RunAsync(async() => await GoBackToMainExecute()); } }); }); }