Beispiel #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.");
        }
Beispiel #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);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
         Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
         Microsoft.ApplicationInsights.WindowsCollectors.Session);
     this.InitializeComponent();
     this.Suspending += OnSuspending;
     _vcService       = new VoiceCommandService(GetType().GetTypeInfo().Assembly.GetTypes());
 }
        public MixedRealityApplication()
            : base()
        {
            // Add services specific to Mixed Reality
            this.Container.RegisterType <VoiceCommandService>();
            VoiceCommandService voiceCommandService = this.Container.Resolve <VoiceCommandService>();

            voiceCommandService.ConfigureVoiceCommands(new string[] {
                "select", "button"
            });
        }
Beispiel #5
0
 private async Task InitializeVoiceCommands()
 {
     try
     {
         await VoiceCommandService.InstallCommandSetsFromFileAsync(
             new Uri("ms-appx:///VoiceCommandDefinition.xml"));
     }
     catch
     {
         // do nothing
     }
 }
Beispiel #6
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);
            }
        }
 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
     {
     }
 }
Beispiel #8
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);
            }
        }
Beispiel #9
0
        protected override Task OnLaunchApplicationAsync(LaunchActivatedEventArgs args)
        {
            var deviceDisplayNames = this.TopicGroupDefinitions
                                     .SelectMany(g => g.TopicDefinitions)
                                     .Where(t => t.TopicViewModel is BaseDeviceViewModel)
                                     .Select(v => v.DisplayName);

            VoiceCommandService.InstallVoiceCommandService(deviceDisplayNames);

            this.NavigationService.ClearHistory();
            this.NavigationService.Navigate(typeof(HomePageView), null);
            return(Task.CompletedTask);
        }
Beispiel #10
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());
            }
        }
Beispiel #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);
            }
        }
Beispiel #12
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"));
        }
Beispiel #13
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);
            }
        }
Beispiel #14
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)));
            }
        }
Beispiel #15
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;
            }
        }
Beispiel #16
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);
         });
     }
 }
Beispiel #17
0
        public MainViewModel(IParkenDdClient client,
                             VoiceCommandService voiceCommandService,
                             JumpListService jumpList,
                             ParkingLotListFilterService filterService,
                             SettingsService settings,
                             StorageService storage,
                             GeolocationService geo,
                             TrackingService tracking,
                             ExceptionService exceptionService)
        {
            _client           = client;
            _voiceCommands    = voiceCommandService;
            _jumpList         = jumpList;
            _filterService    = filterService;
            _settings         = settings;
            _storage          = storage;
            _geo              = geo;
            _tracking         = tracking;
            _exceptionService = exceptionService;

            Messenger.Default.Register(this, (SettingChangedMessage msg) =>
            {
                if (msg.IsSetting(nameof(_settings.ShowExperimentalCities)))
                {
                    var temp      = SelectedCity;
                    _selectedCity = null;
                    RaisePropertyChanged(() => SelectedCity);
                    RaisePropertyChanged(() => MetaDataCities);
                    _selectedCity = temp;
                    RaisePropertyChanged(() => SelectedCity);
                }
            });

            PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == nameof(MetaDataCities))
                {
                    UpdateServiceData();
                }
            };

            NetworkInformation.NetworkStatusChanged += sender =>
            {
                UpdateInternetAvailability();
            };
            UpdateInternetAvailability();
        }
Beispiel #18
0
        private bool TryLaunchInteropChannel()
        {
            _namedPipeServer = new NamedPipeServer(Globals.NamedPipeChannel);
            DesktopIntegrationService.BindService(_namedPipeServer.ServiceBinder, new DesktopIntegrationServiceImplementation());
            VoiceCommandService.BindService(_namedPipeServer.ServiceBinder, new VoiceCommandServiceImplementation());

            try
            {
                Log.Info("Starting IPC");
                _namedPipeServer.Start();

                Log.Info("IPC running");
                return(true);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                return(false);
            }
        }
Beispiel #19
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;
            }
        }
Beispiel #20
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));
                });
            }
        }
Beispiel #21
0
        private void OnActivateApplicationForVoiceCommand(VoiceCommandActivatedEventArgs args)
        {
            SpeechRecognitionResult speechRecognitionResult = args.Result;

            // Get the name of the voice command and the text spoken. See VoiceCommandService.xml for
            // the <Command> tags this can be filled with.
            string commandName = speechRecognitionResult.RulePath[0];
            string textSpoken  = speechRecognitionResult.Text;

            // The commandMode is either "voice" or "text", and it indictes how the voice command
            // was entered by the user. Apps should respect "text" mode by providing feedback in silent form.
            string commandMode = VoiceCommandService.SemanticInterpretation("commandMode", speechRecognitionResult);

            switch (commandName)
            {
            case "showDevice":
                // Access the value of the {device} phrase in the voice command
                var device = VoiceCommandService.SemanticInterpretation("device", speechRecognitionResult);

                var deviceTopic = this.TopicGroupDefinitions
                                  .SelectMany(g => g.TopicDefinitions)
                                  .Where(t => t.DisplayName.Equals(device, StringComparison.OrdinalIgnoreCase))
                                  .FirstOrDefault();

                if (deviceTopic != null)
                {
                    deviceTopic.SelectTopic();
                    break;
                }
                App.Current.NavigationService.Navigate(typeof(HomePageView), null);
                break;

            case "showRoom":
            default:
                App.Current.NavigationService.Navigate(typeof(HomePageView), null);
                break;
            }
        }
        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...
 }
 async void setupVoiceCommands()
 {
     await VoiceCommandService.InstallCommandSetsFromFileAsync(
         new Uri("ms-appx:///VoiceCommands/VCDCommands.xml", UriKind.RelativeOrAbsolute));
 }
Beispiel #25
0
        public MainViewModel(IParkenDdClient client,
            VoiceCommandService voiceCommandService,
            JumpListService jumpList,
            ParkingLotListFilterService filterService,
            SettingsService settings,
            StorageService storage,
            GeolocationService geo,
            TrackingService tracking,
            ExceptionService exceptionService)
        {
            _client = client;
            _voiceCommands = voiceCommandService;
            _jumpList = jumpList;
            _filterService = filterService;
            _settings = settings;
            _storage = storage;
            _geo = geo;
            _tracking = tracking;
            _exceptionService = exceptionService;

            Messenger.Default.Register(this, (SettingChangedMessage msg) =>
            {
                if (msg.IsSetting(nameof(_settings.ShowExperimentalCities)))
                {
                    var temp = SelectedCity;
                    _selectedCity = null;
                    RaisePropertyChanged(() => SelectedCity);
                    RaisePropertyChanged(() => MetaDataCities);
                    _selectedCity = temp;
                    RaisePropertyChanged(() => SelectedCity);
                }
            });

            PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == nameof(MetaDataCities))
                {
                    UpdateServiceData();
                }
            };

            NetworkInformation.NetworkStatusChanged += sender =>
            {
                UpdateInternetAvailability();
            };
            UpdateInternetAvailability();
        }
Beispiel #26
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"));
 }