/// <summary> /// Identifies a language from the given text. /// </summary> /// <param name="text">The text sample to ID.</param> /// <param name="callback">The callback to receive the results.</param> /// <returns></returns> public bool Identify(string text, IdentifyCallback callback) { if (string.IsNullOrEmpty(text)) { throw new ArgumentNullException("text"); } if (callback == null) { throw new ArgumentNullException("callback"); } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, "/v2/identify"); if (connector == null) { return(false); } IdentifyReq req = new IdentifyReq(); req.Callback = callback; req.Send = Encoding.UTF8.GetBytes(text); req.Headers["Content-Type"] = "text/plain"; req.OnResponse = OnIdentifyResponse; return(connector.Send(req)); }
public Form1() { InitializeComponent(); InitForms(); m_Image = Marshal.AllocHGlobal(256 * 1024); m_IdentifyCallback = new IdentifyCallback(identifyCallback); m_EnrollCallback = new EnrollCallback(enrollCallback); UF_SetIdentifyCallback(m_IdentifyCallback); UF_SetEnrollCallback(m_EnrollCallback); UF_SetReceiveRawDataCallback(new RawDataCallback(rawDataCallback)); }
static extern void UF_SetIdentifyCallback(IdentifyCallback callback);