Exemplo n.º 1
0
        private async void UpdatePhraseList(string commandSetName, string phraseListName)
        {
            // Create List to hold the voice names
            List <string> voiceNames = new List <string>();

            // Loop through the installed voices

            foreach (VoiceInformation voice in _availableVoices)
            {
                // Take the DisplayName of the voice and split it at
                // the spaces. Take the second item in the results
                // and assign it to a new string.
                string voiceName = voice.DisplayName.Split(' ')[1];

                // add voiceName to the list of VoiceNames
                voiceNames.Add(voiceName);
            }
            // lookup the CommandSet we want to update
            VoiceCommandSet commandSet = VoiceCommandService.InstalledCommandSets[commandSetName];

            // Update commandSet with the new phrase list.
            await commandSet.UpdatePhraseListAsync(phraseListName, voiceNames);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Populates a PhraseList element with an array of Item elements.
 /// </summary>
 /// <param name="phraseListName">The string that corresponds to the PhraseList element's label attribute.</param>
 /// <param name="phraseList">A string array of values that will be added to the PhraseList element as Item elements.</param>
 /// <returns>The <see cref="Task"/> object representing the asynchronous operation.</returns>
 public Task UpdatePhraseListAsync(string phraseListName, IEnumerable <string> phraseList)
 {
     return(_voiceCommandSet.UpdatePhraseListAsync(phraseListName, phraseList)
            .AsTask());
 }