private async void btnDelete_Click(object sender, RoutedEventArgs e) { if (lsvUser.SelectedItem == null) { await InfoDialog.ShowOK("请选择需要删除指纹信息的人员。"); return; } if ((lsvUser.SelectedItem as custPerDisplayItem).FID != "") { if (await InfoDialog.ShowYesNo("确定删除指定人员的指纹信息吗?") == ContentDialogResult.Secondary) { return; } await GPIOControl.PowerOnFingerprintPower( ); try { // Delete from fingerprint device fgRemoveFingerprint cmd = new fgRemoveFingerprint(Convert.ToUInt16((lsvUser.SelectedItem as custPerDisplayItem).FID.Trim( ))); CommonResult ret = await FingerprintDevice.Execute(cmd); // Update compare file await StorageControl.UpdateFIDByPID((lsvUser.SelectedItem as custPerDisplayItem).PID, string.Empty); await LoadFingprinterInfo( ); } catch (Exception ex) { throw new CommonResult(ResultCode.GN_SYS_ERROR, ex.Message); } finally { GPIOControl.PowerOffFingerprintPower( ); } } else { await InfoDialog.ShowOK("指定的人员没有记录指纹信息。"); } }
private async void btnAdd_Click(object sender, RoutedEventArgs e) { if (lsvUser.SelectedItem == null) { await InfoDialog.ShowOK("请选择需要录入指纹信息的人员。"); return; } string f = (lsvUser.SelectedItem as custPerDisplayItem).FID; if (f == "") { f = (lsvUser.SelectedItem as custPerDisplayItem).PID; } else { if (await InfoDialog.ShowYesNo("指定人员已经具有指纹信息,重新采集指纹将删除之前的指纹信息,确定需要更新指纹信息吗?") == ContentDialogResult.Secondary) { return; } fgRemoveFingerprint cmd = new fgRemoveFingerprint(Convert.ToUInt16(f)); CommonResult ret = await FingerprintDevice.Execute(cmd); } FingerprintCollectDialog dialog = new FingerprintCollectDialog(Convert.ToUInt16(f)); await dialog.ShowAsync( ); if (dialog.DialogResult.Code == ResultCode.GN_SUCCESS) { await StorageControl.UpdateFIDByPID((lsvUser.SelectedItem as custPerDisplayItem).PID, f); await LoadFingprinterInfo( ); } }