コード例 #1
0
        private async void btnDisconnect_Copy11_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgSetCompareLevel cmd = new fgSetCompareLevel(9);

            CommonResult ret = await FingerprintDevice.Execute(cmd);

            textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\nCurrent compare level: " + (cmd.CurrentCompareLevel + 1).ToString( );
        }
コード例 #2
0
        private async void btnDisconnect_Copy4_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgSetFingerprintMode cmd = new fgSetFingerprintMode(FingerprintMode.Duplicates);

            CommonResult ret = await FingerprintDevice.Execute(cmd);

            textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\nCurrent Mode: " + cmd.CurrentMode.ToString( );
        }
コード例 #3
0
        private async void btnDisconnect_Copy12_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgGetAuthorize cmd = new fgGetAuthorize(Convert.ToUInt16(textBox.Text));

            CommonResult ret = await FingerprintDevice.Execute(cmd);

            textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\nUser authorize: " + (cmd.Authorize).ToString( );
        }
コード例 #4
0
        private async void btnDisconnect_Copy7_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgCompare11 cmd = new fgCompare11(Convert.ToUInt16(textBox.Text));

            CommonResult ret = await FingerprintDevice.Execute(cmd);

            textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\nCompare 1:1 for fingerprint " + textBox.Text.Trim( );
        }
コード例 #5
0
        private async void btnDisconnect_Copy8_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgCompare1N cmd = new fgCompare1N( );

            CommonResult ret = await FingerprintDevice.Execute(cmd);

            textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\nCompare 1:N: UserID: " + cmd.ID.ToString( );
        }
コード例 #6
0
        private async void btnConnect_Copy2_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgSetCollectTimeout cmd = new fgSetCollectTimeout(10);

            CommonResult ret = await FingerprintDevice.Execute(cmd);

            textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\nSet timeout: " + cmd.CurrentTimeout.ToString( );
        }
コード例 #7
0
        private async void btnDisconnect_Copy1_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgHibernate cmd = new fgHibernate( );

            CommonResult ret = await FingerprintDevice.Execute(cmd);

            textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message;
        }
コード例 #8
0
        private async void btnDisconnect_Copy17_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgUploadEigenvalue cmd = new fgUploadEigenvalue(Convert.ToUInt16(textBox.Text));
            CommonResult       ret = await FingerprintDevice.Execute(cmd);

            textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\n";
            if (FingerprintDevice.LastExecuteResult.Code == ResultCode.GN_SUCCESS)
            {
                textBlock1.Text += "Upload fingerprint " + textBox.Text + " fingerprint eigenvalue data len: " + cmd.Eigenvalue.Length.ToString( ) + "\r\n";
            }
        }
コード例 #9
0
        private async void btnDisconnect_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgClearFingerprint cmd = new fgClearFingerprint( );

            CommonResult ret = await FingerprintDevice.Execute(cmd);

            textBlock1.Text = "Result:" + FingerprintDevice.LastExecuteResult.Message;

            //this.Frame.Navigate( typeof( Config ) );
            //lock ( _lock )
            //{
            //	DisconnectionServer( );
            //}
        }
コード例 #10
0
        private async void btnDisconnect_Copy6_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgGetAllFingerprint cmd = new fgGetAllFingerprint( );

            CommonResult ret = await FingerprintDevice.Execute(cmd);

            textBlock1.Text  = "Result: " + FingerprintDevice.LastExecuteResult.Message;
            textBlock1.Text += "\r\nAll user: \r\n";

            foreach (KeyValuePair <UInt16, byte> kvp in cmd.fpList)
            {
                textBlock1.Text += kvp.Key.ToString( ) + ":" + kvp.Value.ToString( ) + " \r\n";
            }
        }
コード例 #11
0
        private async void button_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgRemoveFingerprint cmd = new fgRemoveFingerprint(Convert.ToUInt16(textBox.Text));

            CommonResult ret = await FingerprintDevice.Execute(cmd);

            textBlock1.Text = "Result:" + FingerprintDevice.LastExecuteResult.Message;

            //ContentDialog1 nn = new ContentDialog1( );

            //await nn.ShowAsync( );
            //lock ( _lock )
            //{
            //	ConnectionServer( );
            //}
        }
コード例 #12
0
        private async void btnDisconnect_Copy16_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgCollectEigenvalueUpload cmd = new fgCollectEigenvalueUpload( );
            CommonResult ret = await FingerprintDevice.Execute(cmd);

            if (FingerprintDevice.LastExecuteResult.Code != ResultCode.GN_SUCCESS)
            {
                textBlock1.Text = "Collect sample fingerprint fail. Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\n";
                return;
            }

            fgDownloadEigenvalueCompareDSP1N cmdD = new fgDownloadEigenvalueCompareDSP1N(cmd.Eigenvalue);
            CommonResult retD = await FingerprintDevice.Execute(cmdD);

            textBlock1.Text += "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\n";
            textBlock1.Text += "Download fingerprint compare DSP 1:N result fingerprint id : " + cmdD.ID.ToString( );
        }
コード例 #13
0
        private async void btnDisconnect_Copy18_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgCollectEigenvalueUpload cmd = new fgCollectEigenvalueUpload( );
            CommonResult ret = await FingerprintDevice.Execute(cmd);

            if (FingerprintDevice.LastExecuteResult.Code != ResultCode.GN_SUCCESS)
            {
                textBlock1.Text  = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\n";
                textBlock1.Text += "Collect fingerprint fail.";
                return;
            }

            fgDownloadEigenvalue cmdD = new fgDownloadEigenvalue(cmd.Eigenvalue, Convert.ToUInt16(textBox.Text), 1);
            CommonResult         ret2 = await FingerprintDevice.Execute(cmdD);

            textBlock1.Text += "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\n";
        }
コード例 #14
0
        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("指定的人员没有记录指纹信息。");
            }
        }
コード例 #15
0
        private async void btnDisconnect_Copy14_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgCollectEigenvalueUpload cmd = new fgCollectEigenvalueUpload( );
            CommonResult ret = await FingerprintDevice.Execute(cmd);

            textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\n";
            if (FingerprintDevice.LastExecuteResult.Code == ResultCode.GN_SUCCESS)
            {
                textBlock1.Text += "Fingerprint eigenvalue data len: " + cmd.Eigenvalue.Length.ToString( ) + "\r\n";
            }


            fgDownloadEigenvalueCompare cmdD = new fgDownloadEigenvalueCompare(cmd.Eigenvalue);

            ret = await FingerprintDevice.Execute(cmdD);

            textBlock1.Text += "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\n";
        }
        public async void StartAttendanceTask( )
        {
            fgCompare1N cmd = new fgCompare1N( );

            while (true)
            {
                CommonResult ret = await FingerprintDevice.Execute(cmd);

                if (ret.Code == ResultCode.GN_TASK_CANCEL)
                {
                    break;
                }
                else if (ret.Code == ResultCode.GN_SUCCESS)
                {
                    DistinguishUser(cmd.ID, DateTime.Now);
                }
                else
                {
                    ShowNoFound( );
                }
            }
        }
コード例 #17
0
        private async void btnDisconnect_Copy13_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgCollectImageUpload cmd = new fgCollectImageUpload( );

            CommonResult ret = await FingerprintDevice.Execute(cmd);

            textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\n";
            if (FingerprintDevice.LastExecuteResult.Code == ResultCode.GN_SUCCESS)
            {
                textBlock1.Text += "Fingerprint image data len: " + cmd.ImageData.Length.ToString( ) + "\r\n";
            }

            BitmapImage i = new BitmapImage(new Uri("ms-appx:Assets/SplashScreen.scale-200.png"));

            image1.Source = i;

            //for ( int i = 0; i < cmd.ImageData.Length; i++ )
            //{
            //	textBlock1.Text += "0x" + Convert.ToString( cmd.ImageData[i], 16 ) + " ";
            //}
        }
コード例 #18
0
        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( );
            }
        }
コード例 #19
0
        private async void btnDisconnect_Copy5_Click(object sender, RoutedEventArgs e)
        {
            //TimeSpan _orgTimeout = CommonRes.SerialPort.ReadTimeout;
            //try
            //{
            textBlock1.Text = "";

            // Get current count
            fgGetCount   cmd1 = new fgGetCount( );
            CommonResult ret1 = await FingerprintDevice.Execute(cmd1);

            if (ret1.Code != ResultCode.GN_SUCCESS)
            {
                textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\nGet fingerprint count error.";
                return;
            }
            else
            {
                textBlock1.Text = "Now collect fingerprint first ....";
            }

            ushort newID = ( ushort )(cmd1.Count + 1);

            //CommonRes.SerialPort.ReadTimeout = TimeSpan.FromMilliseconds( 10000 );

            // First collect
            fgCollectFingerprint cmd2 = new fgCollectFingerprint(1, newID, 1);
            CommonResult         ret2 = await FingerprintDevice.Execute(cmd2);

            if (ret2.Code != ResultCode.GN_SUCCESS)
            {
                textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\nCollect times 1 fail.";
                return;
            }
            else
            {
                textBlock1.Text = "Now collect fingerprint second ....";
            }

            // Second collect
            fgCollectFingerprint cmd3 = new fgCollectFingerprint(2, newID, 1);
            CommonResult         ret3 = await FingerprintDevice.Execute(cmd3);

            if (ret3.Code != ResultCode.GN_SUCCESS)
            {
                textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\nCollect times 2 fail.";
                return;
            }
            else
            {
                textBlock1.Text = "Now collect fingerprint last ....";
            }

            // Last collect
            fgCollectFingerprint cmd4 = new fgCollectFingerprint(3, newID, 1);
            CommonResult         ret4 = await FingerprintDevice.Execute(cmd4);

            if (ret4.Code != ResultCode.GN_SUCCESS)
            {
                textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\nCollect times 2 fail.";
                return;
            }
            else
            {
                textBlock1.Text = "Collect fingerprint finished !!!";
            }

            //}
            //finally
            //{
            //	CommonRes.SerialPort.ReadTimeout = _orgTimeout;
            //}
        }
        private async void DoCollect( )
        {
            fgCollectFingerprint cmd = null;

            // First collect
            this.Title = "请扫描指纹";
first:
            brdOne.Background   = new SolidColorBrush(Colors.LightBlue);
            brdTwo.Background   = new SolidColorBrush(Colors.White);
            brdThree.Background = new SolidColorBrush(Colors.White);
            while (true)
            {
                cmd          = new fgCollectFingerprint(1, _fid, 1);
                DialogResult = await FingerprintDevice.Execute(cmd);

                if (DialogResult.Code == ResultCode.GN_TASK_CANCEL)
                {
                    return;
                }
                else if (DialogResult.Code == ResultCode.GN_SUCCESS)
                {
                    break;
                }
                else
                {
                    this.Title = DialogResult.Message;
                }
            }

            // Second collect
            this.Title          = "请扫描第二遍指纹";
            brdOne.Background   = new SolidColorBrush(Colors.LightGreen);
            brdTwo.Background   = new SolidColorBrush(Colors.LightBlue);
            brdThree.Background = new SolidColorBrush(Colors.White);
            while (true)
            {
                cmd          = new fgCollectFingerprint(2, _fid, 1);
                DialogResult = await FingerprintDevice.Execute(cmd);

                if (DialogResult.Code == ResultCode.GN_TASK_CANCEL)
                {
                    return;
                }
                else if (DialogResult.Code == ResultCode.GN_SUCCESS)
                {
                    break;
                }
                else if (DialogResult.Code == ResultCode.FG_BOARD_FAIL)
                {
                    this.Title = "指纹采集失败,请重新扫描指纹";
                    goto first;
                }
                else
                {
                    this.Title = DialogResult.Message;
                }
            }

            if (DialogResult.Code == ResultCode.GN_TASK_CANCEL)
            {
                return;
            }

            // Last collect
            this.Title          = "请扫描第三遍指纹";
            brdOne.Background   = new SolidColorBrush(Colors.LightGreen);
            brdTwo.Background   = new SolidColorBrush(Colors.LightGreen);
            brdThree.Background = new SolidColorBrush(Colors.LightBlue);
            while (true)
            {
                cmd          = new fgCollectFingerprint(3, _fid, 1);
                DialogResult = await FingerprintDevice.Execute(cmd);

                if (DialogResult.Code == ResultCode.GN_TASK_CANCEL)
                {
                    return;
                }
                else if (DialogResult.Code == ResultCode.GN_SUCCESS)
                {
                    break;
                }
                else if (DialogResult.Code == ResultCode.FG_BOARD_FAIL)
                {
                    this.Title = "指纹采集失败,请重新扫描指纹";
                    goto first;
                }
                else
                {
                    this.Title = DialogResult.Message;
                }
            }

            if (DialogResult.Code == ResultCode.GN_TASK_CANCEL)
            {
                return;
            }

            this.Hide( );
        }
コード例 #21
0
        private async void btnDisconnect_Copy_Click(object sender, RoutedEventArgs e)
        {
            textBlock1.Text = "";

            fgGetCount cmd = new fgGetCount( );

            CommonResult ret = await FingerprintDevice.Execute(cmd);

            textBlock1.Text = "Result: " + FingerprintDevice.LastExecuteResult.Message + "\r\nUsers: " + cmd.Count.ToString( );

            //try
            //{
            //	_dataWriter.WriteBytes( BuildCommandData( new byte[ ] { 0x09, 0x00, 0x00, 0x00, 0x00 } ) );
            //	await _dataWriter.StoreAsync( );

            //	await _dataReader.LoadAsync( this._readBufferLength );
            //	if ( _dataReader.UnconsumedBufferLength > 0 )
            //	{
            //		byte[ ] data = new byte[_dataReader.UnconsumedBufferLength];
            //		_dataReader.ReadBytes( data );

            //		textBlock1.Text = "";
            //		for ( int i = 0; i < data.Length; i++ )
            //		{
            //			textBlock1.Text += Convert.ToString( data[i], 16 ) + " ";
            //		}
            //	}

            //}
            //catch ( Exception ex )
            //{
            //}



            // =-----------------------------------------------------------------------

            //string ret = await SendByte( BuildCommandData( new byte[ ] { 0x09, 0x00, 0x00, 0x00, 0x00 } ) );

            //if ( ret != string.Empty )
            //{
            //	textBlock1.Text = ret;
            //	return;
            //}

            //byte[ ] red;
            //ret = ReadByte( out red );
            //if ( ret != string.Empty )
            //{
            //	textBlock1.Text = ret;
            //	return;
            //}
            //else
            //{
            //	textBlock1.Text = "";
            //	for ( int i = 0; i < red.Length; i++ )
            //	{
            //		textBlock1.Text = textBlock1.Text + Convert.ToString( red[i], 2 );
            //	}
            //}


            // =-----------------------------------------------------------------------

            //	if ( _sports.Count <= 0 ) return;


            //	SerialDevice _derialPort = _sports[0];
            //	try
            //	{
            //		_derialPort.ReadTimeout = TimeSpan.FromMilliseconds( 1000 );//超时
            //		_derialPort.BaudRate = 9600;//波特率
            //		_derialPort.Parity = SerialParity.None;//校验检查
            //		_derialPort.StopBits = SerialStopBitCount.One;//停止位
            //		_derialPort.DataBits = 8;//数据位
            //		_derialPort.Handshake = SerialHandshake.None;//握手方式

            //		_dataWriter = new DataWriter( _derialPort.OutputStream );

            //		//设置读取输入流
            //		_dataReader = new DataReader( _derialPort.InputStream );
            //		_dataReader.InputStreamOptions = InputStreamOptions.Partial;

            //		_dataWriter.WriteBytes( new byte[ ] { 0xAA, 0xBB, 0xCC, 0xDD } );
            //		await _dataWriter.StoreAsync( );

            //		await _dataReader.LoadAsync( 100 );

            //		if ( _dataReader.UnconsumedBufferLength > 0 )
            //		{
            //			StringBuilder str_builder = new StringBuilder( );
            //			while ( _dataReader.UnconsumedBufferLength > 0 )
            //			{
            //				str_builder.Append( _dataReader.ReadByte( ).ToString( "x2" ) );
            //			}

            //			txbPort.Text = txbPort.Text + "\r\n Read: " + str_builder.ToString( ).ToUpper( );
            //		}
            //	}
            //	finally
            //	{
            //		if ( _dataReader != null )
            //			_dataReader.DetachStream( );

            //		if ( _dataWriter != null )
            //			_dataWriter.DetachStream( );

            //		if ( _derialPort != null )
            //			_derialPort.Dispose( );
            //	}

            //	Task<UInt32> loadAsyncTask;
            //	//读取数据
            //	loadAsyncTask = _dataReader.LoadAsync( _readBufferLength ).AsTask( );
            //	uint bytesRead = await loadAsyncTask;
            //	//判断获取数据长度
            //	if ( bytesRead > 0 )
            //	{
            //		//转换十六进制数据
            //		string res = LoadData( bytesRead );
            //	}

            //}
            //private string LoadData( uint bytesRead )
            //{
            //	StringBuilder str_builder = new StringBuilder( );

            //	//转换缓冲区数据为16进制
            //	while ( _dataReader.UnconsumedBufferLength > 0 )
            //	{
            //		str_builder.Append( _dataReader.ReadByte( ).ToString( "x2" ) );
            //	}
            //	return str_builder.ToString( ).ToUpper( );
            //}
        }