Ejemplo n.º 1
0
        /// <summary>
        /// Fetch the configuration from the server, will execute using
        /// the thread pool, so this will return immediately with no result.
        /// Call after all configuration has been set.
        /// </summary>
        public async Task fetchConfigurationAsync()
        {
            //Try to download
            AppCommandSetCollectionResult commandResult = null;
            bool retry = true;

            while (retry)
            {
                try
                {
                    commandResult = await LoadCommands();

                    retry       = false;
                    foundConfig = true;
                }
                catch (Exception)
                {
                    Thread.Sleep(10000);
                }
            }

            this.Invoke(new Action(() =>
            {
                //Setup commands
                commands                    = new VoiceCommands(commandResult);
                commands.Restart           += commands_Restart;
                commands.PlaybackDeviceName = Config.PlaybackDeviceName;

                //Setup kinect
                recognizer = new KinectVoiceRecognizer(Config.Hotword, commands.getCommands(), Config.Sensitivity);
                recognizer.SensorConnected    += recognizer_SensorConnected;
                recognizer.SensorDisconnected += recognizer_SensorDisconnected;
                recognizer.initialize();
            }));
        }
Ejemplo n.º 2
0
 public VoiceCommands(AppCommandSetCollectionResult appCommandSet)
 {
     this.appCommandSet = appCommandSet;
 }