private void connectButton_Click(object sender, EventArgs e) { connectProgress.Visible = true; connectButton.Enabled = false; FpsGt511C1R.Close(); var status = FpsGt511C1R.Open(Port, Baud); if (status == 1) { DialogResult = DialogResult.OK; IsConnected = true; connectBg.BackColor = Color.Green; connectText.Text = Resources.FPS_CONNECTED; } else { DialogResult = DialogResult.None; IsConnected = false; connectBg.BackColor = Color.Red; connectText.Text = Resources.FPS_DISCONNECTED; FpsGt511C1R.Close(); MessageBox.Show( $"Got connect error #{status}.\nYou may need to manually reset the device and try again."); } connectButton.Enabled = true; connectProgress.Visible = false; }
private void ScanFingerForm_Load(object sender, EventArgs e) { var t = Task.Factory.StartNew(() => { CurrentState = State.FingerNotPressed; FpsGt511C1R.SetCmosLed(true); while (!FpsGt511C1R.IsPressingFinger()) { Task.Delay(1000); } CurrentState = State.FingerPressed; CurrentState = State.TransferingData; Fingerprint = FpsGt511C1R.GetRawImage(); FpsGt511C1R.SetCmosLed(false); CurrentState = State.TransferComplete; DialogResult = DialogResult.OK; SafeClose(); }); t.Start(); }
public virtual void Dispose() { FpsGt511C1R.Close(); Dispose(true); }