public override void Close()
 {
     lock (_StatusLock)
     {
         if (VideoSource != null)
         {
             ////停止消息订阅句柄
             //if (m_nRealLoadPic != 0)
             //{
             //    DHClient.DHStopLoadPic(m_nRealLoadPic);
             //    m_nRealLoadPic = 0;
             //}
             //停止监视
             if (m_realPlayH != 0)
             {
                 DHClient.DHStopRealPlay(m_realPlayH);
                 m_realPlayH = 0;
             }
             if (m_nLoginID != 0)
             {
                 DHClient.DHLogout(m_nLoginID);
                 m_nLoginID = 0;
             }
             if (initialized)
             {
                 DaHuaSDKManager.GetInstance().DisConnectEventHandle -= disConnect;
                 DaHuaSDKManager.GetInstance().OnlineMsgEventHandle  -= onlineMsg;
                 initialized = false;
             }
         }
         this._Status = VideoStatus.Disconnected;
     }
     if (!this.TitlePanel.InvokeRequired)
     {
         this.TitlePanel.Visible = false;
         this.video.BackColor    = Color.Navy;
         this.video.Image        = null;
     }
 }
        /// <summary>
        /// 初始化设备
        /// </summary>
        private bool Init()
        {
            //初始化SDK
            if (initialized == false)
            {
                //DHClient.DHInit(disConnect, IntPtr.Zero);
                //DHClient.DHSetAutoReconnect(onlineMsg, IntPtr.Zero);
                //initialized = true;
                //这里不直接使用DHClient初始化,是因为DHClient的disConnect和onlineMsg只支持一个事件回调,
                //所以这里使用管理器的事件处理,在管理器中使用DHClient初始化
                DaHuaSDKManager.GetInstance().DisConnectEventHandle -= disConnect;
                DaHuaSDKManager.GetInstance().DisConnectEventHandle += disConnect;
                DaHuaSDKManager.GetInstance().OnlineMsgEventHandle  -= onlineMsg;
                DaHuaSDKManager.GetInstance().OnlineMsgEventHandle  += onlineMsg;
                DaHuaSDKManager.GetInstance().InitSDK();
                initialized = true;
            }
            if (initialized == false)
            {
                return(false);
            }

            //登入设备
            if (m_nLoginID == 0)
            {
                NET_DEVICEINFO deviceInfo = new NET_DEVICEINFO();
                int            error      = 0;
                m_nLoginID = DHClient.DHLogin(VideoSource.MediaSource, (ushort)VideoSource.StreamPort
                                              , VideoSource.UserName, VideoSource.Password, out deviceInfo, out error);
            }
            if (m_nLoginID == 0)
            {
                return(false);
            }

            return(true);
        }