Exemple #1
0
        /// <summary>
        /// 获取单例
        /// </summary>
        /// <returns></returns>
        public static AsrFun GetInstance(string ip, int port)
        {
            // Double-Check Locking (双重锁定)
            if (_instance == null)
            {
                lock (_lockAsr)
                {
                    if (_instance == null)
                    {
                        _instance = new AsrFun(ip, port);
                    }
                }
            }

            return(_instance);
        }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="ip">语音识别服务器 IP 地址</param>
 /// <param name="port">语音识别服务器 端口</param>
 public AsrClient(string ip, int port)
 {
     _asr                = AsrFun.GetInstance(ip, port);
     _translate          = (ITranslate)_asr;
     _asr.OnInitialized += _asr_OnInitialized;
 }