Ejemplo n.º 1
0
    }    //end get ticket

    public async Task DetectCoin(CloudCoin coin, int milliSecondsToTimeOut)
    {
        //Task.WaitAll(coin.detectTaskList.ToArray(),Config.milliSecondsToTimeOut);
        //Get data from the detection agents
        //Task.WaitAll(coin.detectTaskList.ToArray(), milliSecondsToTimeOut);
        await Task.WhenAll(coin.detectTaskList);

        for (int i = 0; i < Config.NodeCount; i++)
        {
            var resp = coin.response;
        }    //end for each detection agent

        var counts = coin.response
                     .GroupBy(item => item.outcome == "pass")
                     .Select(grp => new { Number = grp.Key, Count = grp.Count() });

        var countsf = coin.response
                      .GroupBy(item => item.outcome == "fail")
                      .Select(grp => new { Number = grp.Key, Count = grp.Count() });

        Debug.WriteLine("Pass Count -" + counts.Count());
        Debug.WriteLine("Fail Count -" + countsf.Count());

        coin.SetAnsToPansIfPassed();
        coin.CalculateHP();

        coin.CalcExpirationDate();
        coin.grade();
        coin.SortToFolder();
        DetectEventArgs de = new DetectEventArgs(coin);

        OnCoinDetected(de);
    }    //end detect coin
Ejemplo n.º 2
0
        public virtual void OnDetect(object sender, DetectEventArgs e)
        {
            try
            {
                var device = sender as Device;
                device.Freeze(true); //pause captureing to reduce cpu load

                if (!worker.IsBusy)
                {
                    //leave native callback context
                    var localImage = e.Image.Clone() as Image;
                    //scanner specific image processing
                    worker.RunWorkerAsync(localImage);
                }
            }
            catch (Exception ex)
            {
                InvokeScannerError(sender, new ScannerErrorEventArgs("Processing error: " + ex.Message, ex));
            }
        }
Ejemplo n.º 3
0
        void _capDevice_OnDetect(object sender, DetectEventArgs e)
        {
            //try
            //{
            //    if (pictureBoxResult.InvokeRequired)
            //    {
            //        OnDetect onDetect = new OnDetect(_capDevice_OnDetect);
            //        pictureBoxResult.BeginInvoke(onDetect, new object[] { sender, e });
            //    }
            //    else
            //    {
            //        DateTime before = DateTime.Now;
            //        try
            //        {
            //            if (this._capDevice.CaptureMode == CaptureMode.ROLLED_FINGER)
            //            {
            //                LifenessInfo_1 lfInfoRollTest = (LifenessInfo_1)this._capDevice.GetCurrentFrameInfo(FrameInfoTypes.E_LIFENESS_INFO_1);

            //                if (lfInfoRollTest.State == 0)
            //                {
            //                    this.toolStripStatusFake.ForeColor = Color.Green;
            //                    this.toolStripStatusFake.Text = string.Format("Rolled finger Ok!");
            //                }
            //                else
            //                {
            //                    this.toolStripStatusFake.ForeColor = Color.Orange;
            //                    this.toolStripStatusFake.Text = string.Format("Rolled finger failed! Errorcode: {0} ", lfInfoRollTest.State);
            //                }
            //            }

            //            //check Fake/Live detection is enabled
            //            if (_capDevice.Property.ContainsKey(PropertyType.FG_FAKE_DETECT) && this._capDevice.Property[PropertyType.FG_FAKE_DETECT] > 0)
            //            {
            //                //Get frame information to check the Liveness or Fake
            //                LifenessInfo_1 lfInfo = (LifenessInfo_1)this._capDevice.GetCurrentFrameInfo(FrameInfoTypes.E_LIFENESS_INFO_1);
            //                System.Diagnostics.Trace.WriteLine(string.Format("Possible Fake Finger score {0} ", Math.Round(lfInfo.Score, 2)), "Information");
            //                this.toolStripStatusDeviceInfo.Text = "Frame info state: " + lfInfo.State;
            //                //Possible Fake Finger
            //                if (lfInfo.Score < 50)
            //                {
            //                    this.toolStripStatusFake.ForeColor = Color.Orange;
            //                    this.toolStripStatusFake.Text = string.Format("Possible Fake Finger score {0} ", Math.Round(lfInfo.Score, 2));
            //                    pictureBoxResult.Image = null;
            //                }
            //                else
            //                {
            //                    this.toolStripStatusFake.ForeColor = Color.Green;
            //                    this.toolStripStatusFake.Text = string.Format("Real Finger score {0} ", Math.Round(lfInfo.Score, 2));
            //                }
            //            }
            //        }
            //        //not all devices support Liveness/fake detection
            //        //so we ignore the exception in this case.
            //        catch (DeviceException exp)
            //        {
            //            System.Diagnostics.Trace.WriteLine(exp.ToString(), "Warning");
            //        }
            //        finally
            //        {
            //            //LifenessInfo_1 lfInfo = (LifenessInfo_1)this._capDevice.GetCurrentFrameInfo(FrameInfoTypes.E_LIFENESS_INFO_1);
            //            //MessageBox.Show("STATE: " + lfInfo.State);
            //            //this.toolTip.Show("Frame info state: " + lfInfo.State, pictureBoxResult);
            //            //this.toolStripStatusDeviceInfo.Text = "Frame info state: " + lfInfo.State;

            //            imageHolder.Image = e.Image;
            //            System.Diagnostics.Trace.WriteLine(
            //              string.Format("Finger detection done in {0} ms", (DateTime.Now - before).Milliseconds), "Information");
            //            //this.saveToolStripMenuItem.Enabled = true;
            //        }
            //    }
            //}
            //catch (DeviceException)
            //{
            //}

            imageHolder.Image = e.Image;
        }
Ejemplo n.º 4
0
 protected virtual void OnCoinDetected(DetectEventArgs e)
 {
     //  CoinDetected?.Invoke(this, e);
 }
Ejemplo n.º 5
0
 void _device_OnDetect(object sender, DetectEventArgs e)
 {
     this.Device.Freeze(true);
     InvokeOnDetect(e.Image.Clone() as Image);
     OnDetect(sender, e);
 }