internal VoiceCommandsGroup(SafeCommandListHandle handle) { _handle = handle; VcCmdListCb _callback = (IntPtr vcCommand, IntPtr userData) => { SafeCommandHandle cmdHandle = new SafeCommandHandle(vcCommand); _commands.Add(new VoiceCommand(cmdHandle)); return(true); }; ErrorCode error = VcCmdListForeachCommands(_handle, _callback, IntPtr.Zero); if (error != ErrorCode.None) { Log.Error(LogTag, "GetAllCommands Failed with error " + error); throw ExceptionFactory.CreateException(error); } _commands.CollectionChanged += OnCollectionChanged; }
internal VoiceCommandList(SafeCommandListHandle handle) { _handle = handle; _index = 0; _list = new List <VoiceCommand>(); _callback = (IntPtr vcCommand, IntPtr userData) => { SafeCommandHandle cmdHandle = new SafeCommandHandle(vcCommand); cmdHandle._ownership = false; _list.Add(new VoiceCommand(cmdHandle)); return(true); }; ErrorCode error = VcCmdListForeachCommands(_handle, _callback, IntPtr.Zero); if (error != ErrorCode.None) { Log.Error(LogTag, "GetAllCommands Failed with error " + error); throw ExceptionFactory.CreateException(error); } }
/// <summary> /// Retrieves all commands from the command list. /// </summary> /// <since_tizen> 3 </since_tizen> /// <privilege> /// http://tizen.org/privilege/recorder /// </privilege> /// <privlevel> /// public /// </privlevel> /// <feature> /// http://tizen.org/feature/speech.control /// http://tizen.org/feature/microphone /// </feature> /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception> /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception> public IEnumerable <VoiceCommand> GetAllCommands() { _callback = (IntPtr vcCommand, IntPtr userData) => { if (IntPtr.Zero == vcCommand) { Log.Error(LogTag, "Invalid command pointer"); return(false); } return(true); }; ErrorCode error = VcCmdListForeachCommands(_handle, _callback, IntPtr.Zero); if (error != ErrorCode.None) { Log.Error(LogTag, "GetAllCommands Failed with error " + error); throw ExceptionFactory.CreateException(error); } return(_list); }
internal static extern Interop.VoiceControlWidget.ErrorCode VcCmdListForeachCommands(SafeCommandListHandle cmdList, VcCmdListCb callback, IntPtr userData);