Ejemplo n.º 1
0
        private void WindowsFormsDemoForm_Load(object sender, EventArgs e)
        {
            timer2.Tick += new EventHandler(timer2_Tick);

            //timer1.Tick += new EventHandler(timer_Tick);
            //timer1.Interval = 10000;
            timer2.Enabled = true;                       // Enable the timer
            //timer1.Start();
            txtContentWebCam.Clear();
            if (wCam == null)
            {
                wCam = new WebCam {
                    Container = picWebCam
                };

                wCam.OpenConnection();

                webCamTimer          = new Timer();
                webCamTimer.Tick    += webCamTimer_Tick;
                webCamTimer.Interval = 200;
                webCamTimer.Start();
            }
            else
            {
                webCamTimer.Stop();
                webCamTimer = null;
                wCam.Dispose();
                wCam = null;
            }
        }
Ejemplo n.º 2
0
 private void WindowsFormsDemoForm_Activated(object sender, EventArgs e)
 {
     if (wCam == null)
     {
         wCam = new WebCam {
             Container = picWebCam
         };
         wCam.OpenConnection();
         webCamTimer          = new Timer();
         webCamTimer.Tick    += webCamTimer_Tick;
         webCamTimer.Interval = 200;
         webCamTimer.Start();
     }
 }
Ejemplo n.º 3
0
        private void btnDecodeWebCam_Click(object sender, EventArgs e)
        {
            if (wCam == null)
            {
                wCam = new WebCam {
                    Container = picWebCam
                };

                wCam.OpenConnection();

                webCamTimer          = new Timer();
                webCamTimer.Tick    += webCamTimer_Tick;
                webCamTimer.Interval = 200;
                webCamTimer.Start();
            }
            else
            {
                webCamTimer.Stop();
                webCamTimer = null;
                wCam.Dispose();
                wCam = null;
            }
        }
Ejemplo n.º 4
0
      private void btnDecodeWebCam_Click(object sender, EventArgs e)
      {
         if (wCam == null)
         {
            wCam = new WebCam {Container = picWebCam};

            wCam.OpenConnection();

            webCamTimer = new Timer();
            webCamTimer.Tick += webCamTimer_Tick;
            webCamTimer.Interval = 200;
            webCamTimer.Start();
         }
         else
         {
            webCamTimer.Stop();
            webCamTimer = null;
            wCam.Dispose();
            wCam = null;
         }
      }
Ejemplo n.º 5
0
        public WindowsFormsDemoForm()
        {
            InitializeComponent();
            DataTable dt1 = oacceso.leerDatos("select detalle from configuraciones where codigo = 'timeleft'");

            foreach (DataRow dr in dt1.Rows)
            {
                timeleft = Convert.ToInt32(dr["detalle"]);
            }
            barcodeReader = new BarcodeReader
            {
                AutoRotate  = true,
                TryInverted = true,
                Options     = new DecodingOptions {
                    TryHarder = true
                }
            };
            barcodeReader.ResultPointFound += point =>
            {
                if (point == null)
                {
                    resultPoints.Clear();
                }
                else
                {
                    resultPoints.Add(point);
                }
            };
            barcodeReader.ResultFound += result =>
            {
                txtType.Clear();
                txtContent.Clear();
                txtTypeWebCam.Clear();
                txtContentWebCam.Clear();
                txtType.Text     = result.BarcodeFormat.ToString();
                txtContent.Text += result.Text + Environment.NewLine;
                DateTime dt  = DateTime.Now;
                Saludo   FRM = new Saludo(result.Text + Environment.NewLine, dt);
                int      x   = 0;
                foreach (Form f in Application.OpenForms)
                {
                    if (f.Name == "Saludo")
                    {
                        x = 1;
                        break;
                    }
                }
                if (x == 0)
                {
                    FRM.ShowDialog();
                    bool f   = FRM.ficho;
                    int  idr = FRM.idr;
                    if (f)
                    {
                        label4.Text = "Ultimo fichaje: " + FRM.empleado + " " + dt.ToString();
                        webCamTimer.Stop();
                        webCamTimer = null;
                        wCam.Dispose();
                        wCam = null;
                        TomaFoto frm1 = new TomaFoto(result.Text + Environment.NewLine, dt, timeleft, idr);
                        frm1.ShowDialog();
                    }
                    else
                    {
                        if (wCam == null)
                        {
                            wCam = new WebCam {
                                Container = picWebCam
                            };
                            wCam.OpenConnection();
                            webCamTimer          = new Timer();
                            webCamTimer.Tick    += webCamTimer_Tick;
                            webCamTimer.Interval = 200;
                            webCamTimer.Start();
                        }
                    }
                }
                txtTypeWebCam.Text     = result.BarcodeFormat.ToString();
                txtContentWebCam.Text += result.Text + Environment.NewLine;
                lastResults.Add(result);
                var parsedResult = ResultParser.parseResult(result);
                if (parsedResult != null)
                {
                    btnExtendedResult.Visible = !(parsedResult is TextParsedResult);
                    txtContent.Text          += "\r\n\r\nParsed result:\r\n" + parsedResult.DisplayResult + Environment.NewLine + Environment.NewLine;
                }
                else
                {
                    btnExtendedResult.Visible = false;
                }
            };
            resultPoints = new List <ResultPoint>();
            lastResults  = new List <Result>();
            Renderer     = typeof(BitmapRenderer);
        }