├── .vs
└── ZKTecoFingerPrintScanner-Implementation
│ └── v15
│ ├── Server
│ └── sqlite3
│ │ ├── db.lock
│ │ └── storage.ide
│ └── .suo
├── ZKTecoFingerPrintScanner-Implementation
├── obj
│ └── Debug
│ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
│ │ ├── ZKTecoFingerPrintScanner-Implementation.csproj.CopyComplete
│ │ ├── ZKTecoFingerPrintScanner-Implementation.csproj.CoreCompileInputs.cache
│ │ ├── DesignTimeResolveAssemblyReferences.cache
│ │ ├── ZKTecoFingerPrintScanner-Implementation.exe
│ │ ├── ZKTecoFingerPrintScanner-Implementation.pdb
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ ├── ZKTecoFingerPrintScanner_Implementation.Master.resources
│ │ ├── ZKTecoFingerPrintScanner_Implementation.Controls.StatusBar.resources
│ │ ├── ZKTecoFingerPrintScanner-Implementation.csproj.GenerateResource.Cache
│ │ ├── ZKTecoFingerPrintScanner-Implementation.csprojAssemblyReference.cache
│ │ ├── ZKTecoFingerPrintScanner_Implementation.Properties.Resources.resources
│ │ ├── Dofe_Re_Entry.UserControls.DeviceController.FingerPrintControl.resources
│ │ ├── ZKTecoFingerPrintScanner-Implementation.csprojResolveAssemblyReference.cache
│ │ └── ZKTecoFingerPrintScanner-Implementation.csproj.FileListAbsolute.txt
├── Working Demo.zip
├── libzkfpcsharp.dll
├── bin
│ └── Debug
│ │ ├── libzkfpcsharp.dll
│ │ ├── ZKTecoFingerPrintScanner-Implementation.exe
│ │ ├── ZKTecoFingerPrintScanner-Implementation.pdb
│ │ └── ZKTecoFingerPrintScanner-Implementation.exe.config
├── App.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Helpers
│ ├── GraphicsManager.cs
│ ├── Utilities.cs
│ ├── MessageManager.cs
│ ├── FingerPrintDeviceUtilities.cs
│ └── BitmapFormat.cs
├── Program.cs
├── Controls
│ ├── StatusBar.cs
│ ├── StatusBar.designer.cs
│ ├── StatusBar.resx
│ ├── FingerPrintControl.resx
│ ├── FingerPrintControl.designer.cs
│ └── FingerPrintControl.cs
├── Master.cs
├── ZKTecoFingerPrintScanner-Implementation.csproj
└── Master.Designer.cs
├── resources
├── image1.png
└── image2.png
├── README.md
└── ZKTecoFingerPrintScanner-Implementation.sln
/.vs/ZKTecoFingerPrintScanner-Implementation/v15/Server/sqlite3/db.lock:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner-Implementation.csproj.CopyComplete:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/resources/image1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/resources/image1.png
--------------------------------------------------------------------------------
/resources/image2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/resources/image2.png
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner-Implementation.csproj.CoreCompileInputs.cache:
--------------------------------------------------------------------------------
1 | ffdd279d3b6c30f72e4f362962ffaa2afc831bcd
2 |
--------------------------------------------------------------------------------
/.vs/ZKTecoFingerPrintScanner-Implementation/v15/.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/.vs/ZKTecoFingerPrintScanner-Implementation/v15/.suo
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Working Demo.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/Working Demo.zip
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/libzkfpcsharp.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/libzkfpcsharp.dll
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/bin/Debug/libzkfpcsharp.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/bin/Debug/libzkfpcsharp.dll
--------------------------------------------------------------------------------
/.vs/ZKTecoFingerPrintScanner-Implementation/v15/Server/sqlite3/storage.ide:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/.vs/ZKTecoFingerPrintScanner-Implementation/v15/Server/sqlite3/storage.ide
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/bin/Debug/ZKTecoFingerPrintScanner-Implementation.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/bin/Debug/ZKTecoFingerPrintScanner-Implementation.exe
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/bin/Debug/ZKTecoFingerPrintScanner-Implementation.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/bin/Debug/ZKTecoFingerPrintScanner-Implementation.pdb
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/DesignTimeResolveAssemblyReferences.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/obj/Debug/DesignTimeResolveAssemblyReferences.cache
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner-Implementation.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner-Implementation.exe
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner-Implementation.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner-Implementation.pdb
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner_Implementation.Master.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner_Implementation.Master.resources
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/bin/Debug/ZKTecoFingerPrintScanner-Implementation.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner_Implementation.Controls.StatusBar.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner_Implementation.Controls.StatusBar.resources
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner-Implementation.csproj.GenerateResource.Cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner-Implementation.csproj.GenerateResource.Cache
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner-Implementation.csprojAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner-Implementation.csprojAssemblyReference.cache
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner_Implementation.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner_Implementation.Properties.Resources.resources
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/Dofe_Re_Entry.UserControls.DeviceController.FingerPrintControl.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/obj/Debug/Dofe_Re_Entry.UserControls.DeviceController.FingerPrintControl.resources
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner-Implementation.csprojResolveAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zaagan/ZKTecoFingerPrintScanner-Implementation/HEAD/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner-Implementation.csprojResolveAssemblyReference.cache
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Helpers/GraphicsManager.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace ZKTecoFingerPrintScanner_Implementation.Helpers
5 | {
6 | public class GraphicsManager
7 | {
8 | public static void DrawLine(Control frm, Color color, int x, int y, int x1, int y1, int thickness)
9 | {
10 | Graphics graphicsObj;
11 | graphicsObj = frm.CreateGraphics();
12 | Pen myPen = new Pen(color, thickness);
13 | graphicsObj.DrawLine(myPen, x, y, x1, y1);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace ZKTecoFingerPrintScanner_Implementation
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Master());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ZKTecoFingerPrintScanner-Implementation
2 | A C# implementation of the **ZkFingerprint Scanner**
3 |
4 |
5 |
6 | > **NOTE :**
7 | >
8 | > The necessary drivers and SDK are not provided here.
9 | > They must be separately downloaded from the official website.
10 |
11 |
12 |
13 | ## Supported Devices
14 |
15 | - ZK4500
16 | - ZK9500
17 | - SLK20R
18 | - SLK20M
19 |
20 |
21 |
22 | ## Documentation
23 |
24 | Head over to the [C# ZKTeco FingerPrint Scanner Implemenation](https://www.debuggershub.com/c-zkteco-fingerprint-scanner-implementation-zk4500-slk20m-slk20r-zk9500/) for the description.
25 |
26 |
27 |
28 | ## Demo App UI Samples
29 |
30 | 
31 |
32 | 
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Controls/StatusBar.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace ZKTecoFingerPrintScanner_Implementation.Controls
5 | {
6 | public partial class StatusBar : UserControl
7 | {
8 |
9 | public Color StatusBarForeColor
10 | {
11 | get { return lblMessage.ForeColor; }
12 | set { lblMessage.ForeColor = value; }
13 | }
14 |
15 | public Color StatusBarBackColor
16 | {
17 | get { return lblMessage.BackColor; }
18 | set { lblMessage.BackColor = value; }
19 | }
20 |
21 |
22 | bool messageType;
23 |
24 | public bool MessageType
25 | {
26 | get { return messageType; }
27 | set { messageType = value; }
28 | }
29 | public string Message
30 | {
31 | get { return lblMessage.Text; }
32 | set { lblMessage.Text = value; }
33 | }
34 |
35 | public StatusBar()
36 | {
37 | InitializeComponent();
38 |
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ZKTecoFingerPrintScanner_Implementation.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.28307.329
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZKTecoFingerPrintScanner-Implementation", "ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation.csproj", "{62C43BC8-1B23-49A8-9FFA-B702A9815204}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {62C43BC8-1B23-49A8-9FFA-B702A9815204}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {62C43BC8-1B23-49A8-9FFA-B702A9815204}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {62C43BC8-1B23-49A8-9FFA-B702A9815204}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {62C43BC8-1B23-49A8-9FFA-B702A9815204}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {695C57A3-6E98-4A91-A4EF-28B40A4F0D1A}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ZKTecoFingerPrintScanner-Implementation")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ZKTecoFingerPrintScanner-Implementation")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("62c43bc8-1b23-49a8-9ffa-b702a9815204")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Helpers/Utilities.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Drawing.Imaging;
4 | using System.Runtime.InteropServices;
5 | using System.Windows.Forms;
6 |
7 | namespace ZKTecoFingerPrintScanner_Implementation.Helpers
8 | {
9 | public class Utilities
10 | {
11 | public static void EnableControls(bool enableControl, params Control[] controls)
12 | {
13 | foreach (var control in controls)
14 | {
15 | control.Enabled = enableControl;
16 | }
17 | }
18 |
19 | public static Bitmap GetImage(byte[] buffer, int width, int height)
20 | {
21 | Bitmap output = new Bitmap(width, height);
22 | Rectangle rect = new Rectangle(0, 0, width, height);
23 | BitmapData bmpData = output.LockBits(rect, ImageLockMode.ReadWrite, output.PixelFormat);
24 | IntPtr ptr = bmpData.Scan0;
25 |
26 | Marshal.Copy(buffer, 0, ptr, buffer.Length);
27 | output.UnlockBits(bmpData);
28 |
29 | return output;
30 | }
31 |
32 |
33 | public static void ShowStatusBar(string message, Controls.StatusBar statusBar, bool type)
34 | {
35 | statusBar.Visible = true;
36 | statusBar.Message = message;
37 | statusBar.StatusBarForeColor = Color.White;
38 | if (type)
39 | statusBar.StatusBarBackColor = Color.FromArgb(79, 208, 154);
40 | else
41 | statusBar.StatusBarBackColor = Color.FromArgb(230, 112, 134);
42 |
43 | }
44 |
45 |
46 |
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Helpers/MessageManager.cs:
--------------------------------------------------------------------------------
1 | namespace ZKTecoFingerPrintScanner_Implementation.Helpers
2 | {
3 | public class MessageManager
4 | {
5 | public const string msg_FP_InitComplete = "Initialization completed";
6 |
7 | public const string msg_FP_NotConnected = "No device connected !!";
8 |
9 | public const string msg_FP_PressForVerification = "Please press your finger for verification !";
10 |
11 | public const string msg_FP_PressForIdentification = "Please press your finger for identification !";
12 |
13 | public const string msg_FP_CurrentFingerAlreadyRegistered = "This finger is already registerd with id ";
14 |
15 | public const string msg_FP_EnrollSuccessfull = "You have successfully enrolled the user.";
16 |
17 | public const string msg_FP_FailedToAddTemplate = "Failed to add the users template";
18 |
19 | public const string msg_FP_UnableToEnrollCurrentUser = "Unable to enroll the current user. Error Code: ";
20 |
21 | public const string msg_FP_MatchSuccess = "Match Successfull. Score: ";
22 |
23 | public const string msg_FP_MatchFailed = "Match Failed. Score: ";
24 |
25 | public const string msg_FP_IdentificationSuccess = "Identification Failed. Score: ";
26 |
27 | public const string msg_FP_IdentificationFailed = "Identification Failed. Score: ";
28 |
29 | public const string msg_FP_UnidentifiedFingerPrint = "Un-identified fingerprint. Please enroll to register.";
30 |
31 | public const string msg_FP_Disconnected = "You have disconnected from the device. ";
32 |
33 | public const string msg_FP_FailedToReleaseResources = "Failed to release the resources !!";
34 |
35 | public const string msg_FP_UnableToDeleteFingerPrint = "Unable to delete the fingerprint with id ";
36 |
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Master.cs:
--------------------------------------------------------------------------------
1 | using Dofe_Re_Entry.UserControls.DeviceController;
2 | using System.ComponentModel;
3 | using System.Drawing;
4 | using System.Windows.Forms;
5 | using ZKTecoFingerPrintScanner_Implementation.Helpers;
6 |
7 | namespace ZKTecoFingerPrintScanner_Implementation
8 | {
9 | public partial class Master : Form
10 | {
11 | FingerPrintControl fingerPrintControl = null;
12 | public Master()
13 | {
14 | InitializeComponent();
15 | pnlStage.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
16 |
17 | LoadFingerprintControl();
18 |
19 | }
20 |
21 |
22 |
23 | ///
24 | /// Before closing the application clear all the resources used by the application
25 | ///
26 | ///
27 | protected override void OnClosing(CancelEventArgs e)
28 | {
29 | base.OnClosing(e);
30 |
31 | try
32 | {
33 |
34 | if (fingerPrintControl != null)
35 | {
36 | if (fingerPrintControl.cmbIdx.Items.Count > 0)
37 | fingerPrintControl.OnDisconnect();
38 | }
39 | }
40 | catch
41 | { }
42 | }
43 |
44 | private void LoadFingerprintControl()
45 | {
46 | fingerPrintControl = new FingerPrintControl();
47 | fingerPrintControl.parentForm = this;
48 | fingerPrintControl.Dock = DockStyle.Fill;
49 | pnlStage.Controls.Add(fingerPrintControl);
50 | }
51 |
52 |
53 | private void panel2_Paint(object sender, PaintEventArgs e)
54 | {
55 | int y = panel2.Height;
56 | GraphicsManager.DrawLine(panel2, Color.LightGray, 0, y, panel2.Width, y, 2);
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Helpers/FingerPrintDeviceUtilities.cs:
--------------------------------------------------------------------------------
1 | namespace ZKTecoFingerPrintScanner_Implementation.Helpers
2 | {
3 | public class FingerPrintDeviceUtilities
4 | {
5 | public static string DisplayDeviceErrorByCode(int errCode)
6 | {
7 | string message = string.Empty;
8 | switch (errCode)
9 | {
10 | case -25: message = "The device is already connected"; break;
11 |
12 | case -24: message = "The device is not initialized"; break;
13 |
14 | case -23: message = "The device is not started"; break;
15 |
16 | case -22: message = "Failed to combine the registered fingerprint templates."; break;
17 |
18 | case -20: message = "Fingeprint comparison failed"; break;
19 |
20 | case -18: message = "Capture cancelled"; break;
21 |
22 | case -17: message = "Operation failed"; break;
23 |
24 | case -14: message = "Failed to delete the fingerprint template"; break;
25 |
26 | case -13: message = "Failed to add the fingerprint template"; break;
27 |
28 | case -12: message = "The fingerprint is being captured"; break;
29 |
30 | case -11: message = "Insufficient memory"; break;
31 |
32 | case -10: message = "Aborted"; break;
33 |
34 | case -9: message = "Failed to extract the fingerprint template"; break;
35 |
36 | case -8: message = "Failed to capture the image"; break;
37 |
38 | case -7: message = "Invalid Handle"; break;
39 |
40 | case -6: message = "Failed to start the device"; break;
41 |
42 | case -5: message = "Invalid parameter"; break;
43 |
44 | case -4: message = "Not supported by the interface"; break;
45 |
46 | case -3: message = "No device connected"; break;
47 |
48 | case -2: message = "Failed to initalize the capture library"; break;
49 |
50 | case -1: message = "Failed to initialize the algorithm library"; break;
51 |
52 | case 0: message = "Operation succeeded"; break;
53 |
54 | case 1: message = "Initalized"; break;
55 |
56 | default: message = "Unknown operation"; break;
57 | }
58 |
59 | return message;
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Controls/StatusBar.designer.cs:
--------------------------------------------------------------------------------
1 | namespace ZKTecoFingerPrintScanner_Implementation.Controls
2 | {
3 | partial class StatusBar
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.lblMessage = new System.Windows.Forms.Label();
32 | this.SuspendLayout();
33 | //
34 | // lblMessage
35 | //
36 | this.lblMessage.AutoEllipsis = true;
37 | this.lblMessage.Dock = System.Windows.Forms.DockStyle.Fill;
38 | this.lblMessage.Font = new System.Drawing.Font("Segoe UI", 12F);
39 | this.lblMessage.Location = new System.Drawing.Point(0, 0);
40 | this.lblMessage.Name = "lblMessage";
41 | this.lblMessage.Size = new System.Drawing.Size(488, 23);
42 | this.lblMessage.TabIndex = 0;
43 | this.lblMessage.Text = "label1";
44 | //
45 | // StatusBar
46 | //
47 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
48 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
49 | this.Controls.Add(this.lblMessage);
50 | this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
51 | this.Name = "StatusBar";
52 | this.Size = new System.Drawing.Size(488, 23);
53 | this.ResumeLayout(false);
54 |
55 | }
56 |
57 | #endregion
58 |
59 | private System.Windows.Forms.Label lblMessage;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ZKTecoFingerPrintScanner_Implementation.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ZKTecoFingerPrintScanner_Implementation.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/obj/Debug/ZKTecoFingerPrintScanner-Implementation.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | E:\Workspace\BitBucket\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\Dofe_Re_Entry.UserControls.DeviceController.FingerPrintControl.resources
2 | E:\Workspace\BitBucket\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner_Implementation.Controls.StatusBar.resources
3 | E:\Workspace\BitBucket\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner_Implementation.Master.resources
4 | E:\Workspace\BitBucket\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner_Implementation.Properties.Resources.resources
5 | E:\Workspace\BitBucket\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner-Implementation.csproj.GenerateResource.cache
6 | E:\Workspace\BitBucket\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner-Implementation.csproj.CoreCompileInputs.cache
7 | E:\Workspace\BitBucket\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\bin\Debug\ZKTecoFingerPrintScanner-Implementation.exe.config
8 | E:\Workspace\BitBucket\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\bin\Debug\ZKTecoFingerPrintScanner-Implementation.exe
9 | E:\Workspace\BitBucket\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\bin\Debug\ZKTecoFingerPrintScanner-Implementation.pdb
10 | E:\Workspace\BitBucket\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\bin\Debug\libzkfpcsharp.dll
11 | E:\Workspace\BitBucket\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner-Implementation.csproj.CopyComplete
12 | E:\Workspace\BitBucket\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner-Implementation.exe
13 | E:\Workspace\BitBucket\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner-Implementation.pdb
14 | E:\Workspace\BitBucket\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner-Implementation.csprojAssemblyReference.cache
15 | D:\BioMatrix\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\bin\Debug\ZKTecoFingerPrintScanner-Implementation.exe.config
16 | D:\BioMatrix\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\bin\Debug\ZKTecoFingerPrintScanner-Implementation.exe
17 | D:\BioMatrix\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\bin\Debug\ZKTecoFingerPrintScanner-Implementation.pdb
18 | D:\BioMatrix\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner-Implementation.csprojResolveAssemblyReference.cache
19 | D:\BioMatrix\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\Dofe_Re_Entry.UserControls.DeviceController.FingerPrintControl.resources
20 | D:\BioMatrix\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner_Implementation.Controls.StatusBar.resources
21 | D:\BioMatrix\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner_Implementation.Master.resources
22 | D:\BioMatrix\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner_Implementation.Properties.Resources.resources
23 | D:\BioMatrix\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner-Implementation.csproj.GenerateResource.Cache
24 | D:\BioMatrix\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner-Implementation.csproj.CoreCompileInputs.cache
25 | D:\BioMatrix\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner-Implementation.exe
26 | D:\BioMatrix\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\obj\Debug\ZKTecoFingerPrintScanner-Implementation.pdb
27 | D:\BioMatrix\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\ZKTecoFingerPrintScanner-Implementation\bin\Debug\libzkfpcsharp.dll
28 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/ZKTecoFingerPrintScanner-Implementation.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {62C43BC8-1B23-49A8-9FFA-B702A9815204}
8 | WinExe
9 | ZKTecoFingerPrintScanner_Implementation
10 | ZKTecoFingerPrintScanner-Implementation
11 | v4.6.1
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 | False
37 | C:\Windows\SysWOW64\libzkfpcsharp.dll
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | UserControl
54 |
55 |
56 | FingerPrintControl.cs
57 |
58 |
59 | UserControl
60 |
61 |
62 | StatusBar.cs
63 |
64 |
65 |
66 |
67 |
68 |
69 | Form
70 |
71 |
72 | Master.cs
73 |
74 |
75 |
76 |
77 |
78 | FingerPrintControl.cs
79 |
80 |
81 | StatusBar.cs
82 |
83 |
84 | Master.cs
85 |
86 |
87 | ResXFileCodeGenerator
88 | Resources.Designer.cs
89 | Designer
90 |
91 |
92 | True
93 | Resources.resx
94 |
95 |
96 | SettingsSingleFileGenerator
97 | Settings.Designer.cs
98 |
99 |
100 | True
101 | Settings.settings
102 | True
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 | Always
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Master.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ZKTecoFingerPrintScanner_Implementation
2 | {
3 | partial class Master
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Master));
32 | this.pnlStage = new System.Windows.Forms.Panel();
33 | this.panel2 = new System.Windows.Forms.Panel();
34 | this.lblHeader = new System.Windows.Forms.Label();
35 | this.statusBar = new ZKTecoFingerPrintScanner_Implementation.Controls.StatusBar();
36 | this.panel2.SuspendLayout();
37 | this.SuspendLayout();
38 | //
39 | // pnlStage
40 | //
41 | this.pnlStage.Location = new System.Drawing.Point(12, 47);
42 | this.pnlStage.Name = "pnlStage";
43 | this.pnlStage.Size = new System.Drawing.Size(434, 303);
44 | this.pnlStage.TabIndex = 2;
45 | //
46 | // panel2
47 | //
48 | this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(236)))), ((int)(((byte)(236)))), ((int)(((byte)(236)))));
49 | this.panel2.Controls.Add(this.lblHeader);
50 | this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
51 | this.panel2.Location = new System.Drawing.Point(0, 0);
52 | this.panel2.Name = "panel2";
53 | this.panel2.Size = new System.Drawing.Size(460, 37);
54 | this.panel2.TabIndex = 445;
55 | this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint);
56 | //
57 | // lblHeader
58 | //
59 | this.lblHeader.AutoSize = true;
60 | this.lblHeader.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
61 | this.lblHeader.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(116)))), ((int)(((byte)(116)))), ((int)(((byte)(116)))));
62 | this.lblHeader.Location = new System.Drawing.Point(8, 9);
63 | this.lblHeader.Name = "lblHeader";
64 | this.lblHeader.Size = new System.Drawing.Size(210, 19);
65 | this.lblHeader.TabIndex = 1;
66 | this.lblHeader.Text = "Fingerprint Scanner Demo";
67 | //
68 | // statusBar
69 | //
70 | this.statusBar.Dock = System.Windows.Forms.DockStyle.Bottom;
71 | this.statusBar.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
72 | this.statusBar.Location = new System.Drawing.Point(0, 355);
73 | this.statusBar.Message = "label1";
74 | this.statusBar.MessageType = false;
75 | this.statusBar.Name = "statusBar";
76 | this.statusBar.Size = new System.Drawing.Size(460, 23);
77 | this.statusBar.StatusBarBackColor = System.Drawing.SystemColors.Control;
78 | this.statusBar.StatusBarForeColor = System.Drawing.SystemColors.ControlText;
79 | this.statusBar.TabIndex = 1;
80 | this.statusBar.Visible = false;
81 | //
82 | // Master
83 | //
84 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
85 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
86 | this.ClientSize = new System.Drawing.Size(460, 378);
87 | this.Controls.Add(this.panel2);
88 | this.Controls.Add(this.pnlStage);
89 | this.Controls.Add(this.statusBar);
90 | this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
91 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
92 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
93 | this.Margin = new System.Windows.Forms.Padding(2);
94 | this.MaximizeBox = false;
95 | this.MaximumSize = new System.Drawing.Size(476, 417);
96 | this.MinimumSize = new System.Drawing.Size(476, 417);
97 | this.Name = "Master";
98 | this.Text = "Master";
99 | this.panel2.ResumeLayout(false);
100 | this.panel2.PerformLayout();
101 | this.ResumeLayout(false);
102 |
103 | }
104 |
105 | #endregion
106 | public Controls.StatusBar statusBar;
107 | private System.Windows.Forms.Panel pnlStage;
108 | private System.Windows.Forms.Panel panel2;
109 | private System.Windows.Forms.Label lblHeader;
110 | }
111 | }
112 |
113 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Controls/StatusBar.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Controls/FingerPrintControl.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Helpers/BitmapFormat.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.IO;
4 |
5 | namespace ZKTecoFingerPrintScanner_Implementation.Helpers
6 | {
7 | public class BitmapFormat
8 | {
9 | public struct BITMAPFILEHEADER
10 | {
11 | public ushort bfType;
12 | public int bfSize;
13 | public ushort bfReserved1;
14 | public ushort bfReserved2;
15 | public int bfOffBits;
16 | }
17 |
18 | public struct MASK
19 | {
20 | public byte redmask;
21 | public byte greenmask;
22 | public byte bluemask;
23 | public byte rgbReserved;
24 | }
25 |
26 | public struct BITMAPINFOHEADER
27 | {
28 | public int biSize;
29 | public int biWidth;
30 | public int biHeight;
31 | public ushort biPlanes;
32 | public ushort biBitCount;
33 | public int biCompression;
34 | public int biSizeImage;
35 | public int biXPelsPerMeter;
36 | public int biYPelsPerMeter;
37 | public int biClrUsed;
38 | public int biClrImportant;
39 | }
40 |
41 | /*******************************************
42 | * º¯ÊýÃû³Æ£ºRotatePic
43 | * º¯Êý¹¦ÄÜ£ºÐýתͼƬ£¬Ä¿µÄÊDZ£´æºÍÏÔʾµÄͼƬÓë°´µÄÖ¸ÎÆ·½Ïò²»Í¬
44 | * º¯ÊýÈë²Î£ºBmpBuf---ÐýתǰµÄÖ¸ÎÆ×Ö·û´®
45 | * º¯Êý³ö²Î£ºResBuf---ÐýתºóµÄÖ¸ÎÆ×Ö·û´®
46 | * º¯Êý·µ»Ø£ºÎÞ
47 | *********************************************/
48 | public static void RotatePic(byte[] BmpBuf, int width, int height, ref byte[] ResBuf)
49 | {
50 | int RowLoop = 0;
51 | int ColLoop = 0;
52 | int BmpBuflen = width * height;
53 |
54 | try
55 | {
56 | for (RowLoop = 0; RowLoop < BmpBuflen;)
57 | {
58 | for (ColLoop = 0; ColLoop < width; ColLoop++)
59 | {
60 | ResBuf[RowLoop + ColLoop] = BmpBuf[BmpBuflen - RowLoop - width + ColLoop];
61 | }
62 |
63 | RowLoop = RowLoop + width;
64 | }
65 | }
66 | catch (Exception ex)
67 | {
68 | //ZKCE.SysException.ZKCELogger logger = new ZKCE.SysException.ZKCELogger(ex);
69 | //logger.Append();
70 | }
71 | }
72 |
73 | /*******************************************
74 | * º¯ÊýÃû³Æ£ºStructToBytes
75 | * º¯Êý¹¦ÄÜ£º½«½á¹¹Ìåת»¯³ÉÎÞ·ûºÅ×Ö·û´®Êý×é
76 | * º¯ÊýÈë²Î£ºStructObj---±»×ª»¯µÄ½á¹¹Ìå
77 | * Size---±»×ª»¯µÄ½á¹¹ÌåµÄ´óС
78 | * º¯Êý³ö²Î£ºÎÞ
79 | * º¯Êý·µ»Ø£º½á¹¹Ìåת»¯ºóµÄÊý×é
80 | *********************************************/
81 | public static byte[] StructToBytes(object StructObj, int Size)
82 | {
83 | int StructSize = Marshal.SizeOf(StructObj);
84 | byte[] GetBytes = new byte[StructSize];
85 |
86 | try
87 | {
88 | IntPtr StructPtr = Marshal.AllocHGlobal(StructSize);
89 | Marshal.StructureToPtr(StructObj, StructPtr, false);
90 | Marshal.Copy(StructPtr, GetBytes, 0, StructSize);
91 | Marshal.FreeHGlobal(StructPtr);
92 |
93 | if (Size == 14)
94 | {
95 | byte[] NewBytes = new byte[Size];
96 | int Count = 0;
97 | int Loop = 0;
98 |
99 | for (Loop = 0; Loop < StructSize; Loop++)
100 | {
101 | if (Loop != 2 && Loop != 3)
102 | {
103 | NewBytes[Count] = GetBytes[Loop];
104 | Count++;
105 | }
106 | }
107 |
108 | return NewBytes;
109 | }
110 | else
111 | {
112 | return GetBytes;
113 | }
114 | }
115 | catch (Exception ex)
116 | {
117 | //ZKCE.SysException.ZKCELogger logger = new ZKCE.SysException.ZKCELogger(ex);
118 | //logger.Append();
119 |
120 | return GetBytes;
121 | }
122 | }
123 |
124 | /*******************************************
125 | * º¯ÊýÃû³Æ£ºGetBitmap
126 | * º¯Êý¹¦ÄÜ£º½«´«½øÀ´µÄÊý¾Ý±£´æÎªÍ¼Æ¬
127 | * º¯ÊýÈë²Î£ºbuffer---ͼƬÊý¾Ý
128 | * nWidth---ͼƬµÄ¿í¶È
129 | * nHeight---ͼƬµÄ¸ß¶È
130 | * º¯Êý³ö²Î£ºÎÞ
131 | * º¯Êý·µ»Ø£ºÎÞ
132 | *********************************************/
133 | public static void GetBitmap(byte[] buffer, int nWidth, int nHeight, ref MemoryStream ms)
134 | {
135 | int ColorIndex = 0;
136 | ushort m_nBitCount = 8;
137 | int m_nColorTableEntries = 256;
138 | byte[] ResBuf = new byte[nWidth * nHeight * 2];
139 |
140 | try
141 | {
142 | BITMAPFILEHEADER BmpHeader = new BITMAPFILEHEADER();
143 | BITMAPINFOHEADER BmpInfoHeader = new BITMAPINFOHEADER();
144 | MASK[] ColorMask = new MASK[m_nColorTableEntries];
145 |
146 | int w = (((nWidth + 3) / 4) * 4);
147 |
148 | //ͼƬͷÐÅÏ¢
149 | BmpInfoHeader.biSize = Marshal.SizeOf(BmpInfoHeader);
150 | BmpInfoHeader.biWidth = nWidth;
151 | BmpInfoHeader.biHeight = nHeight;
152 | BmpInfoHeader.biPlanes = 1;
153 | BmpInfoHeader.biBitCount = m_nBitCount;
154 | BmpInfoHeader.biCompression = 0;
155 | BmpInfoHeader.biSizeImage = 0;
156 | BmpInfoHeader.biXPelsPerMeter = 0;
157 | BmpInfoHeader.biYPelsPerMeter = 0;
158 | BmpInfoHeader.biClrUsed = m_nColorTableEntries;
159 | BmpInfoHeader.biClrImportant = m_nColorTableEntries;
160 |
161 | //ÎļþÍ·ÐÅÏ¢
162 | BmpHeader.bfType = 0x4D42;
163 | BmpHeader.bfOffBits = 14 + Marshal.SizeOf(BmpInfoHeader) + BmpInfoHeader.biClrUsed * 4;
164 | BmpHeader.bfSize = BmpHeader.bfOffBits + ((((w * BmpInfoHeader.biBitCount + 31) / 32) * 4) * BmpInfoHeader.biHeight);
165 | BmpHeader.bfReserved1 = 0;
166 | BmpHeader.bfReserved2 = 0;
167 |
168 | ms.Write(StructToBytes(BmpHeader, 14), 0, 14);
169 | ms.Write(StructToBytes(BmpInfoHeader, Marshal.SizeOf(BmpInfoHeader)), 0, Marshal.SizeOf(BmpInfoHeader));
170 |
171 | //µ÷ÊÔ°åÐÅÏ¢
172 | for (ColorIndex = 0; ColorIndex < m_nColorTableEntries; ColorIndex++)
173 | {
174 | ColorMask[ColorIndex].redmask = (byte)ColorIndex;
175 | ColorMask[ColorIndex].greenmask = (byte)ColorIndex;
176 | ColorMask[ColorIndex].bluemask = (byte)ColorIndex;
177 | ColorMask[ColorIndex].rgbReserved = 0;
178 |
179 | ms.Write(StructToBytes(ColorMask[ColorIndex], Marshal.SizeOf(ColorMask[ColorIndex])), 0, Marshal.SizeOf(ColorMask[ColorIndex]));
180 | }
181 |
182 | //ͼƬÐýת£¬½â¾öÖ¸ÎÆÍ¼Æ¬µ¹Á¢µÄÎÊÌâ
183 | RotatePic(buffer, nWidth, nHeight, ref ResBuf);
184 |
185 | byte[] filter = null;
186 | if (w - nWidth > 0)
187 | {
188 | filter = new byte[w - nWidth];
189 | }
190 | for (int i = 0; i < nHeight; i++)
191 | {
192 | ms.Write(ResBuf, i * nWidth, nWidth);
193 | if (w - nWidth > 0)
194 | {
195 | ms.Write(ResBuf, 0, w - nWidth);
196 | }
197 | }
198 | }
199 | catch (Exception ex)
200 | {
201 | // ZKCE.SysException.ZKCELogger logger = new ZKCE.SysException.ZKCELogger(ex);
202 | // logger.Append();
203 | }
204 | }
205 |
206 | /*******************************************
207 | * º¯ÊýÃû³Æ£ºWriteBitmap
208 | * º¯Êý¹¦ÄÜ£º½«´«½øÀ´µÄÊý¾Ý±£´æÎªÍ¼Æ¬
209 | * º¯ÊýÈë²Î£ºbuffer---ͼƬÊý¾Ý
210 | * nWidth---ͼƬµÄ¿í¶È
211 | * nHeight---ͼƬµÄ¸ß¶È
212 | * º¯Êý³ö²Î£ºÎÞ
213 | * º¯Êý·µ»Ø£ºÎÞ
214 | *********************************************/
215 | public static void WriteBitmap(byte[] buffer, int nWidth, int nHeight)
216 | {
217 | int ColorIndex = 0;
218 | ushort m_nBitCount = 8;
219 | int m_nColorTableEntries = 256;
220 | byte[] ResBuf = new byte[nWidth * nHeight];
221 |
222 | try
223 | {
224 |
225 | BITMAPFILEHEADER BmpHeader = new BITMAPFILEHEADER();
226 | BITMAPINFOHEADER BmpInfoHeader = new BITMAPINFOHEADER();
227 | MASK[] ColorMask = new MASK[m_nColorTableEntries];
228 | int w = (((nWidth + 3) / 4) * 4);
229 | //ͼƬͷÐÅÏ¢
230 | BmpInfoHeader.biSize = Marshal.SizeOf(BmpInfoHeader);
231 | BmpInfoHeader.biWidth = nWidth;
232 | BmpInfoHeader.biHeight = nHeight;
233 | BmpInfoHeader.biPlanes = 1;
234 | BmpInfoHeader.biBitCount = m_nBitCount;
235 | BmpInfoHeader.biCompression = 0;
236 | BmpInfoHeader.biSizeImage = 0;
237 | BmpInfoHeader.biXPelsPerMeter = 0;
238 | BmpInfoHeader.biYPelsPerMeter = 0;
239 | BmpInfoHeader.biClrUsed = m_nColorTableEntries;
240 | BmpInfoHeader.biClrImportant = m_nColorTableEntries;
241 |
242 | //ÎļþÍ·ÐÅÏ¢
243 | BmpHeader.bfType = 0x4D42;
244 | BmpHeader.bfOffBits = 14 + Marshal.SizeOf(BmpInfoHeader) + BmpInfoHeader.biClrUsed * 4;
245 | BmpHeader.bfSize = BmpHeader.bfOffBits + ((((w * BmpInfoHeader.biBitCount + 31) / 32) * 4) * BmpInfoHeader.biHeight);
246 | BmpHeader.bfReserved1 = 0;
247 | BmpHeader.bfReserved2 = 0;
248 |
249 | Stream FileStream = File.Open("finger.bmp", FileMode.Create, FileAccess.Write);
250 | BinaryWriter TmpBinaryWriter = new BinaryWriter(FileStream);
251 |
252 | TmpBinaryWriter.Write(StructToBytes(BmpHeader, 14));
253 | TmpBinaryWriter.Write(StructToBytes(BmpInfoHeader, Marshal.SizeOf(BmpInfoHeader)));
254 |
255 | //µ÷ÊÔ°åÐÅÏ¢
256 | for (ColorIndex = 0; ColorIndex < m_nColorTableEntries; ColorIndex++)
257 | {
258 | ColorMask[ColorIndex].redmask = (byte)ColorIndex;
259 | ColorMask[ColorIndex].greenmask = (byte)ColorIndex;
260 | ColorMask[ColorIndex].bluemask = (byte)ColorIndex;
261 | ColorMask[ColorIndex].rgbReserved = 0;
262 |
263 | TmpBinaryWriter.Write(StructToBytes(ColorMask[ColorIndex], Marshal.SizeOf(ColorMask[ColorIndex])));
264 | }
265 |
266 | //ͼƬÐýת£¬½â¾öÖ¸ÎÆÍ¼Æ¬µ¹Á¢µÄÎÊÌâ
267 | RotatePic(buffer, nWidth, nHeight, ref ResBuf);
268 |
269 | //дͼƬ
270 | //TmpBinaryWriter.Write(ResBuf);
271 | byte[] filter = null;
272 | if (w - nWidth > 0)
273 | {
274 | filter = new byte[w - nWidth];
275 | }
276 | for (int i = 0; i < nHeight; i++)
277 | {
278 | TmpBinaryWriter.Write(ResBuf, i * nWidth, nWidth);
279 | if (w - nWidth > 0)
280 | {
281 | TmpBinaryWriter.Write(ResBuf, 0, w - nWidth);
282 | }
283 | }
284 |
285 | FileStream.Close();
286 | TmpBinaryWriter.Close();
287 | }
288 | catch (Exception ex)
289 | {
290 | //ZKCE.SysException.ZKCELogger logger = new ZKCE.SysException.ZKCELogger(ex);
291 | //logger.Append();
292 | }
293 | }
294 | }
295 | }
296 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Controls/FingerPrintControl.designer.cs:
--------------------------------------------------------------------------------
1 | namespace Dofe_Re_Entry.UserControls.DeviceController
2 | {
3 | partial class FingerPrintControl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.lblDeviceStatus = new System.Windows.Forms.Label();
32 | this.btnInit = new System.Windows.Forms.Button();
33 | this.lblFingerPrintCount = new System.Windows.Forms.Label();
34 | this.btnEnroll = new System.Windows.Forms.Button();
35 | this.cmbIdx = new System.Windows.Forms.ComboBox();
36 | this.label43 = new System.Windows.Forms.Label();
37 | this.picFPImg = new System.Windows.Forms.PictureBox();
38 | this.btnVerify = new System.Windows.Forms.Button();
39 | this.btnIdentify = new System.Windows.Forms.Button();
40 | this.btnClose = new System.Windows.Forms.Button();
41 | this.groupBox1 = new System.Windows.Forms.GroupBox();
42 | this.btnFree = new System.Windows.Forms.Button();
43 | ((System.ComponentModel.ISupportInitialize)(this.picFPImg)).BeginInit();
44 | this.groupBox1.SuspendLayout();
45 | this.SuspendLayout();
46 | //
47 | // lblDeviceStatus
48 | //
49 | this.lblDeviceStatus.AutoEllipsis = true;
50 | this.lblDeviceStatus.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
51 | this.lblDeviceStatus.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(105)))), ((int)(((byte)(204)))), ((int)(((byte)(240)))));
52 | this.lblDeviceStatus.Location = new System.Drawing.Point(11, 0);
53 | this.lblDeviceStatus.Margin = new System.Windows.Forms.Padding(3, 10, 3, 0);
54 | this.lblDeviceStatus.Name = "lblDeviceStatus";
55 | this.lblDeviceStatus.Padding = new System.Windows.Forms.Padding(0, 4, 5, 0);
56 | this.lblDeviceStatus.Size = new System.Drawing.Size(298, 36);
57 | this.lblDeviceStatus.TabIndex = 782;
58 | this.lblDeviceStatus.Text = "Disconnected";
59 | //
60 | // btnInit
61 | //
62 | this.btnInit.BackColor = System.Drawing.Color.White;
63 | this.btnInit.Cursor = System.Windows.Forms.Cursors.Hand;
64 | this.btnInit.FlatAppearance.BorderColor = System.Drawing.SystemColors.ControlDark;
65 | this.btnInit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
66 | this.btnInit.Font = new System.Drawing.Font("Segoe UI", 9F);
67 | this.btnInit.ForeColor = System.Drawing.Color.Black;
68 | this.btnInit.Location = new System.Drawing.Point(6, 19);
69 | this.btnInit.Name = "btnInit";
70 | this.btnInit.Size = new System.Drawing.Size(125, 37);
71 | this.btnInit.TabIndex = 1;
72 | this.btnInit.Text = "Initialize Device";
73 | this.btnInit.UseVisualStyleBackColor = false;
74 | this.btnInit.Click += new System.EventHandler(this.bnInit_Click);
75 | //
76 | // lblFingerPrintCount
77 | //
78 | this.lblFingerPrintCount.AutoSize = true;
79 | this.lblFingerPrintCount.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F);
80 | this.lblFingerPrintCount.Location = new System.Drawing.Point(332, 197);
81 | this.lblFingerPrintCount.Name = "lblFingerPrintCount";
82 | this.lblFingerPrintCount.Size = new System.Drawing.Size(42, 46);
83 | this.lblFingerPrintCount.TabIndex = 783;
84 | this.lblFingerPrintCount.Text = "3";
85 | //
86 | // btnEnroll
87 | //
88 | this.btnEnroll.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(105)))), ((int)(((byte)(204)))), ((int)(((byte)(240)))));
89 | this.btnEnroll.Cursor = System.Windows.Forms.Cursors.Hand;
90 | this.btnEnroll.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(105)))), ((int)(((byte)(204)))), ((int)(((byte)(240)))));
91 | this.btnEnroll.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
92 | this.btnEnroll.Font = new System.Drawing.Font("Segoe UI", 9F);
93 | this.btnEnroll.ForeColor = System.Drawing.Color.White;
94 | this.btnEnroll.Location = new System.Drawing.Point(267, 20);
95 | this.btnEnroll.Name = "btnEnroll";
96 | this.btnEnroll.Size = new System.Drawing.Size(138, 36);
97 | this.btnEnroll.TabIndex = 767;
98 | this.btnEnroll.Text = "Click To Enroll";
99 | this.btnEnroll.UseVisualStyleBackColor = false;
100 | this.btnEnroll.Click += new System.EventHandler(this.bnEnroll_Click);
101 | //
102 | // cmbIdx
103 | //
104 | this.cmbIdx.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
105 | this.cmbIdx.FormattingEnabled = true;
106 | this.cmbIdx.Location = new System.Drawing.Point(145, 127);
107 | this.cmbIdx.Name = "cmbIdx";
108 | this.cmbIdx.Size = new System.Drawing.Size(40, 21);
109 | this.cmbIdx.TabIndex = 11;
110 | //
111 | // label43
112 | //
113 | this.label43.AutoSize = true;
114 | this.label43.Font = new System.Drawing.Font("Arial", 8.75F, System.Drawing.FontStyle.Bold);
115 | this.label43.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
116 | this.label43.Location = new System.Drawing.Point(11, 129);
117 | this.label43.Name = "label43";
118 | this.label43.Size = new System.Drawing.Size(112, 15);
119 | this.label43.TabIndex = 758;
120 | this.label43.Text = "Available Devices :";
121 | //
122 | // picFPImg
123 | //
124 | this.picFPImg.BackColor = System.Drawing.Color.Transparent;
125 | this.picFPImg.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
126 | this.picFPImg.Location = new System.Drawing.Point(14, 157);
127 | this.picFPImg.Name = "picFPImg";
128 | this.picFPImg.Size = new System.Drawing.Size(125, 129);
129 | this.picFPImg.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
130 | this.picFPImg.TabIndex = 779;
131 | this.picFPImg.TabStop = false;
132 | //
133 | // btnVerify
134 | //
135 | this.btnVerify.BackColor = System.Drawing.Color.White;
136 | this.btnVerify.Cursor = System.Windows.Forms.Cursors.Hand;
137 | this.btnVerify.FlatAppearance.BorderColor = System.Drawing.SystemColors.ControlDark;
138 | this.btnVerify.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
139 | this.btnVerify.Font = new System.Drawing.Font("Segoe UI", 9F);
140 | this.btnVerify.ForeColor = System.Drawing.Color.Black;
141 | this.btnVerify.Location = new System.Drawing.Point(145, 188);
142 | this.btnVerify.Name = "btnVerify";
143 | this.btnVerify.Size = new System.Drawing.Size(138, 34);
144 | this.btnVerify.TabIndex = 775;
145 | this.btnVerify.Text = "Verify";
146 | this.btnVerify.UseVisualStyleBackColor = false;
147 | this.btnVerify.Click += new System.EventHandler(this.bnVerify_Click);
148 | //
149 | // btnIdentify
150 | //
151 | this.btnIdentify.BackColor = System.Drawing.Color.White;
152 | this.btnIdentify.Cursor = System.Windows.Forms.Cursors.Hand;
153 | this.btnIdentify.FlatAppearance.BorderColor = System.Drawing.SystemColors.ControlDark;
154 | this.btnIdentify.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
155 | this.btnIdentify.Font = new System.Drawing.Font("Segoe UI", 9F);
156 | this.btnIdentify.ForeColor = System.Drawing.Color.Black;
157 | this.btnIdentify.Location = new System.Drawing.Point(315, 9);
158 | this.btnIdentify.Name = "btnIdentify";
159 | this.btnIdentify.Size = new System.Drawing.Size(98, 34);
160 | this.btnIdentify.TabIndex = 778;
161 | this.btnIdentify.Text = "Identify User";
162 | this.btnIdentify.UseVisualStyleBackColor = false;
163 | this.btnIdentify.Visible = false;
164 | this.btnIdentify.Click += new System.EventHandler(this.bnIdentify_Click);
165 | //
166 | // btnClose
167 | //
168 | this.btnClose.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(112)))), ((int)(((byte)(134)))));
169 | this.btnClose.Cursor = System.Windows.Forms.Cursors.Hand;
170 | this.btnClose.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(112)))), ((int)(((byte)(134)))));
171 | this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
172 | this.btnClose.Font = new System.Drawing.Font("Segoe UI", 9F);
173 | this.btnClose.ForeColor = System.Drawing.Color.White;
174 | this.btnClose.Location = new System.Drawing.Point(137, 20);
175 | this.btnClose.Name = "btnClose";
176 | this.btnClose.Size = new System.Drawing.Size(124, 36);
177 | this.btnClose.TabIndex = 777;
178 | this.btnClose.Text = "Disconnect Device";
179 | this.btnClose.UseVisualStyleBackColor = false;
180 | this.btnClose.Click += new System.EventHandler(this.bnClose_Click);
181 | //
182 | // groupBox1
183 | //
184 | this.groupBox1.Controls.Add(this.btnInit);
185 | this.groupBox1.Controls.Add(this.btnEnroll);
186 | this.groupBox1.Controls.Add(this.btnClose);
187 | this.groupBox1.Font = new System.Drawing.Font("Arial", 8.75F, System.Drawing.FontStyle.Bold);
188 | this.groupBox1.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
189 | this.groupBox1.Location = new System.Drawing.Point(8, 49);
190 | this.groupBox1.Name = "groupBox1";
191 | this.groupBox1.Size = new System.Drawing.Size(418, 66);
192 | this.groupBox1.TabIndex = 785;
193 | this.groupBox1.TabStop = false;
194 | this.groupBox1.Text = "Connection";
195 | //
196 | // btnFree
197 | //
198 | this.btnFree.BackColor = System.Drawing.Color.White;
199 | this.btnFree.Cursor = System.Windows.Forms.Cursors.Hand;
200 | this.btnFree.Enabled = false;
201 | this.btnFree.FlatAppearance.BorderColor = System.Drawing.SystemColors.ControlDark;
202 | this.btnFree.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
203 | this.btnFree.Font = new System.Drawing.Font("Segoe UI", 9F);
204 | this.btnFree.ForeColor = System.Drawing.Color.Black;
205 | this.btnFree.Location = new System.Drawing.Point(145, 228);
206 | this.btnFree.Name = "btnFree";
207 | this.btnFree.Size = new System.Drawing.Size(138, 34);
208 | this.btnFree.TabIndex = 786;
209 | this.btnFree.Text = "Free Resources";
210 | this.btnFree.UseVisualStyleBackColor = false;
211 | this.btnFree.Click += new System.EventHandler(this.bnFree_Click);
212 | //
213 | // FingerPrintControl
214 | //
215 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
216 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
217 | this.Controls.Add(this.lblFingerPrintCount);
218 | this.Controls.Add(this.btnFree);
219 | this.Controls.Add(this.cmbIdx);
220 | this.Controls.Add(this.label43);
221 | this.Controls.Add(this.groupBox1);
222 | this.Controls.Add(this.btnVerify);
223 | this.Controls.Add(this.btnIdentify);
224 | this.Controls.Add(this.lblDeviceStatus);
225 | this.Controls.Add(this.picFPImg);
226 | this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
227 | this.Name = "FingerPrintControl";
228 | this.Size = new System.Drawing.Size(434, 303);
229 | this.Load += new System.EventHandler(this.FingerPrintControl_Load);
230 | ((System.ComponentModel.ISupportInitialize)(this.picFPImg)).EndInit();
231 | this.groupBox1.ResumeLayout(false);
232 | this.ResumeLayout(false);
233 | this.PerformLayout();
234 |
235 | }
236 |
237 | #endregion
238 |
239 | private System.Windows.Forms.Button btnInit;
240 | private System.Windows.Forms.Label label43;
241 | private System.Windows.Forms.Button btnVerify;
242 | private System.Windows.Forms.Button btnEnroll;
243 | private System.Windows.Forms.Button btnClose;
244 | private System.Windows.Forms.Button btnIdentify;
245 | private System.Windows.Forms.PictureBox picFPImg;
246 | private System.Windows.Forms.Label lblDeviceStatus;
247 | private System.Windows.Forms.Label lblFingerPrintCount;
248 | private System.Windows.Forms.GroupBox groupBox1;
249 | private System.Windows.Forms.Button btnFree;
250 | public System.Windows.Forms.ComboBox cmbIdx;
251 | }
252 | }
253 |
--------------------------------------------------------------------------------
/ZKTecoFingerPrintScanner-Implementation/Controls/FingerPrintControl.cs:
--------------------------------------------------------------------------------
1 | using libzkfpcsharp;
2 | using System;
3 | using System.Drawing;
4 | using System.IO;
5 | using System.Runtime.InteropServices;
6 | using System.Threading;
7 | using System.Windows.Forms;
8 | using ZKTecoFingerPrintScanner_Implementation;
9 | using ZKTecoFingerPrintScanner_Implementation.Helpers;
10 |
11 | namespace Dofe_Re_Entry.UserControls.DeviceController
12 | {
13 | public partial class FingerPrintControl : UserControl
14 | {
15 |
16 | const string VerifyButtonDefault = "Verify";
17 | const string VerifyButtonToggle = "Stop Verification";
18 | const string Disconnected = "Disconnected";
19 |
20 | Thread captureThread = null;
21 |
22 | public Master parentForm = null;
23 |
24 | #region -------- FIELDS --------
25 |
26 | const int REGISTER_FINGER_COUNT = 3;
27 |
28 | zkfp fpInstance = new zkfp();
29 | IntPtr FormHandle = IntPtr.Zero; // To hold the handle of the form
30 | bool bIsTimeToDie = false;
31 | bool IsRegister = false;
32 | bool bIdentify = true;
33 | byte[] FPBuffer; // Image Buffer
34 | int RegisterCount = 0;
35 |
36 | byte[][] RegTmps = new byte[REGISTER_FINGER_COUNT][];
37 |
38 | byte[] RegTmp = new byte[2048];
39 | byte[] CapTmp = new byte[2048];
40 | int cbCapTmp = 2048;
41 | int regTempLen = 0;
42 | int iFid = 1;
43 |
44 | const int MESSAGE_CAPTURED_OK = 0x0400 + 6;
45 |
46 |
47 |
48 |
49 | private int mfpWidth = 0;
50 | private int mfpHeight = 0;
51 |
52 |
53 | #endregion
54 |
55 |
56 | // [ CONSTRUCTOR ]
57 | public FingerPrintControl()
58 | {
59 | InitializeComponent();
60 |
61 | ReInitializeInstance();
62 | }
63 |
64 |
65 | // [ INITALIZE DEVICE ]
66 | private void bnInit_Click(object sender, EventArgs e)
67 | {
68 | parentForm.statusBar.Visible = false;
69 | cmbIdx.Items.Clear();
70 |
71 | int initializeCallBackCode = fpInstance.Initialize();
72 | if (zkfp.ZKFP_ERR_OK == initializeCallBackCode)
73 | {
74 | int nCount = fpInstance.GetDeviceCount();
75 | if (nCount > 0)
76 | {
77 | for (int i = 1; i <= nCount; i++) cmbIdx.Items.Add(i.ToString());
78 |
79 | cmbIdx.SelectedIndex = 0;
80 | btnInit.Enabled = false;
81 |
82 | DisplayMessage(MessageManager.msg_FP_InitComplete, true);
83 | }
84 | else
85 | {
86 | int finalizeCount = fpInstance.Finalize();
87 | DisplayMessage(MessageManager.msg_FP_NotConnected, false);
88 | }
89 |
90 |
91 |
92 |
93 | // CONNECT DEVICE
94 |
95 | #region -------- CONNECT DEVICE --------
96 |
97 | int openDeviceCallBackCode = fpInstance.OpenDevice(cmbIdx.SelectedIndex);
98 | if (zkfp.ZKFP_ERR_OK != openDeviceCallBackCode)
99 | {
100 | DisplayMessage($"Uable to connect with the device! (Return Code: {openDeviceCallBackCode} )", false);
101 | return;
102 | }
103 |
104 | Utilities.EnableControls(false, btnInit);
105 | Utilities.EnableControls(true, btnClose, btnEnroll, btnVerify, btnIdentify, btnFree);
106 |
107 | RegisterCount = 0;
108 | regTempLen = 0;
109 | iFid = 1;
110 |
111 | //for (int i = 0; i < 3; i++)
112 | for (int i = 0; i < REGISTER_FINGER_COUNT; i++)
113 | {
114 | RegTmps[i] = new byte[2048];
115 | }
116 |
117 | byte[] paramValue = new byte[4];
118 | int size = 4;
119 |
120 | //fpInstance.GetParameters
121 |
122 | fpInstance.GetParameters(1, paramValue, ref size);
123 | zkfp2.ByteArray2Int(paramValue, ref mfpWidth);
124 |
125 | size = 4;
126 | fpInstance.GetParameters(2, paramValue, ref size);
127 | zkfp2.ByteArray2Int(paramValue, ref mfpHeight);
128 |
129 | FPBuffer = new byte[mfpWidth * mfpHeight];
130 |
131 | //FPBuffer = new byte[fpInstance.imageWidth * fpInstance.imageHeight];
132 |
133 | captureThread = new Thread(new ThreadStart(DoCapture));
134 | captureThread.IsBackground = true;
135 | captureThread.Start();
136 |
137 |
138 | bIsTimeToDie = false;
139 |
140 | string devSN = fpInstance.devSn;
141 | lblDeviceStatus.Text = "Connected \nDevice S.No: " + devSN;
142 |
143 | DisplayMessage("You are now connected to the device.", true);
144 |
145 |
146 |
147 | #endregion
148 |
149 | }
150 | else
151 | DisplayMessage("Unable to initailize the device. " + FingerPrintDeviceUtilities.DisplayDeviceErrorByCode(initializeCallBackCode) + " !! ", false);
152 |
153 | }
154 |
155 |
156 |
157 | // [ CAPTURE FINGERPRINT ]
158 | private void DoCapture()
159 | {
160 | try
161 | {
162 | while (!bIsTimeToDie)
163 | {
164 | cbCapTmp = 2048;
165 | int ret = fpInstance.AcquireFingerprint(FPBuffer, CapTmp, ref cbCapTmp);
166 |
167 | if (ret == zkfp.ZKFP_ERR_OK)
168 | {
169 | //if (RegisterCount == 0)
170 | // btnEnroll.Invoke((Action)delegate
171 | // {
172 | // btnEnroll.Enabled = true;
173 | // });
174 | SendMessage(FormHandle, MESSAGE_CAPTURED_OK, IntPtr.Zero, IntPtr.Zero);
175 | }
176 | Thread.Sleep(100);
177 | }
178 | }
179 | catch { }
180 |
181 | }
182 |
183 | [DllImport("user32.dll", EntryPoint = "SendMessageA")]
184 | public static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);
185 |
186 |
187 | private void bnIdentify_Click(object sender, EventArgs e)
188 | {
189 | if (!bIdentify)
190 | {
191 | bIdentify = true;
192 | DisplayMessage(MessageManager.msg_FP_PressForIdentification, true);
193 | }
194 | }
195 |
196 | private void bnVerify_Click(object sender, EventArgs e)
197 | {
198 | if (bIdentify)
199 | {
200 | bIdentify = false;
201 | btnVerify.Text = VerifyButtonToggle;
202 | DisplayMessage(MessageManager.msg_FP_PressForVerification, true);
203 | }
204 | else
205 | {
206 | bIdentify = true;
207 | btnVerify.Text = VerifyButtonDefault;
208 | }
209 | }
210 |
211 |
212 | protected override void DefWndProc(ref Message m)
213 | {
214 | switch (m.Msg)
215 | {
216 | case MESSAGE_CAPTURED_OK:
217 | {
218 | parentForm.statusBar.Visible = false;
219 | DisplayFingerPrintImage();
220 |
221 | if (IsRegister)
222 | {
223 | #region -------- IF REGISTERED FINGERPRINT --------
224 |
225 | int ret = zkfp.ZKFP_ERR_OK;
226 | int fid = 0, score = 0;
227 | ret = fpInstance.Identify(CapTmp, ref fid, ref score);
228 | if (zkfp.ZKFP_ERR_OK == ret)
229 | {
230 | int deleteCode = fpInstance.DelRegTemplate(fid); // <---- REMOVE FINGERPRINT
231 | if (deleteCode != zkfp.ZKFP_ERR_OK)
232 | {
233 | DisplayMessage(MessageManager.msg_FP_CurrentFingerAlreadyRegistered + fid, false);
234 | return;
235 | }
236 | }
237 | if (RegisterCount > 0 && fpInstance.Match(CapTmp, RegTmps[RegisterCount - 1]) <= 0)
238 | {
239 | DisplayMessage("Please press the same finger " + REGISTER_FINGER_COUNT + " times for enrollment", true);
240 |
241 | return;
242 | }
243 | Array.Copy(CapTmp, RegTmps[RegisterCount], cbCapTmp);
244 |
245 |
246 | if (RegisterCount == 0) btnEnroll.Enabled = false;
247 |
248 | RegisterCount++;
249 | if (RegisterCount >= REGISTER_FINGER_COUNT)
250 | {
251 |
252 | RegisterCount = 0;
253 | ret = GenerateRegisteredFingerPrint(); // <--- GENERATE FINGERPRINT TEMPLATE
254 |
255 | if (zkfp.ZKFP_ERR_OK == ret)
256 | {
257 |
258 | ret = AddTemplateToMemory(); // <--- LOAD TEMPLATE TO MEMORY
259 | if (zkfp.ZKFP_ERR_OK == ret) // <--- ENROLL SUCCESSFULL
260 | {
261 | string fingerPrintTemplate = string.Empty;
262 | zkfp.Blob2Base64String(RegTmp, regTempLen, ref fingerPrintTemplate);
263 |
264 | Utilities.EnableControls(true, btnVerify, btnIdentify);
265 | Utilities.EnableControls(false, btnEnroll);
266 |
267 |
268 | // GET THE TEMPLATE HERE : fingerPrintTemplate
269 |
270 |
271 | DisplayMessage(MessageManager.msg_FP_EnrollSuccessfull, true);
272 |
273 | DisconnectFingerPrintCounter();
274 | }
275 | else
276 | DisplayMessage(MessageManager.msg_FP_FailedToAddTemplate, false);
277 |
278 | }
279 | else
280 | DisplayMessage(MessageManager.msg_FP_UnableToEnrollCurrentUser + ret, false);
281 |
282 | IsRegister = false;
283 | return;
284 | }
285 | else
286 | {
287 | int remainingCont = REGISTER_FINGER_COUNT - RegisterCount;
288 | lblFingerPrintCount.Text = remainingCont.ToString();
289 | string message = "Please provide your fingerprint " + remainingCont + " more time(s)";
290 |
291 | DisplayMessage(message, true);
292 |
293 | }
294 | #endregion
295 | }
296 | else
297 | {
298 |
299 | #region ------- IF RANDOM FINGERPRINT -------
300 | // If unidentified random fingerprint is applied
301 |
302 | if (regTempLen <= 0)
303 | {
304 | DisplayMessage(MessageManager.msg_FP_UnidentifiedFingerPrint, false);
305 | return;
306 | }
307 |
308 |
309 | if (bIdentify)
310 | {
311 | int ret = zkfp.ZKFP_ERR_OK;
312 | int fid = 0, score = 0;
313 | ret = fpInstance.Identify(CapTmp, ref fid, ref score);
314 | if (zkfp.ZKFP_ERR_OK == ret)
315 | {
316 | DisplayMessage(MessageManager.msg_FP_IdentificationSuccess + ret, true);
317 | return;
318 | }
319 | else
320 | {
321 | DisplayMessage(MessageManager.msg_FP_IdentificationFailed + ret, false);
322 | return;
323 | }
324 | }
325 | else
326 | {
327 | int ret = fpInstance.Match(CapTmp, RegTmp);
328 | if (0 < ret)
329 | {
330 | DisplayMessage(MessageManager.msg_FP_MatchSuccess + ret, true);
331 | return;
332 | }
333 | else
334 | {
335 | DisplayMessage(MessageManager.msg_FP_MatchFailed + ret, false);
336 | return;
337 | }
338 | }
339 | #endregion
340 | }
341 | }
342 | break;
343 |
344 | default:
345 | base.DefWndProc(ref m);
346 | break;
347 | }
348 | }
349 |
350 |
351 |
352 | ///
353 | /// FREE RESOURCES
354 | ///
355 | ///
356 | ///
357 | private void bnFree_Click(object sender, EventArgs e)
358 | {
359 | int result = fpInstance.Finalize();
360 |
361 | if (result == zkfp.ZKFP_ERR_OK)
362 | {
363 | DisconnectFingerPrintCounter();
364 | IsRegister = false;
365 | RegisterCount = 0;
366 | regTempLen = 0;
367 | ClearImage();
368 | cmbIdx.Items.Clear();
369 | Utilities.EnableControls(true, btnInit);
370 | Utilities.EnableControls(false, btnFree, btnClose, btnEnroll, btnVerify, btnIdentify);
371 |
372 | DisplayMessage("Resources were successfully released from the memory !!", true);
373 | }
374 | else
375 | DisplayMessage("Failed to release the resources !!", false);
376 | }
377 |
378 | private void ClearImage()
379 | {
380 | picFPImg.Image = null;
381 | //pbxImage2.Image = null;
382 | }
383 |
384 | private void bnEnroll_Click(object sender, EventArgs e)
385 | {
386 | if (!IsRegister)
387 | {
388 | ClearImage();
389 | IsRegister = true;
390 | RegisterCount = 0;
391 | regTempLen = 0;
392 | Utilities.EnableControls(false, btnEnroll, btnVerify, btnIdentify);
393 | DisplayMessage("Please press your finger " + REGISTER_FINGER_COUNT + " times to register", true);
394 |
395 | lblFingerPrintCount.Visible = true;
396 | lblFingerPrintCount.Text = REGISTER_FINGER_COUNT.ToString();
397 | }
398 | }
399 |
400 |
401 |
402 |
403 | public object PushToDevice(object args)
404 | {
405 | DisplayMessage("Pushed to fingerprint !", true);
406 | return null;
407 | }
408 |
409 |
410 | public void ReEnrollUser(bool enableEnroll, bool clearDeviceUser = true)
411 | {
412 | ClearImage();
413 | if (clearDeviceUser && !btnInit.Enabled) ClearDeviceUser();
414 | if (enableEnroll) btnEnroll.Enabled = true;
415 | }
416 |
417 |
418 | public void ClearDeviceUser()
419 | {
420 | try
421 | {
422 | int deleteCode = fpInstance.DelRegTemplate(iFid); // <---- REMOVE FINGERPRINT
423 | if (deleteCode != zkfp.ZKFP_ERR_OK)
424 | {
425 | DisplayMessage(MessageManager.msg_FP_UnableToDeleteFingerPrint + iFid, false);
426 | }
427 | iFid = 1;
428 | }
429 | catch { }
430 |
431 | }
432 |
433 |
434 | public bool ReleaseResources()
435 | {
436 | try
437 | {
438 | ReEnrollUser(true, true);
439 | bnClose_Click(null, null);
440 | return true;
441 | }
442 | catch
443 | {
444 | return false;
445 | }
446 |
447 | }
448 |
449 | #region -------- CONNECT/DISCONNECT DEVICE --------
450 |
451 |
452 |
453 | ///
454 | /// DISCONNECT DEVICE
455 | ///
456 | ///
457 | ///
458 | private void bnClose_Click(object sender, EventArgs e)
459 | {
460 | OnDisconnect();
461 | }
462 |
463 |
464 | public void OnDisconnect()
465 | {
466 | bIsTimeToDie = true;
467 | RegisterCount = 0;
468 | DisconnectFingerPrintCounter();
469 | ClearImage();
470 | Thread.Sleep(1000);
471 | int result = fpInstance.CloseDevice();
472 |
473 | captureThread.Abort();
474 | if (result == zkfp.ZKFP_ERR_OK)
475 | {
476 | Utilities.EnableControls(false, btnInit, btnClose, btnEnroll, btnVerify, btnIdentify);
477 |
478 | lblDeviceStatus.Text = Disconnected;
479 |
480 | Thread.Sleep(1000);
481 | result = fpInstance.Finalize(); // CLEAR RESOURCES
482 |
483 | if (result == zkfp.ZKFP_ERR_OK)
484 | {
485 | regTempLen = 0;
486 | IsRegister = false;
487 | cmbIdx.Items.Clear();
488 | Utilities.EnableControls(true, btnInit);
489 | Utilities.EnableControls(false, btnClose, btnEnroll, btnVerify, btnIdentify);
490 |
491 | ReInitializeInstance();
492 |
493 | DisplayMessage(MessageManager.msg_FP_Disconnected, true);
494 | }
495 | else
496 | DisplayMessage(MessageManager.msg_FP_FailedToReleaseResources, false);
497 |
498 |
499 | }
500 | else
501 | {
502 | string errorMessage = FingerPrintDeviceUtilities.DisplayDeviceErrorByCode(result);
503 | DisplayMessage(errorMessage, false);
504 | }
505 | }
506 |
507 |
508 | #endregion
509 |
510 |
511 |
512 | #region ------- COMMON --------
513 |
514 | private void FingerPrintControl_Load(object sender, EventArgs e) { FormHandle = this.Handle; }
515 |
516 | private void ReInitializeInstance()
517 | {
518 | Utilities.EnableControls(true, btnInit);
519 | Utilities.EnableControls(false, btnClose, btnEnroll, btnVerify, btnIdentify);
520 | DisconnectFingerPrintCounter();
521 | bIdentify = true;
522 | btnVerify.Text = VerifyButtonDefault;
523 | }
524 |
525 | private void DisconnectFingerPrintCounter()
526 | {
527 | lblFingerPrintCount.Text = REGISTER_FINGER_COUNT.ToString();
528 | lblFingerPrintCount.Visible = false;
529 | }
530 |
531 | #endregion
532 |
533 |
534 | #region -------- UTILITIES --------
535 |
536 |
537 | ///
538 | /// Combines Three Pre-Registered Fingerprint Templates as One Registered Fingerprint Template
539 | ///
540 | ///
541 | private int GenerateRegisteredFingerPrint()
542 | {
543 | return fpInstance.GenerateRegTemplate(RegTmps[0], RegTmps[1], RegTmps[2], RegTmp, ref regTempLen);
544 | }
545 |
546 | ///
547 | /// Add A Registered Fingerprint Template To Memory | params: (FingerPrint ID, Registered Template)
548 | ///
549 | ///
550 | private int AddTemplateToMemory()
551 | {
552 | return fpInstance.AddRegTemplate(iFid, RegTmp);
553 | }
554 |
555 |
556 |
557 |
558 | private void DisplayFingerPrintImage()
559 | {
560 | // NORMAL METHOD >>>
561 |
562 | //Bitmap fingerPrintImage = Utilities.GetImage(FPBuffer, fpInstance.imageWidth, fpInstance.imageHeight);
563 | //Rectangle cropRect = new Rectangle(0, 0, pbxImage2.Width / 2, pbxImage2.Height / 2);
564 | //Bitmap target = new Bitmap(cropRect.Width, cropRect.Height);
565 | //using (Graphics g = Graphics.FromImage(target))
566 | //{
567 | // g.DrawImage(fingerPrintImage, new Rectangle(0, 0, target.Width, target.Height), cropRect, GraphicsUnit.Pixel);
568 | //}
569 | //this.pbxImage2.Image = target;
570 |
571 |
572 |
573 | // OPTIMIZED METHOD
574 | MemoryStream ms = new MemoryStream();
575 | BitmapFormat.GetBitmap(FPBuffer, mfpWidth, mfpHeight, ref ms);
576 | Bitmap bmp = new Bitmap(ms);
577 | this.picFPImg.Image = bmp;
578 |
579 | }
580 |
581 | private void DisplayMessage(string message, bool normalMessage)
582 | {
583 | try
584 | {
585 | Utilities.ShowStatusBar(message, parentForm.statusBar, normalMessage);
586 | }
587 | catch (Exception ex)
588 | {
589 | Utilities.ShowStatusBar(ex.Message, parentForm.statusBar, false);
590 | }
591 | }
592 |
593 |
594 |
595 | #endregion
596 | }
597 | }
598 |
--------------------------------------------------------------------------------