Example #1
0
        public void spx_jg()
        {
            try
            {
                TC.yx = false;

                //清除现有镜头
                this.Cursor = Cursors.WaitCursor;
                foreach (mjpeg.cameraW c in arc)
                {
                    c.mjpegSource.Yx = false;
                    c.Stop();
                    c.Dispose();
                }
                foreach (Vlc.DotNet.Forms.VlcControl c in arr)
                {
                    c.Stop();
                    c.Dispose();
                }
                ar.Clear();
                arc.Clear();
                arr.Clear();
                GC.Collect();

                TC.yx = true;
                mjpeg.cameraW c2 = new cameraW();
                c2.Dock   = DockStyle.Fill;
                c2.Source = jtss[cur].url;

                this.Controls.Add(c2);
                ar.Add(c2);
                c2.Start();
            }
            catch (Exception ex)
            { MessageBox.Show(ex.Message); }
            finally
            { this.Cursor = Cursors.Default; }
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                if (cur >= jtss.Count)
                {
                    cur = 0;
                }

                TC.yx = false;
                //清除现有镜头
                this.Cursor = Cursors.WaitCursor;
                foreach (mjpeg.cameraW c in ar)
                {
                    c.mjpegSource.Yx = false;
                    c.Stop();
                    c.Dispose();
                }
                ar.Clear();
                GC.Collect();

                TC.yx = true;
                mjpeg.cameraW c2 = new cameraW();
                c2.Dock   = DockStyle.Fill;
                c2.Source = jtss[cur].url;

                this.Controls.Add(c2);
                ar.Add(c2);
                c2.Start();
                cur = cur + 1;
            }
            catch
            { }
            finally
            { this.Cursor = Cursors.Default; }
        }
Example #3
0
        public void spxshi()
        {
            try
            {
                TC.yx = false;

                //清除现有镜头
                this.Cursor = Cursors.WaitCursor;
                foreach (mjpeg.cameraW c in arc)
                {
                    c.mjpegSource.Yx = false;
                    c.Stop();
                    c.Dispose();
                }
                foreach (Vlc.DotNet.Forms.VlcControl c in arr)
                {
                    c.Stop();
                    c.Dispose();
                }
                ar.Clear();
                arc.Clear();
                arr.Clear();
                GC.Collect();
                int sm = getsm(jtss.Count);
                TC.yx = true;
                //显示
                int wei = this.Width;
                int hei = this.Height - 60;
                int y0  = 30;
                int i   = 0;
                foreach (JT jt1 in jtss)
                {
                    if (i < sm)
                    {
                        bool rtsp = jt1.url.Trim().ToUpper().Substring(0, 4) == "RTSP";
                        if (rtsp)
                        {
                            Vlc.DotNet.Forms.VlcControl vlc = new Vlc.DotNet.Forms.VlcControl();
                            ((System.ComponentModel.ISupportInitialize)(vlc)).BeginInit();
                            this.SuspendLayout();

                            wz w1 = GetWZ(sm, i, wei, hei, 0, y0);
                            vlc.Location = new System.Drawing.Point(w1.x, w1.y);
                            vlc.Size     = new System.Drawing.Size(w1.w, w1.h);
                            this.Controls.Add(vlc);
                            try
                            {
                                vlc.VlcLibDirectoryNeeded += vlc_VlcLibDirectoryNeeded;
                                ((System.ComponentModel.ISupportInitialize)(vlc)).EndInit();
                                this.ResumeLayout(false);

                                vlc.Video.AspectRatio = vlc.Width.ToString() + ":" + vlc.Height.ToString();

                                vlc.Play(new Uri(jt1.url));
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("联系计算机人员安装VLC控件:" + ex.ToString());
                            }
                            //vlc.Play(new Uri("rtsp://169.85.100.36/axis-media/media.amp?camera=1"));
                            ar.Add(vlc);
                            arr.Add(vlc);
                            vlc.Resize += vlc_Resize;
                        }
                        else
                        {
                            c = new cameraW();
                            wz w1 = GetWZ(sm, i, wei, hei, 0, y0);
                            c.Location = new System.Drawing.Point(w1.x, w1.y);
                            c.Size     = new System.Drawing.Size(w1.w, w1.h);
                            c.Source   = jt1.url;
                            this.Controls.Add(c);
                            ar.Add(c);
                            arc.Add(c);
                            c.Start();
                        }
                        i = i + 1;
                    }
                }
            }
            catch (Exception ex)
            { MessageBox.Show(ex.Message); }
            finally
            { this.Cursor = Cursors.Default; }
        }