Пример #1
0
        private void btnGetTemplates_FIM10_Click(object sender, EventArgs e)
        {
            try
            {
                if (this._objController.IsHamsterConnected() == false)
                {
                    MessageBox.Show("O Hamster não está conectado.", CDefines.SW_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                byte[] rgbySample404_1 = new byte[404];
                byte   byFingerPID_1   = 0;
                byte   bySampleID_1    = 0;
                byte   byQuality_1     = 0;
                byte[] rgbySample404_2 = new byte[404];
                byte   byFingerPID_2   = 0;
                byte   bySampleID_2    = 0;
                byte   byQuality_2     = 0;
                bool   bRotateSamples  = true;

                if (this._objController.GetTemplates_FIM01(ref rgbySample404_1, ref byFingerPID_1, ref bySampleID_1, ref byQuality_1, ref rgbySample404_2, ref byFingerPID_2, ref bySampleID_2, ref byQuality_2, bRotateSamples) == false)
                {
                    MessageBox.Show("Não foi possível realizar a captura das biometrias.", CDefines.SW_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                MessageBox.Show("Biometria capturada com sucesso.", CDefines.SW_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Information);

                frmGeneric formEvent = new frmGeneric(this._objController);
                formEvent.ShowDialog(this);
            }
            catch (Exception exError)
            {
                MessageBox.Show("Erro : " + exError.Message, CDefines.SW_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void tmrVerifyCommand_Tick(object sender, EventArgs e)
        {
            //if (this._eCurrentConnectionState == this._objController.GetConnectionState())
            //{
            //    return;
            //}

            try
            {
                switch (this._objController.GetConnectionState())
                {
                case EConnectionState.None:
                case EConnectionState.Disconnected:
                {
                    this.lblMonitor.Text             = ":: Desconectado ::";
                    this.btnConnectServer.Enabled    = true;
                    this.btnDisconnectServer.Enabled = false;
                    this.grpFunctions.Enabled        = false;
                    this.tmrVerifyCommand.Enabled    = false;

                    this._bConnected = false;
                }
                break;

                case EConnectionState.AttemptConnection:
                {
                    this.lblMonitor.Text             = ":: Conectando... ::";
                    this.btnConnectServer.Enabled    = false;
                    this.btnDisconnectServer.Enabled = true;
                    this.grpFunctions.Enabled        = false;

                    this._bConnected = false;
                }
                break;

                case EConnectionState.AttemptConnectionFail:
                {
                    this._objController.SetConnectionState(EConnectionState.Disconnected);

                    this.lblMonitor.Text = ":: Falha na tentativa de conexão ::";
                    MessageBox.Show("Falha na tentativa de conexão.", CDefines.SW_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);

                    frmGeneric formEvent = new frmGeneric(this._objController);
                    formEvent.ShowDialog(this);

                    this._bConnected = false;
                }
                break;

                case EConnectionState.Connected:
                {
                    this.lblMonitor.Text             = ":: Conectado ::";
                    this.btnConnectServer.Enabled    = false;
                    this.btnDisconnectServer.Enabled = true;
                    this.grpFunctions.Enabled        = true;

                    this._bConnected = true;
                }
                break;

                case EConnectionState.SendingData:
                {
                    this.lblMonitor.Text             = ":: Enviando dados... ::";
                    this.grpFunctions.Enabled        = false;
                    this.btnDisconnectServer.Enabled = true;
                }
                break;

                case EConnectionState.DataReceived:
                {
                    this._objController.SetConnectionState(EConnectionState.Connected);

                    this.lblMonitor.Text = ":: Resposta recebida ::";
                    MessageBox.Show("Resposta do comando " + this._objController.GetCommand().ToString() + " recebida com sucesso.", ":: Resposta do ID REP ::", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    frmGeneric formEvent = new frmGeneric(this._objController);
                    formEvent.ShowDialog(this);
                }
                break;

                case EConnectionState.DataReceivedError:
                {
                    this._objController.SetConnectionState(EConnectionState.Connected);

                    this.lblMonitor.Text = ":: Resposta recebida com erro ::";
                    MessageBox.Show("Resposta do comando " + this._objController.GetCommand().ToString() + " recebida com erro.", ":: Resposta do ID REP ::", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    frmGeneric formEvent = new frmGeneric(this._objController);
                    formEvent.ShowDialog(this);
                }
                break;

                case EConnectionState.ConnectionError:
                {
                    this._objController.SetConnectionState(EConnectionState.Disconnected);

                    this.lblMonitor.Text = ":: Erro na conexão ::";
                    MessageBox.Show("Erro na conexão com o equipamento.", CDefines.SW_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);

                    frmGeneric formEvent = new frmGeneric(this._objController);
                    formEvent.ShowDialog(this);
                }
                break;
                }
            }
            catch (Exception exError)
            {
                MessageBox.Show("Erro : " + exError.Message, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }