Esempio n. 1
0
        /// <summary>
        /// 添加新的视频监控播放
        /// </summary>
        /// <param name="aMsg"></param>
        private void AddRTSP(DVRToken aToken)
        {
            RTSPViewer tmpViewer = GetViewer(aToken);

            if (tmpViewer != null)
            {
                // 调试测试时先不判断该条件
                SelectViewer(tmpViewer);
                ReLayout();
                return;
            }

            tmpViewer = GetFreeViewer();
            if (tmpViewer == null)
            {
                GuiHelper.MsgBox("视频监控窗口已被占满,请关闭一些监控窗口...");
                return;
            }

            UpdateInfo("开启监控" + aToken);
            tmpViewer.LinkToken(aToken);
            SelectViewer(tmpViewer);
            tmpViewer.StartPlay();
            ReLayout();
        }
Esempio n. 2
0
        /// <summary>
        /// 设置选中指定Viewer
        /// </summary>
        /// <param name="aViewer"></param>
        private void SelectViewer(RTSPViewer aViewer)
        {
            if (mSelectedViewer != null)
            {
                mSelectedViewer.BackColor = Color.Firebrick;
            }

            mSelectedViewer           = aViewer;
            mSelectedViewer.BackColor = Color.LimeGreen;
        }
Esempio n. 3
0
        /// <summary>
        /// 窗口载入过程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmDVR_Load(object sender, EventArgs e)
        {
            int tmpRes = PlayerMethods.CarEyePlayer_Init(GlobalCfg.DVRKey);

            for (int i = 0; i < MaxViewerCount; i++)
            {
                RTSPViewer tmpViewer = new RTSPViewer(this);
                tmpViewer.Click       += RTSPViewer_Click;
                tmpViewer.DoubleClick += RTSPViewer_DoubleClick;
                tmpViewer.Visible      = false;
                mViewers.Add(tmpViewer);
                this.pnlBase.Controls.Add(tmpViewer);
            }

            // 默认切换到全屏
            btnLayout_Click(btnFour, null);
        }
Esempio n. 4
0
        /// <summary>
        /// 设置全屏模式
        /// </summary>
        private void SetFullScreen()
        {
            if (mSelectedViewer == null)
            {
                if (mViewers == null || mViewers.Count < 1)
                {
                    return;
                }
                mSelectedViewer = mViewers[0];
            }

            HideAllViewer();
            mSelectedViewer.Location = new Point(0, 0);
            mSelectedViewer.Size     = this.pnlBase.Size;
            mSelectedViewer.Visible  = true;
            mIsFullScreen            = true;
        }
Esempio n. 5
0
        /// <summary>
        /// 设置6、8分屏布局
        /// </summary>
        private void SetMasterSlaveScreen(SplitScreenType aType)
        {
            HideAllViewer();

            // 6分屏布局为一个大屏,5个小屏,横竖为3个,相当于9分屏中的左上四屏合一
            int  tmpCount  = (int)aType / 2;
            int  perWidth  = this.pnlBase.Width / tmpCount;
            int  perHeight = this.pnlBase.Height / tmpCount;
            Size perSize   = new Size(perWidth, perHeight);
            Size mainSize  = new Size(this.pnlBase.Width - perWidth, this.pnlBase.Height - perHeight);

            RTSPViewer tmpViewer = mViewers[0];

            tmpViewer.Location = new Point(0, 0);
            tmpViewer.Size     = mainSize;
            tmpViewer.Visible  = true;

            // 右手边两个分屏
            for (int i = 1; i < tmpCount; i++)
            {
                tmpViewer          = mViewers[i];
                tmpViewer.Location = new Point(mainSize.Width, (i - 1) * perHeight);
                tmpViewer.Size     = perSize;
                tmpViewer.Visible  = true;
            }

            for (int i = tmpCount; i < (int)aType; i++)
            {
                tmpViewer          = mViewers[i];
                tmpViewer.Location = new Point((i - tmpCount) * perWidth, mainSize.Height);
                tmpViewer.Size     = perSize;
                tmpViewer.Visible  = true;
            }

            if (mSelectedViewer == null)
            {
                return;
            }
            if (mViewers.FindIndex((x) => x == mSelectedViewer) >= (int)aType)
            {
                // 超出分屏个数则不清除选中状态
                mSelectedViewer = null;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 符合4、9、16矩阵的分屏布局
        /// </summary>
        private void SetMatrixScreen(SplitScreenType aType)
        {
            HideAllViewer();

            // 每行每列的视频输出窗口个数
            int  tmpCount  = (int)Math.Sqrt((int)aType);
            int  perWidth  = this.pnlBase.Width / tmpCount;
            int  perHeight = this.pnlBase.Height / tmpCount;
            Size perSize   = new Size(perWidth, perHeight);

            for (int i = 0; i < tmpCount; i++)
            {
                for (int j = 0; j < tmpCount; j++)
                {
                    RTSPViewer tmpViewer = mViewers[i * tmpCount + j];
                    tmpViewer.Location = new Point(j * perWidth, i * perHeight);
                    tmpViewer.Size     = perSize;
                    tmpViewer.Visible  = true;
                    if (j == tmpCount - 1)
                    {
                        // 最后一列对齐控件右边
                        tmpViewer.Width += this.pnlBase.Right - tmpViewer.Right;
                    }
                    if (i == tmpCount - 1)
                    {
                        tmpViewer.Height += this.pnlBase.Bottom - tmpViewer.Bottom;
                    }
                }
            }

            if (mSelectedViewer == null)
            {
                return;
            }
            if (mViewers.FindIndex((x) => x == mSelectedViewer) >= (int)aType)
            {
                // 超出分屏个数则不清除选中状态
                mSelectedViewer = null;
            }
        }