예제 #1
0
        private void Videobox_MouseDown(object sender, MouseEventArgs e)
        {
            Videobox v = sender as Videobox;

            if (selectedIndex != (int)v.Tag)
            {
                videoboxs[selectedIndex].BorderColor = Color.Transparent;
                selectedIndex = (int)v.Tag;
            }
            videoboxs[selectedIndex].BorderColor = Color.Green;

            //左下角显示视频名称
            label7.Text = "当前选中视频为:" + v.VideoName;

            //判断视频框是否正在报警器报警,如果是则启用"显示联动视频"
            if (e.Button == MouseButtons.Right && IsAlarm[selectedIndex] && AlarmDeviceID[selectedIndex] != "")
            {
                contextMenuStrip1.Items["ShowLinkageVideo"].Enabled = true;
            }
            else
            {
                contextMenuStrip1.Items["ShowLinkageVideo"].Enabled = false;
            }

            if (IsAlarm[selectedIndex] && AlarmDeviceID[selectedIndex] == null)
            {
                v.player.Stop();                 //取消报警声音
                flash_tag.Remove(selectedIndex); //取消视频框闪烁
                panels[selectedIndex].BackColor = Color.Transparent;
                videoboxs[selectedIndex].EndAlarm();
            }
        }
예제 #2
0
        string[] SID;         //存储已经打开的视频sSID
        public LinkageVideoForm(string DeviceID)
        {
            InitializeComponent();
            AnimateWindow(Handle, 300, AW_CENTER);//窗体弹出效果
            PresetDataManage pdata = Form1.PDM[Form1.selectedIndex];

            if (pdata == null)
            {
                return;
            }

            //获得视频数,生成对应视频框,依次打开视频,
            string[] DeviceIDs     = pdata.temp_LinkageData._videodeviceid.Split(new char[] { ',' });
            int      VideoBoxCount = DeviceIDs.Length;

            SID       = new string[VideoBoxCount];
            hwnd      = new int[VideoBoxCount];
            videoboxs = new Videobox[VideoBoxCount];
            for (int i = 0; i < VideoBoxCount; i++)
            {
                Videobox videobox = new Videobox();
                videobox.MouseDown += Videobox_MouseDown;
                videobox.Tag        = i;
                videoboxs[i]        = videobox;
            }
            SetVideoBox(VideoBoxCount);
            //依次打开视频
            for (int j = 0; j < VideoBoxCount; j++)
            {
                RealPlay(DeviceIDs[j], j);
            }
        }
예제 #3
0
        public ScreenWheelGuard(Videobox vb)
        {
            InitializeComponent();
            selectedVb = vb;
            AnimateWindow(Handle, 300, AW_CENTER);//窗体弹出效果

            //1、添加流媒体根节点,记录deviceID
            for (int i = 0; i < Class1.streamMediaList.Count; i++)
            {
                TreeNode root = new TreeNode();
                root.Text = Class1.streamMediaList[i].Name;
                root.Tag  = Class1.streamMediaList[i].DeviceID;
                treeView1.Nodes.Add(root);
                //2、添加摄像机节点
                for (int j = 0; j < Class1.cameraList.Count; j++)
                {
                    if (Class1.cameraList[j].StreamMedia_DeviceID == Class1.streamMediaList[i].DeviceID)
                    {
                        TreeNode tn = new TreeNode();
                        tn.Text = Class1.cameraList[j].VideoName;
                        tn.Tag  = Class1.cameraList[j].DeviceID;
                        root.Nodes.Add(tn);
                    }
                }
            }
            treeView1.ExpandAll();
        }
예제 #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < BoxCount; i++)
            {
                Videobox videobox = new Videobox();
                videobox.BorderWidth      = 2;
                videobox.BorderColor      = Color.Transparent;
                videobox.ContextMenuStrip = contextMenuStrip1;
                videobox.MouseDown       += Videobox_MouseDown;
                videobox.Tag = i;
                videoboxs[i] = videobox;

                hwnd[i] = -1;

                panels[i]           = new Panel();
                panels[i].BackColor = Color.Transparent;
            }
            Thread th = new Thread(new ThreadStart(Init));

            th.IsBackground = true;
            th.Start();
            SetVideoBox(4, panel1);
        }