Esempio n. 1
0
        /*
         * A little helper method to show live scanning errors.
         */
        private void ShowNotification <T>(T info)
        {
            String txt = "";

            if (typeof(T) == typeof(ALDocumentError))
            {
                ALDocumentError error = (ALDocumentError)Convert.ChangeType(info, typeof(ALDocumentError));
                switch (error)
                {
                case ALDocumentError.ImageTooDark:
                    txt = "Too dark";
                    break;

                case ALDocumentError.NotSharp:
                    txt = "Document not sharp";
                    break;

                case ALDocumentError.ShakeDetected:
                    txt = "Shake detected";
                    break;

                case ALDocumentError.SkewTooHigh:
                    txt = "Wrong perspective";
                    break;

                default:
                    break;
                }
            }

            if (typeof(T) == typeof(String))
            {
                txt = (String)Convert.ChangeType(info, typeof(String));
            }

            if (showingNotification || txt.Equals(""))
            {
                return;
            }

            showingNotification             = true;
            notificationView.textLabel.Text = txt;

            //fade in
            UIView.Animate(0.8, 0, UIViewAnimationOptions.CurveEaseInOut, () =>
            {
                notificationView.Alpha = 1;
            }, () => //fade out
            {
                UIView.Animate(0.8, 0, UIViewAnimationOptions.CurveEaseInOut, () =>
                {
                    notificationView.Alpha = 0;
                }, () => { showingNotification = false; });
            });
        }
Esempio n. 2
0
 /*
  * Called if the run on the full frame was unsuccessful. The scanning process automatically starts again with a preview scan.
  */
 void IAnylineDocumentModuleDelegate.ReportsPictureProcessingFailure(AnylineDocumentModuleView anylineDocumentModuleView, ALDocumentError error)
 {
     ShowNotification(error);
 }