示例#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;
            bool permissionGained = await AudioCapturePermissions.RequestMicrophonePermission();

            if (permissionGained)
            {
                // btnContinuousRecognize.IsEnabled = true;
                speechContext     = ResourceContext.GetForCurrentView();
                speechResourceMap = ResourceManager.Current.MainResourceMap.GetSubtree("LocalizationSpeechResources");
                play(question.Text);
            }
            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;
            }


            var parameters = (addProductMaterial.ProductParams)e.Parameter;

            textBlock2.Text = parameters.Path;
            textBlock.Text  = parameters.Name;
            textBlock1.Text = parameters.Category;
            textBlock3.Text = parameters.Material;
        }
示例#3
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
            string welcome = "welcome to the hopins store. To add new product say input, to manage your product say manage, to manage your order say order, to repeat the instruction, say help.";

            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;
            }
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
            string welcome = string.Format("{0}, to go back to home, please say home, to exit, say exit", textBlock.Text);

            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;
            }
        }
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
            bool permissionGained = await AudioCapturePermissions.RequestMicrophonePermission();

            if (permissionGained)
            {
                btnContinuousRecognize.IsEnabled = true;
                speechContext     = ResourceContext.GetForCurrentView();
                speechResourceMap = ResourceManager.Current.MainResourceMap.GetSubtree("LocalizationSpeechResources");
            }
            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;
            }

            base.OnNavigatedTo(e);

            var parameters = (addProductPrice.ProductParams)e.Parameter;

            productName.Text     = parameters.Name;
            productCategory.Text = parameters.Category;
            productMaterial.Text = parameters.Material;
            productPrice.Text    = parameters.Price;
            textBlock.Text       = parameters.Path;
            // image.Source = new BitmapImage(new Uri(parameters.Path));
            string        fileName    = textBlock.Text;
            StorageFolder myfolder    = ApplicationData.Current.LocalFolder;
            BitmapImage   bitmapImage = new BitmapImage();
            StorageFile   file        = await myfolder.GetFileAsync(fileName);

            image.Source = new BitmapImage(new Uri(file.Path));

            string summary = string.Format("Summary : the name of this product is {0}, the type of this product is {1}, the material of this product is {2}, the price of this product is {3} dollar, if you want to publish, say publish", productName.Text, productCategory.Text, productMaterial.Text, productPrice.Text);

            play(summary);
        }