Пример #1
0
        private async void RegisterVoiceCommands()
        {
            await VoiceCommandService.InstallCommandSetsFromFileAsync(new Uri("ms-appx:///VoiceCommands.xml", UriKind.Absolute));

            UpdatePhraseList("EnglishCommands", "voice");
            MessageBox.Show("Voices PhraseList Updated.");
        }
Пример #2
0
        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private async void Application_Launching(object sender, LaunchingEventArgs e)
        {
            //Clear cache data
            var cacheService = new CacheService();

            cacheService.ClearCache();

            //Clear image data
            var cacheSetting = new IsolatedStorageProperty <bool>("ClearImageCache");

            if (cacheSetting.Value)
            {
                StorageHelper.ClearImageCache();
                cacheSetting.Value = false;
            }

            try
            {
                await VoiceCommandService.InstallCommandSetsFromFileAsync(new Uri("ms-appx:///CortanaCommands.xml", UriKind.Absolute));
            }
            catch (Exception ex)
            {
                BugSenseHandler.Instance.LogException(ex);
            }
        }
Пример #3
0
 private async Task InitializeVoiceCommands()
 {
     try
     {
         await VoiceCommandService.InstallCommandSetsFromFileAsync(
             new Uri("ms-appx:///VoiceCommandDefinition.xml"));
     }
     catch
     {
         // do nothing
     }
 }
Пример #4
0
        // Código para ejecutar cuando la aplicación se inicia (p.ej. a partir de Inicio)
        // Este código no se ejecutará cuando la aplicación se reactive
        private async void Application_Launching(object sender, LaunchingEventArgs e)
        {
            try
            {
                await VoiceCommandService.InstallCommandSetsFromFileAsync(new Uri("ms-appx:///VoiceReco/VoiceCommandDefinition.xml"));

                TrialInformation.ReloadTrialInfo();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error launching: {0}", ex);
            }
        }
Пример #5
0
 private async void InstallVoiceCommands()
 {
     try
     {
         if (Environment.OSVersion.Version >= new Version(8, 1))
         {
             await VoiceCommandService.InstallCommandSetsFromFileAsync(new Uri("ms-appx:///VoiceCommandDefinition_8.1.xml"));
         }
     }
     catch
     {
     }
 }
Пример #6
0
        private async Task EnsureInitVoiceCommands()
        {
            try
            {
                await VoiceCommandService.InstallCommandSetsFromFileAsync(new Uri("ms-appx:///VoiceCommands.xml"));

                //await UpdatePhraseListsAsync();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Failed to register voice commands: {0}", ex);
            }
        }
Пример #7
0
        private async void InstallVoiceCommands()
        {
            const string VcdPath = "ms-appx:///VoiceDefinition.xml";

            try
            {
                Uri vcdUri = new Uri(VcdPath);
                await VoiceCommandService.InstallCommandSetsFromFileAsync(vcdUri);
            }
            catch (Exception vcdEx)
            {
                Debug.WriteLine(vcdEx.ToString());
            }
        }
Пример #8
0
        protected override async void Configure()
        {
            container = new PhoneContainer(RootFrame);
            container.RegisterPhoneServices();

            container
            .Singleton <IBookedFlightsService, BookedFlightsService>();

            container
            .PerRequest <MenuViewModel>()
            .PerRequest <FlightSearchViewModel>()
            .PerRequest <BookingsViewModel>();

            await VoiceCommandService.InstallCommandSetsFromFileAsync(new Uri("ms-appx:///resources/commands.xml"));
        }
Пример #9
0
        async private static void InitializeVoiceCommands()
        {
            var filename = "SupportedVoiceCommands.xml";

            try
            {
                var location      = Package.Current.InstalledLocation.Path;
                var fileUriString = String.Format("file://{0}/{1}", location, filename);
                await VoiceCommandService.InstallCommandSetsFromFileAsync(new Uri(fileUriString));
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
Пример #10
0
        private async void InstallVoiceCommands()
        {
            const string wp81vcdPath = "ms-appx:///VoiceCommandDefinition1.xml";

            try
            {
                Uri vcdUri = new Uri(wp81vcdPath);

                await VoiceCommandService.InstallCommandSetsFromFileAsync(vcdUri);
            }
            catch (Exception vcdEx)
            {
                Dispatcher.BeginInvoke(() => MessageBox.Show(String.Format("error {0} {1}", vcdEx.HResult, vcdEx.Message)));
            }
        }
Пример #11
0
        /// <summary>
        /// Install the voice commands to Cortana
        /// </summary>
        private async void InstallVoiceCommands()
        {
            const string Path = "ms-appx:///VoiceDefinition.xml";

            try
            {
                Uri file = new Uri(Path, UriKind.Absolute);

                await VoiceCommandService.InstallCommandSetsFromFileAsync(file);
            }
            catch (Exception vcdEx)
            {
                MessageBox.Show(vcdEx.Message);
            }
        }
Пример #12
0
        async void InitializeVoiceCommands()
        {
            if (VoiceCommandService.InstalledCommandSets.Any(s => s.Key == "Joker"))
            {
                return;
            }

            try
            {
                await VoiceCommandService.InstallCommandSetsFromFileAsync(new Uri(string.Format("ms-appx:///{0}", VoiceCommandFile)));
            }
            catch (Exception ex)
            {
                return;
            }
        }
Пример #13
0
 /// <summary>
 /// Load VDH file to initialize voice capabilities
 /// </summary>
 public static async Task InitializeSpeech()
 {
     try
     {
         await VoiceCommandService.InstallCommandSetsFromFileAsync(
             new Uri("ms-appx:///Resources/BusStopVHD.xml"));
     }
     catch
     {
         Util.BeginInvoke(() =>
         {
             MessageBox.Show("Unable to initialize voice capabilities",
                             "Error", MessageBoxButton.OK);
         });
     }
 }
Пример #14
0
        // Inicializar la fuente y la dirección de flujo de la aplicación según se define en sus cadenas de recursos traducidas.
        //
        // Para asegurarse de que la fuente de la aplicación está alineada con sus idiomas admitidos y que
        // FlowDirection para todos esos idiomas sigue su dirección tradicional, ResourceLanguage
        // y ResourceFlowDirection se debe inicializar en cada archivo resx para que estos valores coincidan con ese
        // referencia cultural del archivo. Por ejemplo:
        //
        // AppResources.es-ES.resx
        //    El valor de ResourceLanguage debe ser "es-ES"
        //    El valor de ResourceFlowDirection debe ser "LeftToRight"
        //
        // AppResources.ar-SA.resx
        //     El valor de ResourceLanguage debe ser "ar-SA"
        //     El valor de ResourceFlowDirection debe ser "RightToLeft"
        //
        // Para obtener más información sobre cómo traducir aplicaciones para Windows Phone, consulte http://go.microsoft.com/fwlink/?LinkId=262072.
        //
        private async void InitializeLanguage()
        {
            try
            {
                // Establecer la fuente para que coincida con el idioma definido por
                // Cadena de recursos ResourceLanguage para cada idioma admitido.
                //
                // Recurrir a la fuente del idioma neutro si el idioma
                // del teléfono no se admite.
                //
                // Si se produce un error del compilador, falta ResourceLanguage
                // el archivo de recursos.
                RootFrame.Language = XmlLanguage.GetLanguage(AppResources.ResourceLanguage);

                // Establecer FlowDirection de todos los elementos del marco raíz según
                // en la cadena de recursos ResourceFlowDirection para cada
                // idioma admitido.
                //
                // Si se produce un error del compilador, falta ResourceFlowDirection
                // el archivo de recursos.
                FlowDirection flow = (FlowDirection)Enum.Parse(typeof(FlowDirection), AppResources.ResourceFlowDirection);
                RootFrame.FlowDirection = flow;
                await VoiceCommandService.InstallCommandSetsFromFileAsync(new Uri("ms-appx:///Comandos.xml"));
            }
            catch
            {
                // Si se detecta aquí una excepción, lo más probable es que se deba a
                // ResourceLanguage no se ha establecido correctamente en un idioma admitido
                // o ResourceFlowDirection se ha establecido en un valor distinto de LeftToRight
                // o RightToLeft.

                if (Debugger.IsAttached)
                {
                    Debugger.Break();
                }

                throw;
            }
        }
Пример #15
0
        private async void InstallVoiceCommands()
        {
            const string wp81vcdPath = "ms-appx:///VoiceCommandDefinition.xml";

            try
            {
                bool using81orAbove = ((Environment.OSVersion.Version.Major >= 8) &&
                                       (Environment.OSVersion.Version.Minor >= 10));

                Uri vcdUri = new Uri(wp81vcdPath);

                await VoiceCommandService.InstallCommandSetsFromFileAsync(vcdUri);
            }
            catch (Exception vcdEx)
            {
                Dispatcher.BeginInvoke(() =>
                {
                    MessageBox.Show(String.Format(
                                        AppResources.VoiceCommandInstallErrorTemplate, vcdEx.HResult, vcdEx.Message));
                });
            }
        }
        private async void InstallVoiceCommands()
        {
            const string wp80vcdPath = "ms-appx:///VoiceCommandDefinition_8.0.xml";
            const string wp81vcdPath = "ms-appx:///VoiceCommandDefinition_8.1.xml";

            try
            {
                bool using81orAbove = ((Environment.OSVersion.Version.Major >= 8) &&
                                       (Environment.OSVersion.Version.Minor >= 10));

                Uri vcdUri = new Uri(using81orAbove ? wp81vcdPath : wp80vcdPath);

                await VoiceCommandService.InstallCommandSetsFromFileAsync(vcdUri);
            }
            catch (Exception vcdEx)
            {
                Dispatcher.BeginInvoke(() =>
                {
                    MessageBox.Show("Sorry, there was a problem installing the voice commands for Cortana, you'll only be " +
                                    "able to use voice commands within this app.  The error was: " + vcdEx.Message);
                });
            }
        }
 private async void initializeVoiceCommand()
 {
     //TODO: support more languages: http://www.drdobbs.com/mobile/windows-phone-8-app-development-using-vo/240158739?pgno=3
     await VoiceCommandService.InstallCommandSetsFromFileAsync(new Uri("ms-appx:///VoiceCommandDefinition_8.1.xml"));//TODO: this await is bad...Should at least give user feedback...
 }
Пример #18
0
 async void setupVoiceCommands()
 {
     await VoiceCommandService.InstallCommandSetsFromFileAsync(
         new Uri("ms-appx:///VoiceCommands/VCDCommands.xml", UriKind.RelativeOrAbsolute));
 }
Пример #19
0
 // Code, der beim Starten der Anwendung ausgeführt werden soll (z. B. über "Start")
 // Dieser Code wird beim Reaktivieren der Anwendung nicht ausgeführt
 private async void Application_Launching(object sender, LaunchingEventArgs e)
 {
     // Sprachdefinition installieren, sodass sie verfügbar ist
     await VoiceCommandService.InstallCommandSetsFromFileAsync(new Uri("ms-appx:///VoiceDays.xml"));
 }