private void AddEditStudentFrm_Load(object sender, EventArgs e) { // Init Database _db = ((MainFrm)Parent)._db; // Init FP engine _fpEngine = new AxZKFPEngX(); _fpEngine.BeginInit(); _fpEngine.OnEnroll += new IZKFPEngXEvents_OnEnrollEventHandler(_fpEngine_OnEnroll); _fpEngine.OnImageReceived += new IZKFPEngXEvents_OnImageReceivedEventHandler(_fpEngine_OnImageReceived); this.Controls.Add(_fpEngine); if (_fpEngine.InitEngine() != 0) { MessageBox.Show("ไม่สามารถติดต่อเครื่องสแกนลายนิ้วมือได้", "", MessageBoxButtons.OK, MessageBoxIcon.Error); _fpDeviceConnect = false; } else { _fpDeviceConnect = true; } // For Edit mode if (EditMode == true) { _db.SQLCommand = "SELECT * FROM student WHERE std_id='" + StudentID + "'"; _db.Query(); if (_db.Result.HasRows) { _db.Result.Read(); txtStdID.Text = (string)_db.Result.GetValue(0); txtStdName.Text = (string)_db.Result.GetValue(1); txtStdMajor.Text = (string)_db.Result.GetValue(2); if (_db.Result.GetValue(3) == null) { txtFinger.Text = ""; } else { txtFinger.Text = (string)_db.Result.GetValue(3); } } } }
private void ScanFingerStdFrm_Load(object sender, EventArgs e) { // Init Database _db = ((TeachingViewFrm)Parent)._db; // Init FP engine _fpEngine = new AxZKFPEngX(); _fpEngine.BeginInit(); _fpEngine.OnEnroll += new IZKFPEngXEvents_OnEnrollEventHandler(_fpEngine_OnEnroll); _fpEngine.OnImageReceived += new IZKFPEngXEvents_OnImageReceivedEventHandler(_fpEngine_OnImageReceived); this.Controls.Add(_fpEngine); if (_fpEngine.InitEngine() != 0) { MessageBox.Show("ไม่สามารถติดต่อเครื่องสแกนลายนิ้วมือได้", "", MessageBoxButtons.OK, MessageBoxIcon.Error); if (AutoScanMode == false) { this.Close(); } else { _fpEngine.EndInit(); _fpEngine.EndEngine(); StopAutoScan = true; btnCancel.Enabled = false; } } _fpEngine.BeginEnroll(); txtFPStatus.Text = "วางนิ้ว 3 ครั้ง"; txtFPNo.Text = _cntFPEnroll.ToString(); _timer.Enabled = false; _timer.Interval = 3000; _timer.Tick += new EventHandler(_timer_Tick); txtStdID.Text = StdID; txtStdName.Text = StdName; if (AutoScanMode == false) { btnStop.Visible = false; btnCancel.Visible = false; } }