private void label1_Click(object sender, EventArgs e)
        {
            foreach (Control ctl in CaneraChangeList.GetPanel3.Controls)
            {
                if (ctl.GetType() == typeof(CameraChangeControl))
                {
                    CameraChangeControl ccc = (CameraChangeControl)ctl;
                    ccc.label1.ForeColor = Color.White;
                }
            }
            this.label1.ForeColor = Color.Yellow;
            string[] camera = new string[3];
            DbControl.SwitchCameraDB(this.TabIndex);
            camera = DbControl.SelectCameraById(this.TabIndex);
            string ip   = camera[0];
            string user = camera[1];
            string pwd  = camera[2];

            if (CameraPlay.Stop())
            {
                if (CameraPlay.Login(ip, user, pwd))
                {
                    CameraPlay.Play();
                }
            }
        }
        private void btnDel_Click(object sender, EventArgs e)
        {
            //如果该摄像头正在播放则停止
            string[] camera = new string[4];
            camera = DbControl.GetUseCameraDB();
            if (camera != null)
            {
                if (this.TabIndex == int.Parse(camera[0]))
                {
                    CameraPlay.Stop();
                }
            }

            if (!DbControl.DeleteCameraDB(int.Parse(this.cNum)))
            {
                using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"..\Release\access.log", true, Encoding.UTF8))
                {
                    string strLog = DateTime.Now.ToString().Replace('/', '-') + " - error - 摄像头删除失败";
                    file.WriteLine(strLog);
                    file.Close();
                }
                return;
            }
            else
            {
                using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"..\Release\access.log", true, Encoding.UTF8))
                {
                    string strLog = DateTime.Now.ToString().Replace('/', '-') + " - info - 摄像头删除成功";
                    file.WriteLine(strLog);
                    file.Close();
                }

                System.Windows.Forms.Panel panel = TeacherWorkTable.CaneraChangeList.GetPanel3;
                foreach (Control ctl in panel.Controls)
                {
                    if (ctl.GetType() == typeof(CameraChangeControl))
                    {
                        CameraChangeControl ccc = (CameraChangeControl)ctl;
                        if (ccc.TabIndex == int.Parse(this.cNum))
                        {
                            ccc.Dispose();
                            break;
                        }
                    }
                }

                this.Dispose();
            }
        }
예제 #3
0
        private void frmShow_Load(object sender, EventArgs e)
        {
            pnlRightBody.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(31)))), ((int)(((byte)(31)))));
            // pnlRightTelescopic.BackColor = Color.Transparent;
            // pnlRightTelescopic.Parent = pbVideoShow;
            classListItemControl1.funClick = classListItemControl2.funClick = classListItemControl3.funClick = classListItemControl1.funClick = classListItemControl4.funClick = new ClassListItemControl.dlgtItemClick(classChanged);
            label1.BackColor       = Color.Transparent;
            pnlClassList.BackColor = Color.Transparent;
            //pnlToolbar.BackColor = Color.Transparent;
            // pnlToolbar.Parent = pbVideoShow;

            SetBtnStyle(btnTelescopic);
            SetBtnStyle(btnSetting);
            SetBtnStyle(btnLive);

            //settingListControl1.Parent = pbVideoShow;

            btnLive.Enabled = false;

            //预览视频
            CameraPlay.Init(this.pbVideoShow);
            string[] camera = new string[4];
            camera = DbControl.GetUseCameraDB();
            if (camera != null)
            {
                int    id   = int.Parse(camera[0]);
                string ip   = camera[1];
                string user = camera[2];
                string pwd  = camera[3];
                foreach (Control ctl in CaneraChangeList.GetPanel3.Controls)
                {
                    if (ctl.GetType() == typeof(CameraChangeControl))
                    {
                        CameraChangeControl ccc = (CameraChangeControl)ctl;
                        if (ccc.TabIndex == id)
                        {
                            ccc.GetLabel.ForeColor = Color.Yellow;
                            break;
                        }
                    }
                }
                if (CameraPlay.Login(ip, user, pwd))
                {
                    CameraPlay.Play();
                }
            }
        }