public IEnumerable <string> GetSupportedLanguages() { _supportedLanguages = new List <string>(); _supportedLanguagesDelegate = (IntPtr language, IntPtr userData) => { string languageStr = Marshal.PtrToStringAnsi(language); _supportedLanguages.Add(languageStr); return(true); }; ErrorCode error = VcWidgetForeachSupportedLanguages(_handle, _supportedLanguagesDelegate, IntPtr.Zero); if (error != ErrorCode.None) { Log.Error(LogTag, "GetSupportedLanguages Failed with error " + error); throw ExceptionFactory.CreateException(error); } return(_supportedLanguages); }
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> /// <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); }