Example #1
0
 private void StartStreamingForOuter(JPEGStream _videoSource)
 {
     if (recOuterVdo == null || !recOuterVdo.RecordingStarted())
     {
         recOuterVdo = new VideoRecorder();
         recOuterVdo.SerialNumber = SerialNo.Text;
     }
     _videoSource.NewFrame += new NewFrameEventHandler(outervideo_NewFrame);
     _videoSource.Start();
 }
Example #2
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();
        }
Example #3
0
        private void Initialize()
        {
            nonCash.Checked = true;
            this.helper     = new TKHelper();
            //textBox4.Text = this.helper.GetCurrentDatetime();
            try
            {
                stream           = new JPEGStream(liveCameraURL);
                stream.NewFrame += stream_NewFrame;
                stream.Start();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show("Error : Cannot Connect to Live Camera. " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                LiveCamera.Image = Properties.Resources.no_image;
            }
            this.bni = new BNI(this);
            this.bni.RunMain();
            //this.StartTimer();

            // initialize vehicle type options
            try
            {
                comboBox1.Items.Add("- Pilih Tipe Kendaraan -");
                string masterDataFile = this.helper.GetApplicationExecutableDirectoryName() + "\\src\\master-data.json";
                using (StreamReader reader = new StreamReader(masterDataFile))
                {
                    string  json         = reader.ReadToEnd();
                    dynamic vehicleTypes = JsonConvert.DeserializeObject(json);
                    foreach (var types in vehicleTypes["VehicleTypes"])
                    {
                        comboBox1.Items.Add(types);
                    }
                    comboBox1.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show("Error : failed to fetch vehicle type data.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
 public void Start()
 {
     client.Start();
 }
        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
            {
            }
        }
Example #6
0
 private void Form1_Load(object sender, EventArgs e)
 {
     stream.Start();
     timer1.Interval = 3000;
     timer1.Start();
 }