private void stopPlay()
 {
     for (int g = 0; g <= j; g++)
     {
         HkAction.Stop(SessionId[g]);
     }
     Array.Clear(cameraid1, 0, cameraid1.Length);
     Array.Clear(SessionId, 0, SessionId.Length);
     Array.Clear(handle, 0, handle.Length);
     Array.Clear(picbox, 0, picbox.Length);
     createBox();
     j = 0;
     a = 0;
 }
 private void btnStop_Click(object sender, EventArgs e)
 {
     for (int g = 0; g <= j; g++)
     {
         HkAction.Stop(SessionId[g]);
     }
     Array.Clear(cameraid1, 0, cameraid1.Length);
     Array.Clear(SessionId, 0, SessionId.Length);
     Array.Clear(handle, 0, handle.Length);
     Array.Clear(picbox, 0, picbox.Length);
     createBox();
     j = 0;
     a = 0;
 }
        private void picbox_MouseClick(object sender, MouseEventArgs e)
        {
            PictureBox picb1 = sender as PictureBox;//取出点击的控件sender
            string     name  = "";

            if (picb1 != null)//点击则非空,否则为空
            {
                string _name = picb1.Name;
                name = _name.Substring(_name.Length - 1, 1); //取名字中最后一个字,它正好是控件的index
            }
            int n = Util.toInt(name);                        //string 转换int

            JObject oCamera = getCamera(n);

            cameraid = oCamera["cameraId"].ToString();; //取出该摄像头id
            if (a == 1 && c != 1)
            {
                for (int t = 0; t < 9; t++)
                {
                    if (cameraid == cameraid1[t])//检查视频是否已在播放中
                    {
                        MessageBox.Show("该视频已经在播放中,请勿重复点击!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
            }
            cameraid1[j] = cameraid;
            string isEncrypt = oCamera["isEncrypt"].ToString();; //取出该摄像头id

            statu = jsonHandle1(n);
            if (isEncrypt == "1")//视频已加密,需要调用萤石接口发送短信验证码
            {
                MessageBox.Show("该视频已加密,暂时不能播放!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //return;
            }
            else
            {
                if (c == 1)//单画面
                {
                    handle[0] = picbox[0].Handle;
                    if (a == 1)
                    {
                        bool close = HkAction.Stop(SessionId[j]);
                    }
                    Start_Play1();
                    j = 0;
                }
            }
        }
        public void Start_Play(int index)
        {
            JObject oCamera = getCamera(index);

            j            = index;
            cameraid     = oCamera["cameraId"].ToString();;      //取出该摄像头id
            cameraid1[j] = cameraid;
            string isEncrypt = oCamera["isEncrypt"].ToString();; //取出该摄像头id

            if (isEncrypt == "1")                                //视频已加密,需要调用萤石接口发送短信验证码
            {
                MessageBox.Show("该视频已加密,暂时不能播放!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                handle[0] = picbox[0].Handle;
                if (a == 1)
                {
                    bool close = HkAction.Stop(SessionId[j]);
                }
                Start_Play1();
            }
        }