示例#1
0
 private void btnClose_Click(object sender, EventArgs e)
 {
     if (capturing)
     {
         try
         {
             FPCore.StopCapture(Sensor);
             capturing = false;
         }
         catch (FingerprintException ex)
         {
             MessageBox.Show(String.Format("StopCapture Error : {0} {1}", ex.ErrorCode, ex.Message), "FPLibrary Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     if (CloseOnCapture)
     {
         this.DialogResult = DialogResult.Cancel;
     }
     else if (CaptureMultiple && CapturedFingers.Count > 0)
     {
         this.DialogResult = DialogResult.OK;
     }
     else
     {
         this.DialogResult = DialogResult.Cancel;
     }
     this.Close();
 }
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing && (components != null))
     {
         if (capturing)
         {
             try
             {
                 FPCore.StopCapture(Sensor);
             }
             catch (FingerprintException ex)
             {
                 MessageBox.Show(String.Format("StopCapture Error : {0} {1}", ex.ErrorCode, ex.Message), "FPLibrary Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         components.Dispose();
     }
     base.Dispose(disposing);
 }