Exemplo n.º 1
0
        /// <summary>
        /// 更新语音命令集
        /// </summary>
        /// <param name="id">语音命令集编号</param>
        /// <param name="voiceCommandSet">语音命令集实体</param>
        /// <returns>是否成功</returns>
        public bool UpdateVoiceCommandSet(string id, VoiceCommandSet voiceCommandSet)
        {
            var old = GetVoiceCommandSet(id);

            if (old != null)
            {
                old.Id            = voiceCommandSet.Id;
                old.DeviceId      = voiceCommandSet.DeviceId;
                old.GroupId       = voiceCommandSet.GroupId;
                old.Action        = voiceCommandSet.Action;
                old.ActionParams  = voiceCommandSet.ActionParams;
                old.VoiceCommands = voiceCommandSet.VoiceCommands;

                return(true);
            }

            return(false);
        }
Exemplo n.º 2
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);
        }
 internal VoiceCommandServiceSet(VoiceCommandSet voiceCommandSet)
 {
     _voiceCommandSet = voiceCommandSet;
 }
Exemplo n.º 4
0
 internal VoiceCommandServiceSet(VoiceCommandSet voiceCommandSet)
 {
     _voiceCommandSet = voiceCommandSet;
 }
Exemplo n.º 5
0
 /// <summary>
 /// 添加语音命令集
 /// </summary>
 /// <param name="voiceCommandSet">语音命令实体</param>
 /// <returns>是否成功</returns>
 public bool AddVoiceCommandSet(VoiceCommandSet voiceCommandSet)
 {
     config.VoiceCommandSets.Add(voiceCommandSet);
     return(true);
 }