示例#1
0
        private void SetCamera(int index)
        {
            if (videoSource != null)
            {
                videoSource.Stop();
                videoSource.NewFrame -= frameHandler;
            }

            var camera = Cache.Cameras[index];

            videoSource = new JPEGStream(camera.Url);

            frameHandler          = new NewFrameEventHandler(video_NewFrame);
            videoSource.NewFrame += frameHandler;
            videoSource.Start();

            RefreshPlaces();
        }
示例#2
0
 private void RecordInner_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(SerialNo.Text))
     {
         MessageBox.Show("Enter serial number");
     }
     else
     {
         if ((bool)innerJpeg.IsChecked)
         {
             if (innerJpegStream != null && innerJpegStream.IsRunning)
             {
                 innerJpegStream.Stop();
                 recInnerVdo?.StopRecording();
                 RecordInner.Content = "Record";
             }
             else
             {
                 innerJpegStream = new JPEGStream(innerIPCamUrl.Text);
                 StartStreamingForInner(innerJpegStream);
                 RecordInner.Content = "Stop";
             }
         }
         else // UseMJpegStream
         {
             if (innerMjpegStream != null && innerMjpegStream.IsRunning)
             {
                 innerMjpegStream.Stop();
                 recInnerVdo?.StopRecording();
                 RecordInner.Content = "Record";
             }
             else
             {
                 innerMjpegStream = new MJPEGStream(innerIPCamUrl.Text);
                 StartStreamingForInner(innerMjpegStream);
                 RecordInner.Content = "Stop";
             }
         }
     }
 }
示例#3
0
 public void Stop()
 {
     client.Stop();
 }
        private void timerLoad_Tick(object sender, EventArgs e)
        {
            istatistikGuncelle();


            // MessageBox.Show(otopark1.bosParkyerleri().ElementAt(0));
            toolStripLabel2.Text = otopark1.dolulukOrani(kapasite) + "/" + kapasite;
            if (Convert.ToInt16(otopark1.dolulukOrani(kapasite)) >= kapasite)
            {
                kameraGroup1.Enabled = false;
            }
            if (Convert.ToInt16(otopark1.dolulukOrani(kapasite)) >= kapasite)
            {
                kameraGroup1.Enabled = true;
            }

            try
            {
                if (kamera1Video != null)
                {
                    kamera1Video.Stop();
                }

                if (kamera2Video != null)
                {
                    kamera2Video.Stop();
                }

                labelFiligran1.Text = "zzz";
                labelFiligran2.Text = "";
                kamera1Video        = null;
                kamera2Video        = null;
            }
            catch
            {
                MessageBox.Show("hata");
            }

            try
            {
                aktifkameralar = kamera1.kameraGetirAktif();
                if (aktifkameralar[0].k_lokasyon == "1" && aktifkameralar[1].k_lokasyon == "0")
                {
                    Kamera tempKamera = new Kamera();
                    tempKamera        = aktifkameralar[0];
                    aktifkameralar[0] = aktifkameralar[1];
                    aktifkameralar[1] = tempKamera;
                }

                if (aktifkameralar[0] != null)
                {
                    kamera1           = (Kamera)aktifkameralar[0];
                    kameraGroup1.Text = kamera1.k_adi;


                    kamera1Video = new JPEGStream(kamera1.k_url.ToString());

                    labelFiligran1.Text = aktifkameralar[0].k_filigran;

                    kamera1Video.NewFrame   += kamera1Video_NewFrame;
                    kamera1LoadingLabel.Text = "";

                    if (CheckURLValid(aktifkameralar[0].k_url))
                    {
                        labelFiligran1.Visible = true;
                        kamera1Video.Start();
                        timerKamera1.Start();
                    }
                    else
                    {
                        pictureBoxKamera1.Image  = Properties.Resources.connecting;
                        labelFiligran1.Visible   = false;
                        kamera1LoadingLabel.Text = "'" + aktifkameralar[0].k_adi + "' isimli kameraya bağlanılıyor.";
                    }
                }

                if (aktifkameralar[1] != null)
                {
                    kamera2                  = (Kamera)aktifkameralar[1];
                    kameraGroup2.Text        = kamera2.k_adi;
                    kamera2Video             = new JPEGStream(kamera2.k_url.ToString());
                    labelFiligran2.Text      = aktifkameralar[1].k_filigran;
                    kamera2Video.NewFrame   += kamera2Video_NewFrame;
                    kamera2LoadingLabel.Text = "";
                    if (CheckURLValid(aktifkameralar[1].k_url))
                    {
                        //   MessageBox.Show("");
                        labelFiligran2.Visible = true;
                        kamera2Video.Start();
                        timerKamera2.Start();
                    }
                    else
                    {
                        pictureboxKamera2.Image  = Properties.Resources.connecting;
                        labelFiligran2.Visible   = false;
                        kamera2LoadingLabel.Text = "'" + aktifkameralar[1].k_adi + "' isimli kameraya bağlanılıyor.";
                    }
                }
            }
            catch
            {
            }
        }