Beispiel #1
0
        private async void InitializeVoiceCommands()
        {
            string errorMessage = string.Empty;

            try
            {
                Uri         vcdUri = new Uri("ms-appx:///MyVoiceCommands.xml", UriKind.Absolute);
                StorageFile file   = await StorageFile.GetFileFromApplicationUriAsync(vcdUri);

                if (file != null)
                {
                    await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);
                }
            }
            catch (Exception ex)
            {
                //voice command file not found or language not supported or file is invalid format (missing stuff), or capabilities not selected, etc etc
                errorMessage = ex.Message;
            }

            if (!string.IsNullOrEmpty(errorMessage))
            {
                await DisplayMessage(errorMessage);
            }
        }
Beispiel #2
0
        private async void RegisterVoiceCommands()
        {
            // SHOULD BE PERFORMED UNDER TRY/CATCH
            Uri         uriVoiceCommands = new Uri("ms-appx:///CortanaVCD.xml", UriKind.Absolute);
            StorageFile file             = await StorageFile.GetFileFromApplicationUriAsync(uriVoiceCommands);

            await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);
        }
Beispiel #3
0
        public static async void RegisterVcd()
        {
            try
            {
                StorageFile file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(VcdPath);

                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.HResult + ex.Message);
            }
        }
        /// <summary>
        /// Installs the Voice Command Definition (VCD) file associated with the application.
        /// Based on OS version, installs a separate document based on version 1.0 of the schema or version 1.1.
        /// </summary>
        public static async void InstallVoiceCommands(string voiceCommandDefinitionPath = "ms-appx:///VoiceCommandDefinition_8.1.xml")
        {
            try {
                Uri vcdUri = new Uri(voiceCommandDefinitionPath);

                StorageFile voiceCommandDef = await StorageFile.GetFileFromApplicationUriAsync(vcdUri);

                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(voiceCommandDef);
            }
            catch (Exception vcdEx) {
                Debug.WriteLine(vcdEx.Message);
            }
        }
        private async Task StartVoice()
        {
            var storageFile =
                await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///vcd.xml", UriKind.Absolute));

            try
            {
                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(storageFile);
            }
            catch (Exception)
            {
                // ignore if not available
            }
        }
Beispiel #6
0
        private async void RegisterVoiceCommands()
        {
            try
            {
                Uri         uriVoiceCommands = new Uri("ms-appx:///vcd.xml", UriKind.Absolute);
                StorageFile file             = await StorageFile.GetFileFromApplicationUriAsync(uriVoiceCommands);

                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #7
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
#if WINDOWS_PHONE_APP
            // Install voice commands, safe to run on each new navigation
            if (e.NavigationMode == NavigationMode.New)
            {
                var voiceCommandFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///VoiceCommandDefinition_8.1.xml"));

                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(voiceCommandFile);
            }
#endif

            this.navigationHelper.OnNavigatedTo(e);
        }
Beispiel #8
0
        private async void LoadCortana()
        {
            try
            {
                var storageFile =
                    await
                    StorageFile.GetFileFromApplicationUriAsync(
                        new Uri("ms-appx:///AudioticaCommands.xml"));

                await
                VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(
                    storageFile);
            }
            catch (FileNotFoundException) { }
        }
Beispiel #9
0
        /// <summary>
        /// Installs the Voice Command Definition (VCD) file associated with the application.
        /// Based on OS version, installs a separate document based on version 1.0 of the schema or version 1.1.
        /// </summary>
        private async void InstallVoiceCommands()
        {
            const string VcdPath = "ms-appx:///VoiceCommandDefinitions.xml";

            try
            {
                Uri vcdUri = new Uri(VcdPath);
                var file   = await StorageFile.GetFileFromApplicationUriAsync(vcdUri);

                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);

                App.LogAnalyticsEvent("InstallVoiceCommands", "OK", null, 0);
            }
            catch (Exception vcdEx)
            {
                Debug.WriteLine(vcdEx.ToString());
                this.StatusText.Text = "sorry, could not register voice commands - " + vcdEx.Message;

                GoogleAnalytics.EasyTracker.GetTracker().SendException("InstallVoiceCommands failed: " + vcdEx.Message, false);
            }
        }
        /// <summary>
        /// Install the voice commands
        /// </summary>
        private async void InstallVoiceCommands()
        {
            string error = string.Empty;

            try
            {
                const string Wp81VCDPath = "ms-appx:///VoiceCommandDefinition_SharePointCellenza.xml";
                Uri          vcdUri      = new Uri(Wp81VCDPath);
                StorageFile  file        = await StorageFile.GetFileFromApplicationUriAsync(vcdUri);

                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            if (string.IsNullOrEmpty(error) == false)
            {
                MessageDialog dialog = new MessageDialog("Error during voice command installation: " + error);
                await dialog.ShowAsync();
            }
        }
Beispiel #11
0
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Navigate(e);
            try
            {
                Uri         uriVoiceCommands = new Uri("ms-appx:///VoiceCommands.xml", UriKind.Absolute);
                StorageFile file             = await StorageFile.GetFileFromApplicationUriAsync(uriVoiceCommands);

                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
            }
        }
Beispiel #12
0
        private async Task InstallVoiceCommandsAsync()
        {
            var storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Cortana.xml"));

            await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(storageFile);
        }
Beispiel #13
0
        private async void FirstTimeSetup()
        {
            var storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Voice/VoiceCommandDefinitions.xml"));

            await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(storageFile);
        }
Beispiel #14
0
        /// <summary>
        /// Register the VCD with Cortana.
        /// </summary>
        private async void RegisterVoiceCommandsAsync()
        {
            var storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///vcd.xml"));

            await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(storageFile);
        }
Beispiel #15
0
        //Check - Application Settings
        async Task SettingsCheck()
        {
            try
            {
                //Check - Screen always on
                if (!vApplicationSettings.ContainsKey("ScreenAlwaysOn"))
                {
                    vApplicationSettings["ScreenAlwaysOn"] = false;
                }

                //Check - Volume Skip Amount
                if (!vApplicationSettings.ContainsKey("VolSkip"))
                {
                    vApplicationSettings["VolSkip"] = "2";
                }

                //Check - Remote Screen Location
                if (!vApplicationSettings.ContainsKey("RemoteLocation"))
                {
                    if (AVFunctions.DevMobile())
                    {
                        vApplicationSettings["RemoteLocation"] = 2;
                    }
                    else
                    {
                        vApplicationSettings["RemoteLocation"] = 0;
                    }
                }

                //Check - Close app Tile/Voice
                if (!vApplicationSettings.ContainsKey("CmdCloseApp"))
                {
                    vApplicationSettings["CmdCloseApp"] = false;
                }

                //Check - Server ip adres
                if (!vApplicationSettings.ContainsKey("ServerIp"))
                {
                    vApplicationSettings["ServerIp"] = "192.168.0.";
                }

                //Check - Server port Arnold
                if (!vApplicationSettings.ContainsKey("ServerPort"))
                {
                    vApplicationSettings["ServerPort"] = "1000";
                }

                //Check - Server port AmbiPro
                if (!vApplicationSettings.ContainsKey("ServerPortAmbiPro"))
                {
                    vApplicationSettings["ServerPortAmbiPro"] = "1020";
                }

                //Load and check - Voice Commands for Cortana - Not awaiting to avoid slow startup
                try
                {
                    VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///VoiceCommands.xml")));
                    Debug.WriteLine("Successfully registered the Cortana voice commands.");
                }
                catch
                {
                    Debug.WriteLine("Failed to register the Cortana voice commands.");
                }
            }
            catch (Exception Ex)
            {
                await new MessageDialog("SettingsCheckError: " + Ex.Message, App.vApplicationName).ShowAsync();
            }
        }