Example #1
0
 private void OnCheckService(Voices voices)
 {
     if (m_Callback != null && m_Callback.Target != null)
     {
         m_Callback(SERVICE_ID, voices != null);
     }
 }
Example #2
0
        private void OnGetVoicesResp(RESTConnector.Request req, RESTConnector.Response resp)
        {
            Voices voices = new Voices();

            if (resp.Success)
            {
                try
                {
                    fsData   data = null;
                    fsResult r    = fsJsonParser.Parse(Encoding.UTF8.GetString(resp.Data), out data);
                    if (!r.Succeeded)
                    {
                        throw new WatsonException(r.FormattedMessages);
                    }

                    object obj = voices;
                    r = sm_Serializer.TryDeserialize(data, obj.GetType(), ref obj);
                    if (!r.Succeeded)
                    {
                        throw new WatsonException(r.FormattedMessages);
                    }
                }
                catch (Exception e)
                {
                    Log.Error("Natural Language Classifier", "GetVoices Exception: {0}", e.ToString());
                    resp.Success = false;
                }
            }

            if (((GetVoicesReq)req).Callback != null)
            {
                ((GetVoicesReq)req).Callback(resp.Success ? voices : null);
            }
        }