Example #1
0
        private void GetStatus()
        {
            try
            {
                Constants.ResultCode result = _CurrentReader.GetStatus();

                if ((result != Constants.ResultCode.DP_SUCCESS))
                {
                    if (CurrentReader != null)
                    {
                        CurrentReader.Dispose();
                        CurrentReader = null;
                    }
                    throw new Exception("" + result);
                }

                if ((_CurrentReader.Status.Status == Constants.ReaderStatuses.DP_STATUS_BUSY))
                {
                    Thread.Sleep(50);
                }
                else if ((_CurrentReader.Status.Status == Constants.ReaderStatuses.DP_STATUS_NEED_CALIBRATION))
                {
                    _CurrentReader.Calibrate();
                }
                else if ((_CurrentReader.Status.Status != Constants.ReaderStatuses.DP_STATUS_READY))
                {
                    throw new Exception("Reader Status - " + _CurrentReader.Status.Status);
                }
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message); }
        }
Example #2
0
 /// <summary>
 /// 重置,标记退回到 0.
 /// </summary>
 public override void Reset()
 {
     CurrentIndex     = 0;
     CurrentFileIndex = 0;
     //只需重置第一个,其它的在MoveNext中重置了。
     CurrentReader.Reset();
 }
Example #3
0
        private void OnLoad(BuscarNUC Window)
        {
            Window.Closed += (s, e) =>
            {
                try
                {
                    if (OnProgress == null)
                    {
                        return;
                    }

                    if (!_IsSucceed)
                    {
                        Imputado = null;
                    }

                    OnProgress.Abort();
                    CancelCaptureAndCloseReader(OnCaptured);
                }
                catch (Exception ex)
                {
                    StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al cargar buscar por nuc", ex);
                }
            };

            if (CurrentReader != null)
            {
                CurrentReader.Dispose();
                CurrentReader = null;
            }

            CurrentReader = Readers[0];

            if (CurrentReader == null)
            {
                return;
            }

            if (!OpenReader())
            {
                Window.Close();
            }

            if (!StartCaptureAsync(OnCaptured))
            {
                Window.Close();
            }

            OnProgress = new Thread(() => InvokeDelegate(Window));

            Application.Current.Dispatcher.Invoke((System.Action)(delegate
            {
                ScannerMessage = "Capture Huella";
                ColorMessage   = new SolidColorBrush(Colors.Green);
            }));
        }
        private Task <Transaction[]> LoadNextPageAsync()
        {
            return(Task.Run(() =>
            {
                var transactions = new List <Transaction>();

                Transaction transaction = null;

                string json;

                do
                {
                    json = CurrentReader.ReadLine();
                    if (json != null)
                    {
                        object @event = JsonConvert.DeserializeObject(json, new JsonSerializerSettings
                        {
                            TypeNameHandling = TypeNameHandling.All,
                            TypeNameAssemblyFormat = FormatterAssemblyStyle.Full
                        });

                        string streamId = ExtractStreamIdFrom(@event);
                        if (transaction != null && transaction.StreamId != streamId)
                        {
                            transaction = null;
                        }

                        if (transaction == null)
                        {
                            transaction = new Transaction
                            {
                                Id = Guid.NewGuid().ToString(),
                                TimeStampUtc = DateTime.UtcNow,
                                StreamId = streamId,
                                Checkpoint = lastCheckpoint++
                            };

                            transactions.Add(transaction);
                        }

                        transaction.Events.Add(new EventEnvelope
                        {
                            Body = @event
                        });
                    }
                }while ((json != null) && (transactions.Count < pageSize));

                Console.WriteLine(
                    $"Loaded page of {transactions.Count} transactions " +
                    $"(checkpoint {transactions.First().Checkpoint}-{transactions.Last().Checkpoint}) " +
                    $"with {transactions.Sum(t => t.Events.Count)} events");

                return transactions.ToArray();
            }));
        }
        private Task <Transaction[]> LoadNextPageAsync()
        {
            return(Task.Run(() =>
            {
                var transactions = new List <Transaction>();

                var transaction = new Transaction
                {
                    Checkpoint = ++lastCheckpoint
                };

                string json;

                do
                {
                    json = CurrentReader.ReadLine();

                    if (json != null)
                    {
                        try
                        {
                            transaction.Events.Add(new EventEnvelope
                            {
                                Body = JsonConvert.DeserializeObject(json, new JsonSerializerSettings
                                {
                                    TypeNameHandling = TypeNameHandling.All,
                                    TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Full
                                })
                            });
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                            throw;
                        }
                    }

                    if ((transaction.Events.Count == AverageEventsPerTransaction) || (json == null))
                    {
                        if (transaction.Events.Count > 0)
                        {
                            transactions.Add(transaction);
                        }

                        transaction = new Transaction
                        {
                            Checkpoint = ++lastCheckpoint
                        };
                    }
                }while ((json != null) && (transactions.Count < pageSize));

                return transactions.ToArray();
            }));
        }
        private void OnLoad(object sender)
        {
            try
            {
                Error = "Cargando servicios de lectura";
                var _view = (AutenticacionView)(sender);

                CrearListaImagenes();

                if (CurrentReader != null)
                {
                    CurrentReader.Dispose();
                    CurrentReader = null;
                }

                CurrentReader = Readers[0];

                if (CurrentReader == null)
                {
                    CapturaFalladaDigitalPersona = true;
                    setAutenticaContrasena();
                    CmdOkHabilitado = true;
                    Error           = "El lector de huella no se encuentra conectado";
                    return;
                }

                _view.Closed += (s, e) =>
                {
                    OnProgress.Abort();
                    CancelCaptureAndCloseReader(OnCaptured);
                };

                if (!OpenReader())
                {
                    setAutenticaContrasena();
                    CapturaFalladaDigitalPersona = true;
                    CmdOkHabilitado = true;
                    Error           = "No se puede accesar al lector de huella";
                }
                if (!StartCaptureAsync(OnCaptured))
                {
                    setAutenticaContrasena();
                    CapturaFalladaDigitalPersona = true;
                    CmdOkHabilitado = true;
                    Error           = "No se puede iniciar la aunteticación por huella";
                }
                Error      = string.Empty;
                OnProgress = new Thread(() => InvokeDelegate(_view));
            }
            catch { }
        }
Example #7
0
        /// <summary>
        /// 移动到下一个。
        /// </summary>
        /// <returns>如果没有了,就返回 false </returns>
        public override bool MoveNext()
        {
            bool result = CurrentReader.MoveNext();

            if (result)
            {
                CurrentIndex++;
            }
            else//当前的已经读完,
            {   //还有下一个文件
                if (this.HasNexFile)
                {
                    CurrentFileIndex++;
                    CurrentReader.Reset();//重置
                    return(MoveNext());
                }
            }
            return(result);
        }
Example #8
0
        private void OnLoad(LoginView Window)
        {
            try
            {
                if (CurrentReader != null)
                {
                    CurrentReader.Dispose();
                    CurrentReader = null;
                }

                CurrentReader = Readers[0];

                if (CurrentReader == null)
                {
                    return;
                }

                Window.Closed += (s, e) =>
                {
                    OnProgress.Abort();
                    CancelCaptureAndCloseReader(OnCaptured);
                };

                if (!OpenReader())
                {
                    Window.Close();
                }

                if (!StartCaptureAsync(OnCaptured))
                {
                    Window.Close();
                }

                OnProgress = new Thread(() => InvokeDelegate(Window));
            }
            catch { }
        }
Example #9
0
        private void OnLoad(LoginView Window)
        {
            try
            {
                XMLCentros();
                //Asignamos usuarios temporales
                UsuarioBaseDatos();
                //Validamos si esta habilitado el biometrico de la pantalla
                ValidacionesBiometrico();
                ObtenerPassWord();
                #region Comentado
                //GlobalVar.gArea = Convert.ToInt16(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).AppSettings.Settings["EquipoArea"].Value);
                //LstCentro = LstCentro ?? new ObservableCollection<CENTRO>(new cCentro().ObtenerTodos());
                //LstCentro.Insert(0, new CENTRO() { ID_CENTRO = -1, DESCR = Resources.General.seleccione });
                #endregion
                TBPwd          = Window.tbPassword;
                OriginalHeight = Window.Height;

                if (CurrentReader != null)
                {
                    CurrentReader.Dispose();
                    CurrentReader = null;
                }

                CurrentReader = Readers[0];

                if (CurrentReader == null)
                {
                    return;
                }

                Window.Closed += (s, e) =>
                {
                    try
                    {
                        OnProgress.Abort();
                        CancelCaptureAndCloseReader(OnCaptured);
                    }
                    catch (Exception ex)
                    {
                        var trace = new System.Diagnostics.StackTrace(ex, true);
                        Trace.WriteLine("\n>>>[Ubicación del Problema]");
                        Trace.WriteLine("Clase: " + trace.GetFrame((trace.FrameCount - 1)).GetMethod().ReflectedType.FullName);
                        Trace.WriteLine("Metodo: " + trace.GetFrame((trace.FrameCount - 1)).GetMethod().Name);
                        Trace.WriteLine("Linea: " + trace.GetFrame((trace.FrameCount - 1)).GetFileLineNumber());
                        Trace.WriteLine("Columna: " + trace.GetFrame((trace.FrameCount - 1)).GetFileColumnNumber());
                        Trace.WriteLine(ex.Message + " " + (ex.InnerException != null ? ex.InnerException.InnerException.Message : ""));
                    }
                };

                if (!OpenReader())
                {
                    Window.Close();
                }

                if (!StartCaptureAsync(OnCaptured))
                {
                    Window.Close();
                }

                OnProgress = new Thread(() => InvokeDelegate(Window));
            }
            catch (Exception ex)
            {
                var trace = new System.Diagnostics.StackTrace(ex, true);
                Trace.WriteLine("\n>>>[Ubicación del Problema]");
                Trace.WriteLine("Clase: " + trace.GetFrame((trace.FrameCount - 1)).GetMethod().ReflectedType.FullName);
                Trace.WriteLine("Metodo: " + trace.GetFrame((trace.FrameCount - 1)).GetMethod().Name);
                Trace.WriteLine("Linea: " + trace.GetFrame((trace.FrameCount - 1)).GetFileLineNumber());
                Trace.WriteLine("Columna: " + trace.GetFrame((trace.FrameCount - 1)).GetFileColumnNumber());
                Trace.WriteLine(ex.Message + " " + (ex.InnerException != null ? ex.InnerException.InnerException.Message : ""));
                StaticSourcesViewModel.ShowMessageError(res.General.algo_paso, res.ControlPenales.Login.LoginViewModel.error_login, ex);
            }
        }
        private void OnLoad(LeerCustodioEdificio Window)
        {
            #region [Huellas Digitales]
            var myDoubleAnimation = new DoubleAnimation();
            myDoubleAnimation.From           = 0;
            myDoubleAnimation.To             = 185;
            myDoubleAnimation.Duration       = new Duration(TimeSpan.FromSeconds(1.3));
            myDoubleAnimation.AutoReverse    = true;
            myDoubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
            Storyboard.SetTargetName(myDoubleAnimation, "Ln");
            Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Canvas.TopProperty));
            var myStoryboard = new Storyboard();
            myStoryboard.Children.Add(myDoubleAnimation);
            myStoryboard.Begin(Window.Ln);
            ColorNIPAprobacion   = new SolidColorBrush(Colors.DarkBlue);
            MensajeNipAprobacion = "Capture NIP";
            MarkCheck            = "🔍";
            ImagenPlaceHolder    = new Imagenes();
            ImagenCustodio       = ImagenPlaceHolder.getImagenPerson();
            #endregion

            Window.Closed += (s, e) =>
            {
                try
                {
                    if (OnProgress == null)
                    {
                        return;
                    }

                    if (!IsSucceded)
                    {
                        SelectedRegistroCustodio = null;
                    }

                    OnProgress.Abort();
                    CancelCaptureAndCloseReader(OnCaptured);
                }
                catch (Exception ex)
                {
                    StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al cargar búsqueda", ex);
                }
            };
            if (CurrentReader != null)
            {
                CurrentReader.Dispose();
                CurrentReader = null;
            }
            CurrentReader = Readers[0];

            if (CurrentReader == null)
            {
                return;
            }

            if (!OpenReader())
            {
                Window.Close();
            }

            if (!StartCaptureAsync(OnCaptured))
            {
                Window.Close();
            }

            OnProgress = new Thread(() => InvokeDelegate(Window));
            Application.Current.Dispatcher.Invoke((System.Action)(delegate
            {
                ScannerMessage     = "Capture Huella";
                ColorMensaje       = new SolidColorBrush(Colors.Green);
                ColorNIPAprobacion = new SolidColorBrush(Colors.DarkBlue);
            }));
            GuardandoHuellas = true;
        }
        public void OnLoad(BusquedaHuellaVisita Window)
        {
            SelectedFinger          = enumTipoBiometrico.INDICE_DERECHO;
            HuellasImputadosVisitas = ObtenerHuellasImputados();
            FondoBackSpaceNIP       = new SolidColorBrush(Colors.Green);
            FondoLimpiarNIP         = new SolidColorBrush(Colors.Crimson);
            NIPBuscar          = "";
            ColorAprobacionNIP = new SolidColorBrush(Colors.DarkBlue);
            CheckMark          = "🔍";
            ScannerMessage     = "Capture Huella\nen el lector";
            var placeholder = new Imagenes().getImagenPerson();

            ColorAprobacion              = new SolidColorBrush(Colors.Green);
            ProgressRingVisible          = Visibility.Collapsed;
            ImagenEvaluacion             = new Imagenes().getImagenHuella();
            ScannerMessageVisible        = true;
            ImagenEvaluacionVisible      = Readers.Count > 0;
            TextoIncidenciaFalsoPositivo = "SIN OBSERVACIONES";
            Window.Closed += (s, e) =>
            {
                try
                {
                    if (OnProgress == null)
                    {
                        return;
                    }

                    if (!IsSucceed)
                    {
                        //SelectedCustodio = null;

                        OnProgress.Abort();
                    }
                    CancelCaptureAndCloseReader(OnCaptured);
                }
                catch (Exception ex)
                {
                    StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al cargar la lectura de las huellas", ex);
                }
            };

            if (CurrentReader != null)
            {
                CurrentReader.Dispose();
                CurrentReader = null;
            }

            CurrentReader = Readers[0];

            if (CurrentReader == null)
            {
                return;
            }

            if (!OpenReader())
            {
                Window.Close();
            }

            if (!StartCaptureAsync(OnCaptured))
            {
                Window.Close();
            }

            OnProgress = new Thread(() => InvokeDelegate(Window));
        }
Example #12
0
        private void OnLoad(BuscarPorHuellaYNipView Window)
        {
            try
            {
                BuscarPor       = enumTipoPersona.IMPUTADO;
                ListResultado   = null;
                PropertyImage   = null;
                FotoRegistro    = new Imagenes().getImagenPerson();
                TextNipBusqueda = string.Empty;
                #region [Huellas Digitales]
                var myDoubleAnimation = new DoubleAnimation();
                myDoubleAnimation.From           = 0;
                myDoubleAnimation.To             = 185;
                myDoubleAnimation.Duration       = new Duration(TimeSpan.FromSeconds(1.3));
                myDoubleAnimation.AutoReverse    = true;
                myDoubleAnimation.RepeatBehavior = RepeatBehavior.Forever;

                Storyboard.SetTargetName(myDoubleAnimation, "Ln");
                Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Canvas.TopProperty));
                var myStoryboard = new Storyboard();
                myStoryboard.Children.Add(myDoubleAnimation);
                myStoryboard.Begin(Window.Ln);
                #endregion

                Window.Closed += (s, e) =>
                {
                    try
                    {
                        if (OnProgress == null)
                        {
                            return;
                        }

                        if (!_IsSucceed)
                        {
                            SelectRegistro = null;
                        }

                        OnProgress.Abort();
                        CancelCaptureAndCloseReader(OnCaptured);
                    }
                    catch (Exception ex)
                    {
                        StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al cargar busqueda", ex);
                    }
                };

                if (CurrentReader != null)
                {
                    CurrentReader.Dispose();
                    CurrentReader = null;
                }

                CurrentReader = Readers[0];

                if (CurrentReader == null)
                {
                    return;
                }

                if (!OpenReader())
                {
                    Window.Close();
                }

                if (!StartCaptureAsync(OnCaptured))
                {
                    Window.Close();
                }

                OnProgress = new Thread(() => InvokeDelegate(Window));

                Application.Current.Dispatcher.Invoke((System.Action)(delegate
                {
                    ScannerMessage = "Capture Huella";
                    ColorMessage   = new SolidColorBrush(Colors.Green);
                }));
                GuardandoHuellas = true;
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al cargar los datos de la busqueda por huella.", ex);
            }
        }