Example #1
0
 /// <summary>
 /// Display result in TextView
 /// </summary>
 private void DisplaySuccess(UniversalCardResult mlIdCard)
 {
     System.Text.StringBuilder resultBuilder = new System.Text.StringBuilder();
     resultBuilder.Append("IDNum: " + mlIdCard.number + "\r\n");
     resultBuilder.Append("ValidDate: " + mlIdCard.valid + "\r\n");
     this.mTextView.Text = resultBuilder.ToString();
 }
Example #2
0
            public int OnResult(MLGcrCaptureResult result, Java.Lang.Object obj)
            {
                Log.Info(GcrAnalyseActivity.Tag, "callback onRecSuccess");
                if (result == null)
                {
                    Log.Info(GcrAnalyseActivity.Tag, "callback onRecSuccess result is null");
                    // If result is empty, return MLGcrCaptureResult.CaptureContinue, and the detector will continue to detect.
                    return(MLGcrCaptureResult.CaptureContinue);
                }
                UniversalCardResult cardResult = null;

                switch (this.gcrAnalyseActivity.processMode)
                {
                case 3:
                    PassCardProcess passCard = new PassCardProcess(result.Text);
                    if (passCard != null)
                    {
                        cardResult = passCard.GetResult();
                    }
                    break;

                case 1:
                    HKIdCardProcess HKIDCard = new HKIdCardProcess(result.Text);
                    if (HKIDCard != null)
                    {
                        cardResult = HKIDCard.GetResult();
                    }
                    break;

                case 2:
                    HomeCardProcess homeCard = new HomeCardProcess(result.Text);
                    if (homeCard != null)
                    {
                        cardResult = homeCard.GetResult();
                    }
                    break;

                default:
                    break;
                }

                if (cardResult == null || string.IsNullOrEmpty(cardResult.valid) || string.IsNullOrEmpty(cardResult.number))
                {
                    // If detection is not successful, return MLGcrCaptureResult.CaptureContinue, and the detector will continue to detect.
                    return(MLGcrCaptureResult.CaptureContinue);
                }
                this.gcrAnalyseActivity.cardImage = result.CardBitmap;
                this.gcrAnalyseActivity.previewImage.SetImageBitmap(this.gcrAnalyseActivity.cardImage);
                this.gcrAnalyseActivity.DisplaySuccess(cardResult);
                // If detection is successful, return MLGcrCaptureResult.CaptureStop, and the detector will stop to detect.
                return(MLGcrCaptureResult.CaptureStop);
            }