Beispiel #1
0
        // Navigations

        public async Task GoToMenuPage(PersonDto person)
        {
            // Clean up services and messenger
            await VoiceInterface.StopListening();

            await WebcamService.CleanUpAsync();

            Messenger.Default.Unregister(this);

            NavigationService.NavigateTo(ViewModelLocator.MenuPage, person);
        }
Beispiel #2
0
        private async void HandleActivity(Activity activity)
        {
            var text        = WebUtility.HtmlDecode(activity.Text);
            var attachments = activity.Attachments;

            if (attachments?.Count > 0)
            {
                var token = new CancellationTokenSource();

                await VoiceInterface.StopListening();

                await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                                                            async() =>
                {
                    await WebcamService.CleanUpAsync();
                    await GoToCarouselPageExecute(attachments);
                }
                                                                                                            );
            }
            LogHelper.Log(text);
            await TtsService.SayAsync(text);

            if (activity.Name == "End")
            {
                connection.OnMessage -= Connection_OnMessage;

                if (WebcamService.FaceDetectionEffect != null)
                {
                    await WebcamService.StopFaceDetectionAsync();
                }

                if (WebcamService.IsInitialized && await WebcamService.StartFaceDetectionAsync(300))
                {
                    WebcamService.FaceDetectionEffect.FaceDetected += OnFaceDetected;
                }

                await VoiceInterface.ListeningHelloAda();
            }
            else if (activity.Name != "NotFinish")
            {
                await DispatcherHelper.RunAsync(async() => { await SolicitExecute(); });
            }
        }