예제 #1
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
            try {
                await intializeCamera();
            }
            catch (Exception ex)
            {
                var messageDialog = new Windows.UI.Popups.MessageDialog(ex.Message, "Exception");
                await messageDialog.ShowAsync();
            }
            string welcome = "Welcome to the add product page. To capture a photo of your product, say capture";


            bool permissionGained = await AudioCapturePermissions.RequestMicrophonePermission();

            if (permissionGained)
            {
                btnContinuousRecognize.IsEnabled = true;
                speechContext     = ResourceContext.GetForCurrentView();
                speechResourceMap = ResourceManager.Current.MainResourceMap.GetSubtree("LocalizationSpeechResources");
                play(welcome);
            }
            else
            {
                this.resultTextBlock.Visibility  = Visibility.Visible;
                this.resultTextBlock.Text        = "Permission to access capture resources was not given by the user, reset the application setting in Settings->Privacy->Microphone.";
                btnContinuousRecognize.IsEnabled = false;
            }
        }
예제 #2
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
            string welcome = "welcome to the hopins store, to add new product say product, to manage your product say manage, and to manage your order say order";

            bool permissionGained = await AudioCapturePermissions.RequestMicrophonePermission();

            if (permissionGained)
            {
                btnContinuousRecognize.IsEnabled = true;
                speechContext     = ResourceContext.GetForCurrentView();
                speechResourceMap = ResourceManager.Current.MainResourceMap.GetSubtree("LocalizationSpeechResources");
                play(welcome);
            }
            else
            {
                this.resultTextBlock.Visibility  = Visibility.Visible;
                this.resultTextBlock.Text        = "Permission to access capture resources was not given by the user, reset the application setting in Settings->Privacy->Microphone.";
                btnContinuousRecognize.IsEnabled = false;
            }
        }