Skip to main content

Hello,

I have a small C# application from a vendor that allows me to communicate with and receive data from an ID document scanner.
I've already managed to "translate" some parts to Visual Cobol but there are others that give some errors in the conversion.

Would it be possible for you to help me with this conversion?
Thanks. Alberto Ferraz

Hello,

I have a small C# application from a vendor that allows me to communicate with and receive data from an ID document scanner.
I've already managed to "translate" some parts to Visual Cobol but there are others that give some errors in the conversion.

Would it be possible for you to help me with this conversion?
Thanks. Alberto Ferraz

Hi Alberto,

Have you tried this tool yet?

C# to COBOL Converter | Application Modernization and Connectivity Marketplace (microfocus.com)


Hi Chris,

Yes, I usually use this tool for conversions, but in this case, there are some parts that give errors like this.


Hi Chris,

Yes, I usually use this tool for conversions, but in this case, there are some parts that give errors like this.

If you post the code here, we will try to convert it for you.


If you post the code here, we will try to convert it for you.

Is it possible for me to send a .zip file with the application?
Here in the post I can't find a way.

Is it possible for me to send a .zip file with the application?
Here in the post I can't find a way.

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Pr22.Processing;

namespace ScannerSample
{
    public partial class Form1 : Form
    {
        readonly Pr22.DocumentReaderDevice pr;
        bool DeviceIsConnected;
        Pr22.Task.TaskControl ScanCtrl;
        Pr22.Processing.Document AnalyzeResult;

        public Form1()
        {
            InitializeComponent();
            try { pr = new Pr22.DocumentReaderDevice(); }
            catch (Exception ex)
            {
                if (ex is DllNotFoundException || ex is Pr22.Exceptions.FileOpen)
                {
                    int platform = IntPtr.Size * 8;
                    int codepl = GetCodePlatform();

                    MessageBox.Show("This sample program" + (codepl == 0 ? " is compiled for Any CPU and" : "") +
                        " is running on " + platform + " bit platform.\\n" +
                        "Please check if the Passport Reader is installed correctly or compile your code for "
                        + (96 - platform) + " bit.\\n" + ex.Message,
                        "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                else MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }

        private void FormLoad(object sender, EventArgs e)
        {
            if (pr == null) { Close(); return; }

            pr.Connection += DeviceConnected;

            pr.PresenceStateChanged += DocumentStateChanged;
            pr.ImageScanned += ImageScanned;
            pr.ScanFinished += ScanFinished;
            pr.DocFrameFound += DocFrameFound;
        }

        void FormClose(object sender, FormClosingEventArgs e)
        {
            if (DeviceIsConnected)
            {
                CloseScan();
                pr.Close();
            }
        }

        #region Connection
        //----------------------------------------------------------------------

        // This raises only when no device is used or when the currently used
        // device is disconnected.
        void DeviceConnected(object sender, Pr22.Events.ConnectionEventArgs e)
        {
            UpdateDeviceList();
        }

        void UpdateDeviceList()
        {
            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(UpdateDeviceList));
                return;
            }
            List<string> Devices = Pr22.DocumentReaderDevice.GetDeviceList();
            DevicesListBox.Items.Clear();
            foreach (string s in Devices) DevicesListBox.Items.Add(s);
        }

        void ConnectButton_Click(object sender, EventArgs e)
        {
            if (DevicesListBox.SelectedIndex < 0) return;

            ConnectButton.Enabled = false;
            Cursor = Cursors.WaitCursor;
            try
            {
                pr.UseDevice(DevicesListBox.Text);
                DeviceIsConnected = true;
                pr.Scanner.StartTask(Pr22.Task.FreerunTask.Detection());
                DisconnectButton.Enabled = true;
                List<Pr22.Imaging.Light> Lights = pr.Scanner.Info.GetLights();
                foreach (Pr22.Imaging.Light light in Lights)
                    LightsCheckedListBox.Items.Add(light);
                StartButton.Enabled = true;
            }
            catch (Pr22.Exceptions.General ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                DisconnectButton_Click(sender, e);
            }
            Cursor = Cursors.Default;
        }

        void DisconnectButton_Click(object sender, EventArgs e)
        {
            if (DeviceIsConnected)
            {
                CloseScan();
                Application.DoEvents();
                pr.Close();
                DeviceIsConnected = false;
            }
            ConnectButton.Enabled = true;
            DisconnectButton.Enabled = false;
            StartButton.Enabled = false;
            LightsCheckedListBox.Items.Clear();
            FieldsTabControl.Controls.Clear();
            FieldsTabControl.Controls.Add(OcrTab);
            FieldsTabControl.Controls.Add(DataTab);
            FieldsDataGridView.Rows.Clear();
            ClearOCRData();
            ClearDataPage();
        }

        #endregion

        #region Scanning
        //----------------------------------------------------------------------

        // To raise this event FreerunTask.Detection() has to be started.
        void DocumentStateChanged(object sender, Pr22.Events.DetectionEventArgs e)
        {
            if (e.State == Pr22.Util.PresenceState.Present)
            {
                BeginInvoke(new EventHandler(StartButton_Click), sender, e);
            }
        }

        void StartButton_Click(object sender, EventArgs e)
        {
            FieldsTabControl.Controls.Clear();
            FieldsTabControl.Controls.Add(OcrTab);
            FieldsTabControl.Controls.Add(DataTab);
            FieldsDataGridView.Rows.Clear();
            ClearOCRData();
            ClearDataPage();
            if (LightsCheckedListBox.CheckedItems.Count == 0)
            {
                MessageBox.Show("No light selected to scan!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            StartButton.Enabled = false;
            Pr22.Task.DocScannerTask ScanTask = new Pr22.Task.DocScannerTask();
            foreach (Pr22.Imaging.Light light in LightsCheckedListBox.CheckedItems)
            {
                AddTabPage(light.ToString());
                ScanTask.Add(light);
            }
            ScanCtrl = pr.Scanner.StartScanning(ScanTask, Pr22.Imaging.PagePosition.First);
        }

        void ImageScanned(object sender, Pr22.Events.ImageEventArgs e)
        {
            DrawImage(e);
        }

        // To rotate the document to upside down direction the Analyze() should
        // be called.
        void DocFrameFound(object sender, Pr22.Events.PageEventArgs e)
        {
            if (!DocViewCheckBox.Checked) return;
            foreach (Control tab in FieldsTabControl.Controls)
            {
                try
                {
                    Pr22.Imaging.Light light = (Pr22.Imaging.Light)Enum.Parse(typeof(Pr22.Imaging.Light), tab.Text);
                    if (((PictureBox)tab.Controls[0]).Image != null)
                        DrawImage(new Pr22.Events.ImageEventArgs(e.Page, light));
                }
                catch (System.ArgumentException) { }
            }
        }

        void DrawImage(Pr22.Events.ImageEventArgs e)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new Action<Pr22.Events.ImageEventArgs>(DrawImage), e);
                return;
            }
            Pr22.Imaging.DocImage docImage = pr.Scanner.GetPage(e.Page).Select(e.Light);
            Control[] tabs = FieldsTabControl.Controls.Find(e.Light.ToString(), false);
            //if (tabs.Length == 0) tabs = AddTabPage(e.Light.ToString());
            if (tabs.Length == 0) return;
            PictureBox pb = (PictureBox)tabs[0].Controls[0];
            Bitmap bmap = docImage.ToBitmap();
            if (DocViewCheckBox.Checked)
            {
                try { bmap = docImage.DocView().ToBitmap(); }
                catch (Pr22.Exceptions.General) { }
            }
            pb.SizeMode = PictureBoxSizeMode.Zoom;
            pb.Image = bmap;
            pb.Refresh();
        }

        void ScanFinished(object sender, Pr22.Events.PageEventArgs e)
        {
            BeginInvoke(new MethodInvoker(Analyze));
            BeginInvoke(new MethodInvoker(CloseScan));
        }

        void CloseScan()
        {
            try { if (ScanCtrl != null) ScanCtrl.Wait(); }
            catch (Pr22.Exceptions.General ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            ScanCtrl = null;
            StartButton.Enabled = true;
        }

        #endregion

        #region Analyzing
        //----------------------------------------------------------------------

        void Analyze()
        {
            Pr22.Task.EngineTask OcrTask = new Pr22.Task.EngineTask();

            if (OCRParamsCheckedListBox.GetItemCheckState(0) == CheckState.Checked)
                OcrTask.Add(FieldSource.Mrz, FieldId.All);
            if (OCRParamsCheckedListBox.GetItemCheckState(1) == CheckState.Checked)
                OcrTask.Add(FieldSource.Viz, FieldId.All);
            if (OCRParamsCheckedListBox.GetItemCheckState(2) == CheckState.Checked)
                OcrTask.Add(FieldSource.Barcode, FieldId.All);

            Pr22.Processing.Page page;
            try { page = pr.Scanner.GetPage(0); }
            catch (Pr22.Exceptions.General) { return; }
            try { AnalyzeResult = pr.Engine.Analyze(page, OcrTask); }
            catch (Pr22.Exceptions.General ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            FillOcrDataGrid();
            FillDataPage();
        }

        void FillOcrDataGrid()
        {
            List<Pr22.Processing.FieldReference> Fields = AnalyzeResult.GetFields();
            for (int i = 0; i < Fields.Count; i++)
            {
                try
                {
                    Pr22.Processing.Field field = AnalyzeResult.GetField(Fields[i]);
                    string[] values = new string[4];
                    values[0] = i.ToString();
                    values[1] = Fields[i].ToString(" ") + new StrCon() + GetAmid(field);
                    try { values[2] = field.GetBestStringValue(); }
                    catch (Pr22.Exceptions.InvalidParameter)
                    {
                        values[2] = PrintBinary(field.GetBinaryValue(), 0, 16);
                    }
                    catch (Pr22.Exceptions.General) { }
                    values[3] = field.GetStatus().ToString();

                    FieldsDataGridView.Rows.Add(values);
                }
                catch (Pr22.Exceptions.General) { }
            }
        }

        void FieldsDataGridView_SelectionChanged(object sender, EventArgs e)
        {
            ClearOCRData();
            if (FieldsDataGridView.SelectedCells.Count == 0) return;
            int ix = FieldsDataGridView.SelectedCells[0].RowIndex;
            if (AnalyzeResult == null || ix < 0 || AnalyzeResult.GetFields().Count <= ix
                || ix == FieldsDataGridView.Rows.Count - 1) return;

            ix = int.Parse(FieldsDataGridView.Rows[ix].Cells[0].Value.ToString());
            Pr22.Processing.FieldReference SelectedField = AnalyzeResult.GetFields()[ix];
            Pr22.Processing.Field field = AnalyzeResult.GetField(SelectedField);
            try { RAWValueLabel.Text = field.GetRawStringValue(); }
            catch (Pr22.Exceptions.General) { }
            try { FormattedValueLabel.Text = field.GetFormattedStringValue(); }
            catch (Pr22.Exceptions.General) { }
            try { StandardizedValueLabel.Text = field.GetStandardizedStringValue(); }
            catch (Pr22.Exceptions.General) { }
            try { FieldImagePictureBox.Image = field.GetImage().ToBitmap(); }
            catch (Pr22.Exceptions.General) { }
        }

        void FillDataPage()
        {
            Name1.Text = GetFieldValue(FieldId.Surname);
            if (Name1.Text != "")
            {
                Name1.Text += " " + GetFieldValue(FieldId.Surname2);
                Name2.Text = GetFieldValue(FieldId.Givenname) + new StrCon()
                    + GetFieldValue(FieldId.MiddleName);
            }
            else Name1.Text = GetFieldValue(FieldId.Name);

            Birth.Text = new StrCon("on") + GetFieldValue(FieldId.BirthDate)
                + new StrCon("in") + GetFieldValue(FieldId.BirthPlace);

            Nationality.Text = GetFieldValue(FieldId.Nationality);

            Sex.Text = GetFieldValue(FieldId.Sex);

            Issuer.Text = GetFieldValue(FieldId.IssueCountry) + new StrCon()
                + GetFieldValue(FieldId.IssueState);

            Type.Text = GetFieldValue(FieldId.DocType) + new StrCon()
                + GetFieldValue(FieldId.DocTypeDisc);
            if (Type.Text == "") Type.Text = GetFieldValue(FieldId.Type);

            Page.Text = GetFieldValue(FieldId.DocPage);

            Number.Text = GetFieldValue(FieldId.DocumentNumber);

            Validity.Text = new StrCon("from") + GetFieldValue(FieldId.IssueDate)
                + new StrCon("to") + GetFieldValue(FieldId.ExpiryDate);

            try
            {
                PhotoPictureBox.Image = AnalyzeResult.GetField(FieldSource.Viz,
                    FieldId.Face).GetImage().ToBitmap();
            }
            catch (Pr22.Exceptions.General) { }

            try
            {
                SignaturePictureBox.Image = AnalyzeResult.GetField(FieldSource.Viz,
                    FieldId.Signature).GetImage().ToBitmap();
            }
            catch (Pr22.Exceptions.General) { }
        }

        #endregion

        #region General tools
        //----------------------------------------------------------------------

        string GetAmid(Field field)
        {
            try
            {
                return field.ToVariant().GetChild((int)Pr22.Util.VariantId.AMID, 0);
            }
            catch (Pr22.Exceptions.General) { return ""; }
        }

        string GetFieldValue(Pr22.Processing.FieldId Id)
        {
            FieldReference filter = new FieldReference(FieldSource.All, Id);
            List<FieldReference> Fields = AnalyzeResult.GetFields(filter);
            foreach (FieldReference FR in Fields)
            {
                try
                {
                    string value = AnalyzeResult.GetField(FR).GetBestStringValue();
                    if (value != "") return value;
                }
                catch (Pr22.Exceptions.EntryNotFound) { }
            }
            return "";
        }

        static string PrintBinary(byte[] arr, int pos, int sz)
        {
            int p0;
            string str = "", str2 = "";
            for (p0 = pos; p0 < arr.Length && p0 < pos + sz; p0++)
            {
                str += arr[p0].ToString("X2") + " ";
                str2 += arr[p0] < 0x21 || arr[p0] > 0x7e ? '.' : (char)arr[p0];
            }
            for (; p0 < pos + sz; p0++) { str += "   "; str2 += " "; }
            return str + str2;
        }

        Control[] AddTabPage(string lightName)
        {
            TabPage ImageTabPage = new TabPage(lightName);
            ImageTabPage.Name = lightName;
            PictureBox PBox = new PictureBox();
            ImageTabPage.Controls.Add(PBox);
            FieldsTabControl.Controls.Add(ImageTabPage);
            PBox.Size = ImageTabPage.Size;
            return new Control[1] { ImageTabPage };
        }

        void ClearOCRData()
        {
            FieldImagePictureBox.Image = null;
            RAWValueLabel.Text = FormattedValueLabel.Text = StandardizedValueLabel.Text = "";
        }

        void ClearDataPage()
        {
            Name1.Text = Name2.Text = Birth.Text = Nationality.Text = Sex.Text =
                Issuer.Text = Type.Text = Page.Text = Number.Text = Validity.Text = "";
            PhotoPictureBox.Image = null;
            SignaturePictureBox.Image = null;
        }

        int GetCodePlatform()
        {
            System.Reflection.PortableExecutableKinds pek;
            System.Reflection.ImageFileMachine mac;
            System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.GetPEKind(out pek, out mac);

            if ((pek & System.Reflection.PortableExecutableKinds.PE32Plus) != 0) return 64;
            if ((pek & System.Reflection.PortableExecutableKinds.Required32Bit) != 0) return 32;
            return 0;
        }

        #endregion
    }

    /// <summary>
    /// This class makes string concatenation with spaces and prefixes.
    /// </summary>
    public class StrCon
    {
        string fstr = "";
        string cstr = "";

        public StrCon() { }

        public StrCon(string bounder) { cstr = bounder + " "; }

        public static string operator +(StrCon csv, string str)
        {
            if (str != "") str = csv.cstr + str;
            if (csv.fstr != "" && str != "" && str[0] != ',') csv.fstr += " ";
            return csv.fstr + str;
        }

        public static StrCon operator +(string str, StrCon csv)
        {
            csv.fstr = str;
            return csv;
        }
    }
}


Is it possible for me to send a .zip file with the application?
Here in the post I can't find a way.

I try to send de code from this post.

The code of the Form1.Designer.cs. I don't need all the fields but i don't now if it's necessary.

namespace ScannerSample
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.OptionsTabControl = new System.Windows.Forms.TabControl();
this.OptionsTab = new System.Windows.Forms.TabPage();
this.DevicesGroupBox = new System.Windows.Forms.GroupBox();
this.DisconnectButton = new System.Windows.Forms.Button();
this.ConnectButton = new System.Windows.Forms.Button();
this.DevicesListBox = new System.Windows.Forms.ListBox();
this.OCRGroupBox = new System.Windows.Forms.GroupBox();
this.OCRParamsCheckedListBox = new System.Windows.Forms.CheckedListBox();
this.LightsGroupBox = new System.Windows.Forms.GroupBox();
this.LightsCheckedListBox = new System.Windows.Forms.CheckedListBox();
this.DocViewCheckBox = new System.Windows.Forms.CheckBox();
this.StartButton = new System.Windows.Forms.Button();
this.FieldsTabControl = new System.Windows.Forms.TabControl();
this.OcrTab = new System.Windows.Forms.TabPage();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.FieldsDataGridView = new System.Windows.Forms.DataGridView();
this.IndexColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.FieldIDColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ValueColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.StatusColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.FieldImagePictureBox = new System.Windows.Forms.PictureBox();
this.FieldImageGroup = new System.Windows.Forms.GroupBox();
this.ValuesGroup = new System.Windows.Forms.GroupBox();
this.RAWValueLabel = new System.Windows.Forms.Label();
this.RLabel = new System.Windows.Forms.Label();
this.FLabel = new System.Windows.Forms.Label();
this.StandardizedValueLabel = new System.Windows.Forms.Label();
this.SLabel = new System.Windows.Forms.Label();
this.FormattedValueLabel = new System.Windows.Forms.Label();
this.DataTab = new System.Windows.Forms.TabPage();
this.SignatureGroupBox = new System.Windows.Forms.GroupBox();
this.SignaturePictureBox = new System.Windows.Forms.PictureBox();
this.PhotoGroupBox = new System.Windows.Forms.GroupBox();
this.PhotoPictureBox = new System.Windows.Forms.PictureBox();
this.DocumentGroupBox = new System.Windows.Forms.GroupBox();
this.Validity = new System.Windows.Forms.Label();
this.Number = new System.Windows.Forms.Label();
this.Page = new System.Windows.Forms.Label();
this.Type = new System.Windows.Forms.Label();
this.Issuer = new System.Windows.Forms.Label();
this.ValidityLabel = new System.Windows.Forms.Label();
this.IssuerLabel = new System.Windows.Forms.Label();
this.PageLabel = new System.Windows.Forms.Label();
this.DocNumberLabel = new System.Windows.Forms.Label();
this.TypeLabel = new System.Windows.Forms.Label();
this.PersonalGroupBox = new System.Windows.Forms.GroupBox();
this.Sex = new System.Windows.Forms.Label();
this.Nationality = new System.Windows.Forms.Label();
this.Birth = new System.Windows.Forms.Label();
this.Name2 = new System.Windows.Forms.Label();
this.Name1 = new System.Windows.Forms.Label();
this.SexLabel = new System.Windows.Forms.Label();
this.NationalityLabel = new System.Windows.Forms.Label();
this.BirthLabel = new System.Windows.Forms.Label();
this.NameLabel = new System.Windows.Forms.Label();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.OptionsTabControl.SuspendLayout();
this.OptionsTab.SuspendLayout();
this.DevicesGroupBox.SuspendLayout();
this.OCRGroupBox.SuspendLayout();
this.LightsGroupBox.SuspendLayout();
this.FieldsTabControl.SuspendLayout();
this.OcrTab.SuspendLayout();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.FieldsDataGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.FieldImagePictureBox)).BeginInit();
this.ValuesGroup.SuspendLayout();
this.DataTab.SuspendLayout();
this.SignatureGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.SignaturePictureBox)).BeginInit();
this.PhotoGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PhotoPictureBox)).BeginInit();
this.DocumentGroupBox.SuspendLayout();
this.PersonalGroupBox.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.IsSplitterFixed = true;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.OptionsTabControl);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.FieldsTabControl);
this.splitContainer1.Size = new System.Drawing.Size(1016, 533);
this.splitContainer1.SplitterDistance = 283;
this.splitContainer1.TabIndex = 2;
//
// OptionsTabControl
//
this.OptionsTabControl.Controls.Add(this.OptionsTab);
this.OptionsTabControl.Location = new System.Drawing.Point(0, 0);
this.OptionsTabControl.Name = "OptionsTabControl";
this.OptionsTabControl.SelectedIndex = 0;
this.OptionsTabControl.Size = new System.Drawing.Size(280, 533);
this.OptionsTabControl.TabIndex = 0;
//
// OptionsTab
//
this.OptionsTab.Controls.Add(this.DevicesGroupBox);
this.OptionsTab.Controls.Add(this.OCRGroupBox);
this.OptionsTab.Controls.Add(this.LightsGroupBox);
this.OptionsTab.Controls.Add(this.StartButton);
this.OptionsTab.Location = new System.Drawing.Point(4, 22);
this.OptionsTab.Name = "OptionsTab";
this.OptionsTab.Padding = new System.Windows.Forms.Padding(3);
this.OptionsTab.Size = new System.Drawing.Size(272, 507);
this.OptionsTab.TabIndex = 2;
this.OptionsTab.Text = "Options";
this.OptionsTab.UseVisualStyleBackColor = true;
//
// DevicesGroupBox
//
this.DevicesGroupBox.Controls.Add(this.DisconnectButton);
this.DevicesGroupBox.Controls.Add(this.ConnectButton);
this.DevicesGroupBox.Controls.Add(this.DevicesListBox);
this.DevicesGroupBox.Location = new System.Drawing.Point(7, 3);
this.DevicesGroupBox.Name = "DevicesGroupBox";
this.DevicesGroupBox.Size = new System.Drawing.Size(259, 160);
this.DevicesGroupBox.TabIndex = 11;
this.DevicesGroupBox.TabStop = false;
this.DevicesGroupBox.Text = "Devices";
//
// DisconnectButton
//
this.DisconnectButton.Enabled = false;
this.DisconnectButton.Location = new System.Drawing.Point(137, 112);
this.DisconnectButton.Name = "DisconnectButton";
this.DisconnectButton.Size = new System.Drawing.Size(83, 23);
this.DisconnectButton.TabIndex = 8;
this.DisconnectButton.Text = "Disconnect";
this.DisconnectButton.UseVisualStyleBackColor = true;
this.DisconnectButton.Click += new System.EventHandler(this.DisconnectButton_Click);
//
// ConnectButton
//
this.ConnectButton.Location = new System.Drawing.Point(38, 112);
this.ConnectButton.Name = "ConnectButton";
this.ConnectButton.Size = new System.Drawing.Size(83, 23);
this.ConnectButton.TabIndex = 6;
this.ConnectButton.Text = "Connect";
this.ConnectButton.UseVisualStyleBackColor = true;
this.ConnectButton.Click += new System.EventHandler(this.ConnectButton_Click);
//
// DevicesListBox
//
this.DevicesListBox.FormattingEnabled = true;
this.DevicesListBox.Location = new System.Drawing.Point(12, 19);
this.DevicesListBox.Name = "DevicesListBox";
this.DevicesListBox.Size = new System.Drawing.Size(236, 69);
this.DevicesListBox.TabIndex = 5;
//
// OCRGroupBox
//
this.OCRGroupBox.Controls.Add(this.OCRParamsCheckedListBox);
this.OCRGroupBox.Location = new System.Drawing.Point(7, 334);
this.OCRGroupBox.Name = "OCRGroupBox";
this.OCRGroupBox.Size = new System.Drawing.Size(259, 107);
this.OCRGroupBox.TabIndex = 10;
this.OCRGroupBox.TabStop = false;
this.OCRGroupBox.Text = "OCR";
//
// OCRParamsCheckedListBox
//
this.OCRParamsCheckedListBox.CheckOnClick = true;
this.OCRParamsCheckedListBox.FormattingEnabled = true;
this.OCRParamsCheckedListBox.Items.AddRange(new object[] {
"MRZ fields",
"VIZ fields",
"BCR fields"});
this.OCRParamsCheckedListBox.Location = new System.Drawing.Point(12, 19);
this.OCRParamsCheckedListBox.Name = "OCRParamsCheckedListBox";
this.OCRParamsCheckedListBox.Size = new System.Drawing.Size(236, 64);
this.OCRParamsCheckedListBox.TabIndex = 0;
//
// LightsGroupBox
//
this.LightsGroupBox.Controls.Add(this.LightsCheckedListBox);
this.LightsGroupBox.Controls.Add(this.DocViewCheckBox);
this.LightsGroupBox.Location = new System.Drawing.Point(7, 169);
this.LightsGroupBox.Name = "LightsGroupBox";
this.LightsGroupBox.Size = new System.Drawing.Size(259, 159);
this.LightsGroupBox.TabIndex = 7;
this.LightsGroupBox.TabStop = false;
this.LightsGroupBox.Text = "Images";
//
// LightsCheckedListBox
//
this.LightsCheckedListBox.CheckOnClick = true;
this.LightsCheckedListBox.FormattingEnabled = true;
this.LightsCheckedListBox.Location = new System.Drawing.Point(12, 19);
this.LightsCheckedListBox.Name = "LightsCheckedListBox";
this.LightsCheckedListBox.Size = new System.Drawing.Size(236, 109);
this.LightsCheckedListBox.TabIndex = 0;
//
// DocViewCheckBox
//
this.DocViewCheckBox.AutoSize = true;
this.DocViewCheckBox.Location = new System.Drawing.Point(12, 134);
this.DocViewCheckBox.Name = "DocViewCheckBox";
this.DocViewCheckBox.Size = new System.Drawing.Size(149, 17);
this.DocViewCheckBox.TabIndex = 11;
this.DocViewCheckBox.Text = "Crop and rotate document";
this.DocViewCheckBox.UseVisualStyleBackColor = true;
//
// StartButton
//
this.StartButton.Enabled = false;
this.StartButton.Location = new System.Drawing.Point(69, 458);
this.StartButton.Name = "StartButton";
this.StartButton.Size = new System.Drawing.Size(133, 34);
this.StartButton.TabIndex = 9;
this.StartButton.Text = "Start";
this.StartButton.UseVisualStyleBackColor = true;
this.StartButton.Click += new System.EventHandler(this.StartButton_Click);
//
// FieldsTabControl
//
this.FieldsTabControl.Controls.Add(this.OcrTab);
this.FieldsTabControl.Controls.Add(this.DataTab);
this.FieldsTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.FieldsTabControl.Location = new System.Drawing.Point(0, 0);
this.FieldsTabControl.Name = "FieldsTabControl";
this.FieldsTabControl.SelectedIndex = 0;
this.FieldsTabControl.Size = new System.Drawing.Size(729, 533);
this.FieldsTabControl.TabIndex = 0;
//
// OcrTab
//
this.OcrTab.Controls.Add(this.splitContainer2);
this.OcrTab.Location = new System.Drawing.Point(4, 22);
this.OcrTab.Name = "OcrTab";
this.OcrTab.Size = new System.Drawing.Size(721, 507);
this.OcrTab.TabIndex = 0;
this.OcrTab.Text = "OCR";
this.OcrTab.UseVisualStyleBackColor = true;
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.FieldsDataGridView);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.BackColor = System.Drawing.Color.Transparent;
this.splitContainer2.Panel2.Controls.Add(this.FieldImagePictureBox);
this.splitContainer2.Panel2.Controls.Add(this.FieldImageGroup);
this.splitContainer2.Panel2.Controls.Add(this.ValuesGroup);
this.splitContainer2.Size = new System.Drawing.Size(721, 507);
this.splitContainer2.SplitterDistance = 327;
this.splitContainer2.TabIndex = 0;
//
// FieldsDataGridView
//
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.FieldsDataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.FieldsDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.FieldsDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.IndexColumn,
this.FieldIDColumn,
this.ValueColumn,
this.StatusColumn});
this.FieldsDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.FieldsDataGridView.Location = new System.Drawing.Point(0, 0);
this.FieldsDataGridView.Name = "FieldsDataGridView";
this.FieldsDataGridView.Size = new System.Drawing.Size(721, 327);
this.FieldsDataGridView.TabIndex = 0;
this.FieldsDataGridView.SelectionChanged += new System.EventHandler(this.FieldsDataGridView_SelectionChanged);
//
// IndexColumn
//
this.IndexColumn.HeaderText = "Index";
this.IndexColumn.Name = "IndexColumn";
this.IndexColumn.Visible = false;
//
// FieldIDColumn
//
this.FieldIDColumn.HeaderText = "Field ID";
this.FieldIDColumn.MinimumWidth = 160;
this.FieldIDColumn.Name = "FieldIDColumn";
this.FieldIDColumn.ReadOnly = true;
//
// ValueColumn
//
this.ValueColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.ValueColumn.HeaderText = "Value";
this.ValueColumn.Name = "ValueColumn";
this.ValueColumn.ReadOnly = true;
//
// StatusColumn
//
this.StatusColumn.HeaderText = "Status";
this.StatusColumn.Name = "StatusColumn";
this.StatusColumn.ReadOnly = true;
//
// FieldImagePictureBox
//
this.FieldImagePictureBox.Location = new System.Drawing.Point(141, 112);
this.FieldImagePictureBox.Name = "FieldImagePictureBox";
this.FieldImagePictureBox.Size = new System.Drawing.Size(566, 53);
this.FieldImagePictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.FieldImagePictureBox.TabIndex = 3;
this.FieldImagePictureBox.TabStop = false;
//
// FieldImageGroup
//
this.FieldImageGroup.Location = new System.Drawing.Point(3, 101);
this.FieldImageGroup.Name = "FieldImageGroup";
this.FieldImageGroup.Size = new System.Drawing.Size(710, 69);
this.FieldImageGroup.TabIndex = 7;
this.FieldImageGroup.TabStop = false;
this.FieldImageGroup.Text = "Field image";
//
// ValuesGroup
//
this.ValuesGroup.Controls.Add(this.RAWValueLabel);
this.ValuesGroup.Controls.Add(this.RLabel);
this.ValuesGroup.Controls.Add(this.FLabel);
this.ValuesGroup.Controls.Add(this.StandardizedValueLabel);
this.ValuesGroup.Controls.Add(this.SLabel);
this.ValuesGroup.Controls.Add(this.FormattedValueLabel);
this.ValuesGroup.Location = new System.Drawing.Point(3, 3);
this.ValuesGroup.Name = "ValuesGroup";
this.ValuesGroup.Size = new System.Drawing.Size(710, 92);
this.ValuesGroup.TabIndex = 8;
this.ValuesGroup.TabStop = false;
this.ValuesGroup.Text = "Values";
//
// RAWValueLabel
//
this.RAWValueLabel.AutoSize = true;
this.RAWValueLabel.Location = new System.Drawing.Point(141, 16);
this.RAWValueLabel.Name = "RAWValueLabel";
this.RAWValueLabel.Size = new System.Drawing.Size(0, 13);
this.RAWValueLabel.TabIndex = 6;
//
// RLabel
//
this.RLabel.AutoSize = true;
this.RLabel.Location = new System.Drawing.Point(8, 19);
this.RLabel.Name = "RLabel";
this.RLabel.Size = new System.Drawing.Size(36, 13);
this.RLabel.TabIndex = 2;
this.RLabel.Text = "RAW:";
//
// FLabel
//
this.FLabel.AutoSize = true;
this.FLabel.Location = new System.Drawing.Point(8, 41);
this.FLabel.Name = "FLabel";
this.FLabel.Size = new System.Drawing.Size(57, 13);
this.FLabel.TabIndex = 1;
this.FLabel.Text = "Formatted:";
//
// StandardizedValueLabel
//
this.StandardizedValueLabel.AutoSize = true;
this.StandardizedValueLabel.Location = new System.Drawing.Point(141, 60);
this.StandardizedValueLabel.Name = "StandardizedValueLabel";
this.StandardizedValueLabel.Size = new System.Drawing.Size(0, 13);
this.StandardizedValueLabel.TabIndex = 6;
//
// SLabel
//
this.SLabel.AutoSize = true;
this.SLabel.Location = new System.Drawing.Point(8, 63);
this.SLabel.Name = "SLabel";
this.SLabel.Size = new System.Drawing.Size(72, 13);
this.SLabel.TabIndex = 2;
this.SLabel.Text = "Standardized:";
//
// FormattedValueLabel
//
this.FormattedValueLabel.AutoSize = true;
this.FormattedValueLabel.Location = new System.Drawing.Point(141, 38);
this.FormattedValueLabel.Name = "FormattedValueLabel";
this.FormattedValueLabel.Size = new System.Drawing.Size(0, 13);
this.FormattedValueLabel.TabIndex = 5;
//
// DataTab
//
this.DataTab.Controls.Add(this.SignatureGroupBox);
this.DataTab.Controls.Add(this.PhotoGroupBox);
this.DataTab.Controls.Add(this.DocumentGroupBox);
this.DataTab.Controls.Add(this.PersonalGroupBox);
this.DataTab.Location = new System.Drawing.Point(4, 22);
this.DataTab.Name = "DataTab";
this.DataTab.Size = new System.Drawing.Size(721, 507);
this.DataTab.TabIndex = 1;
this.DataTab.Text = "Data";
this.DataTab.UseVisualStyleBackColor = true;
//
// SignatureGroupBox
//
this.SignatureGroupBox.Controls.Add(this.SignaturePictureBox);
this.SignatureGroupBox.Location = new System.Drawing.Point(3, 334);
this.SignatureGroupBox.Name = "SignatureGroupBox";
this.SignatureGroupBox.Size = new System.Drawing.Size(574, 158);
this.SignatureGroupBox.TabIndex = 4;
this.SignatureGroupBox.TabStop = false;
this.SignatureGroupBox.Text = "Signature";
//
// SignaturePictureBox
//
this.SignaturePictureBox.Location = new System.Drawing.Point(6, 19);
this.SignaturePictureBox.Name = "SignaturePictureBox";
this.SignaturePictureBox.Size = new System.Drawing.Size(562, 133);
this.SignaturePictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.SignaturePictureBox.TabIndex = 0;
this.SignaturePictureBox.TabStop = false;
//
// PhotoGroupBox
//
this.PhotoGroupBox.Controls.Add(this.PhotoPictureBox);
this.PhotoGroupBox.Location = new System.Drawing.Point(583, 3);
this.PhotoGroupBox.Name = "PhotoGroupBox";
this.PhotoGroupBox.Size = new System.Drawing.Size(130, 160);
this.PhotoGroupBox.TabIndex = 3;
this.PhotoGroupBox.TabStop = false;
this.PhotoGroupBox.Text = "Face Photo";
//
// PhotoPictureBox
//
this.PhotoPictureBox.Location = new System.Drawing.Point(6, 19);
this.PhotoPictureBox.Name = "PhotoPictureBox";
this.PhotoPictureBox.Size = new System.Drawing.Size(118, 135);
this.PhotoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.PhotoPictureBox.TabIndex = 0;
this.PhotoPictureBox.TabStop = false;
//
// DocumentGroupBox
//
this.DocumentGroupBox.Controls.Add(this.Validity);
this.DocumentGroupBox.Controls.Add(this.Number);
this.DocumentGroupBox.Controls.Add(this.Page);
this.DocumentGroupBox.Controls.Add(this.Type);
this.DocumentGroupBox.Controls.Add(this.Issuer);
this.DocumentGroupBox.Controls.Add(this.ValidityLabel);
this.DocumentGroupBox.Controls.Add(this.IssuerLabel);
this.DocumentGroupBox.Controls.Add(this.PageLabel);
this.DocumentGroupBox.Controls.Add(this.DocNumberLabel);
this.DocumentGroupBox.Controls.Add(this.TypeLabel);
this.DocumentGroupBox.Location = new System.Drawing.Point(3, 169);
this.DocumentGroupBox.Name = "DocumentGroupBox";
this.DocumentGroupBox.Size = new System.Drawing.Size(574, 159);
this.DocumentGroupBox.TabIndex = 2;
this.DocumentGroupBox.TabStop = false;
this.DocumentGroupBox.Text = "Document Data";
//
// Validity
//
this.Validity.AutoSize = true;
this.Validity.Location = new System.Drawing.Point(88, 130);
this.Validity.Name = "Validity";
this.Validity.Size = new System.Drawing.Size(0, 13);
this.Validity.TabIndex = 9;
//
// Number
//
this.Number.AutoSize = true;
this.Number.Location = new System.Drawing.Point(88, 104);
this.Number.Name = "Number";
this.Number.Size = new System.Drawing.Size(0, 13);
this.Number.TabIndex = 8;
//
// Page
//
this.Page.AutoSize = true;
this.Page.Location = new System.Drawing.Point(88, 78);
this.Page.Name = "Page";
this.Page.Size = new System.Drawing.Size(0, 13);
this.Page.TabIndex = 7;
//
// Type
//
this.Type.AutoSize = true;
this.Type.Location = new System.Drawing.Point(88, 52);
this.Type.Name = "Type";
this.Type.Size = new System.Drawing.Size(0, 13);
this.Type.TabIndex = 6;
//
// Issuer
//
this.Issuer.AutoSize = true;
this.Issuer.Location = new System.Drawing.Point(88, 26);
this.Issuer.Name = "Issuer";
this.Issuer.Size = new System.Drawing.Size(0, 13);
this.Issuer.TabIndex = 5;
//
// ValidityLabel
//
this.ValidityLabel.AutoSize = true;
this.ValidityLabel.Location = new System.Drawing.Point(6, 130);
this.ValidityLabel.Name = "ValidityLabel";
this.ValidityLabel.Size = new System.Drawing.Size(33, 13);
this.ValidityLabel.TabIndex = 4;
this.ValidityLabel.Text = "Valid:";
//
// IssuerLabel
//
this.IssuerLabel.AutoSize = true;
this.IssuerLabel.Location = new System.Drawing.Point(6, 26);
this.IssuerLabel.Name = "IssuerLabel";
this.IssuerLabel.Size = new System.Drawing.Size(38, 13);
this.IssuerLabel.TabIndex = 0;
this.IssuerLabel.Text = "Issuer:";
//
// PageLabel
//
this.PageLabel.AutoSize = true;
this.PageLabel.Location = new System.Drawing.Point(6, 78);
this.PageLabel.Name = "PageLabel";
this.PageLabel.Size = new System.Drawing.Size(35, 13);
this.PageLabel.TabIndex = 2;
this.PageLabel.Text = "Page:";
//
// DocNumberLabel
//
this.DocNumberLabel.AutoSize = true;
this.DocNumberLabel.Location = new System.Drawing.Point(6, 104);
this.DocNumberLabel.Name = "DocNumberLabel";
this.DocNumberLabel.Size = new System.Drawing.Size(47, 13);
this.DocNumberLabel.TabIndex = 3;
this.DocNumberLabel.Text = "Number:";
//
// TypeLabel
//
this.TypeLabel.AutoSize = true;
this.TypeLabel.Location = new System.Drawing.Point(6, 52);
this.TypeLabel.Name = "TypeLabel";
this.TypeLabel.Size = new System.Drawing.Size(34, 13);
this.TypeLabel.TabIndex = 1;
this.TypeLabel.Text = "Type:";
//
// PersonalGroupBox
//
this.PersonalGroupBox.Controls.Add(this.Sex);
this.PersonalGroupBox.Controls.Add(this.Nationality);
this.PersonalGroupBox.Controls.Add(this.Birth);
this.PersonalGroupBox.Controls.Add(this.Name2);
this.PersonalGroupBox.Controls.Add(this.Name1);
this.PersonalGroupBox.Controls.Add(this.SexLabel);
this.PersonalGroupBox.Controls.Add(this.NationalityLabel);
this.PersonalGroupBox.Controls.Add(this.BirthLabel);
this.PersonalGroupBox.Controls.Add(this.NameLabel);
this.PersonalGroupBox.Location = new System.Drawing.Point(3, 3);
this.PersonalGroupBox.Name = "PersonalGroupBox";
this.PersonalGroupBox.Size = new System.Drawing.Size(574, 160);
this.PersonalGroupBox.TabIndex = 1;
this.PersonalGroupBox.TabStop = false;
this.PersonalGroupBox.Text = "Personal Data";
//
// Sex
//
this.Sex.AutoSize = true;
this.Sex.Location = new System.Drawing.Point(88, 132);
this.Sex.Name = "Sex";
this.Sex.Size = new System.Drawing.Size(0, 13);
this.Sex.TabIndex = 8;
//
// Nationality
//
this.Nationality.AutoSize = true;
this.Nationality.Location = new System.Drawing.Point(88, 106);
this.Nationality.Name = "Nationality";
this.Nationality.Size = new System.Drawing.Size(0, 13);
this.Nationality.TabIndex = 7;
//
// Birth
//
this.Birth.AutoSize = true;
this.Birth.Location = new System.Drawing.Point(88, 80);
this.Birth.Name = "Birth";
this.Birth.Size = new System.Drawing.Size(0, 13);
this.Birth.TabIndex = 6;
//
// Name2
//
this.Name2.AutoSize = true;
this.Name2.Location = new System.Drawing.Point(88, 54);
this.Name2.Name = "Name2";
this.Name2.Size = new System.Drawing.Size(0, 13);
this.Name2.TabIndex = 5;
//
// Name1
//
this.Name1.AutoSize = true;
this.Name1.Location = new System.Drawing.Point(88, 28);
this.Name1.Name = "Name1";
this.Name1.Size = new System.Drawing.Size(0, 13);
this.Name1.TabIndex = 4;
//
// SexLabel
//
this.SexLabel.AutoSize = true;
this.SexLabel.Location = new System.Drawing.Point(6, 132);
this.SexLabel.Name = "SexLabel";
this.SexLabel.Size = new System.Drawing.Size(28, 13);
this.SexLabel.TabIndex = 3;
this.SexLabel.Text = "Sex:";
//
// NationalityLabel
//
this.NationalityLabel.AutoSize = true;
this.NationalityLabel.Location = new System.Drawing.Point(6, 106);
this.NationalityLabel.Name = "NationalityLabel";
this.NationalityLabel.Size = new System.Drawing.Size(59, 13);
this.NationalityLabel.TabIndex = 2;
this.NationalityLabel.Text = "Nationality:";
//
// BirthLabel
//
this.BirthLabel.AutoSize = true;
this.BirthLabel.Location = new System.Drawing.Point(6, 80);
this.BirthLabel.Name = "BirthLabel";
this.BirthLabel.Size = new System.Drawing.Size(31, 13);
this.BirthLabel.TabIndex = 1;
this.BirthLabel.Text = "Birth:";
//
// NameLabel
//
this.NameLabel.AutoSize = true;
this.NameLabel.Location = new System.Drawing.Point(6, 28);
this.NameLabel.Name = "NameLabel";
this.NameLabel.Size = new System.Drawing.Size(38, 13);
this.NameLabel.TabIndex = 0;
this.NameLabel.Text = "Name:";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1016, 533);
this.Controls.Add(this.splitContainer1);
this.Name = "Form1";
this.Text = "Scanner Sample";
this.Load += new System.EventHandler(this.FormLoad);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormClose);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.OptionsTabControl.ResumeLayout(false);
this.OptionsTab.ResumeLayout(false);
this.DevicesGroupBox.ResumeLayout(false);
this.OCRGroupBox.ResumeLayout(false);
this.LightsGroupBox.ResumeLayout(false);
this.LightsGroupBox.PerformLayout();
this.FieldsTabControl.ResumeLayout(false);
this.OcrTab.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
this.splitContainer2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.FieldsDataGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.FieldImagePictureBox)).EndInit();
this.ValuesGroup.ResumeLayout(false);
this.ValuesGroup.PerformLayout();
this.DataTab.ResumeLayout(false);
this.SignatureGroupBox.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.SignaturePictureBox)).EndInit();
this.PhotoGroupBox.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.PhotoPictureBox)).EndInit();
this.DocumentGroupBox.ResumeLayout(false);
this.DocumentGroupBox.PerformLayout();
this.PersonalGroupBox.ResumeLayout(false);
this.PersonalGroupBox.PerformLayout();
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.ListBox DevicesListBox;
private System.Windows.Forms.Button ConnectButton;
private System.Windows.Forms.Button DisconnectButton;
private System.Windows.Forms.GroupBox LightsGroupBox;
private System.Windows.Forms.CheckedListBox LightsCheckedListBox;
private System.Windows.Forms.CheckBox DocViewCheckBox;
private System.Windows.Forms.GroupBox OCRGroupBox;
private System.Windows.Forms.CheckedListBox OCRParamsCheckedListBox;
private System.Windows.Forms.Button StartButton;
private System.Windows.Forms.TabControl FieldsTabControl;
private System.Windows.Forms.TabPage OcrTab;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.DataGridView FieldsDataGridView;
private System.Windows.Forms.Label RAWValueLabel;
private System.Windows.Forms.Label FormattedValueLabel;
private System.Windows.Forms.Label StandardizedValueLabel;
private System.Windows.Forms.PictureBox FieldImagePictureBox;
private System.Windows.Forms.Label RLabel;
private System.Windows.Forms.Label FLabel;
private System.Windows.Forms.Label SLabel;
private System.Windows.Forms.DataGridViewTextBoxColumn IndexColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn FieldIDColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn ValueColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn StatusColumn;
private System.Windows.Forms.TabPage DataTab;
private System.Windows.Forms.Label NameLabel;
private System.Windows.Forms.GroupBox PersonalGroupBox;
private System.Windows.Forms.Label SexLabel;
private System.Windows.Forms.Label NationalityLabel;
private System.Windows.Forms.Label BirthLabel;
private System.Windows.Forms.GroupBox DocumentGroupBox;
private System.Windows.Forms.Label ValidityLabel;
private System.Windows.Forms.Label DocNumberLabel;
private System.Windows.Forms.Label PageLabel;
private System.Windows.Forms.Label TypeLabel;
private System.Windows.Forms.Label IssuerLabel;
private System.Windows.Forms.Label Validity;
private System.Windows.Forms.Label Number;
private System.Windows.Forms.Label Page;
private System.Windows.Forms.Label Type;
private System.Windows.Forms.Label Issuer;
private System.Windows.Forms.Label Sex;
private System.Windows.Forms.Label Nationality;
private System.Windows.Forms.Label Birth;
private System.Windows.Forms.Label Name2;
private System.Windows.Forms.Label Name1;
private System.Windows.Forms.GroupBox PhotoGroupBox;
private System.Windows.Forms.PictureBox PhotoPictureBox;
private System.Windows.Forms.GroupBox SignatureGroupBox;
private System.Windows.Forms.PictureBox SignaturePictureBox;
private System.Windows.Forms.GroupBox DevicesGroupBox;
private System.Windows.Forms.GroupBox FieldImageGroup;
private System.Windows.Forms.GroupBox ValuesGroup;
private System.Windows.Forms.TabPage OptionsTab;
private System.Windows.Forms.TabControl OptionsTabControl;
}
}


Is it possible for me to send a .zip file with the application?
Here in the post I can't find a way.
I can't send the code through the post because the following notification appears.


I can't send the code through the post because the following notification appears.

yes, please send it to cglazier@opentext.com. Hopefully the attachment doesn't get removed


yes, please send it to cglazier@opentext.com. Hopefully the attachment doesn't get removed

I will send it to the email indicated through WeTransfer, so it won't be blocked.
The project I send has two applications, I only need the "ScannerSample".

I also won't need all the screen fields, but I think that if I "cut" them it will be difficult to do the conversion and test it.
I think that if I just convert the code (Form1), then I will be able to do the rest with the connection to the screen fields.

Thanks

Link to download: https://we.tl/t-A9ojbrPIYk


I will send it to the email indicated through WeTransfer, so it won't be blocked.
The project I send has two applications, I only need the "ScannerSample".

I also won't need all the screen fields, but I think that if I "cut" them it will be difficult to do the conversion and test it.
I think that if I just convert the code (Form1), then I will be able to do the rest with the connection to the screen fields.

Thanks

Link to download: https://we.tl/t-A9ojbrPIYk

Can you please send me the Pr22 assembly or let me know where I can download it from?


Can you please send me the Pr22 assembly or let me know where I can download it from?

I send you by WeTransfer the packeg complete,

May be i'ts better to you


I try to send de code from this post.

The code of the Form1.Designer.cs. I don't need all the fields but i don't now if it's necessary.

namespace ScannerSample
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.OptionsTabControl = new System.Windows.Forms.TabControl();
this.OptionsTab = new System.Windows.Forms.TabPage();
this.DevicesGroupBox = new System.Windows.Forms.GroupBox();
this.DisconnectButton = new System.Windows.Forms.Button();
this.ConnectButton = new System.Windows.Forms.Button();
this.DevicesListBox = new System.Windows.Forms.ListBox();
this.OCRGroupBox = new System.Windows.Forms.GroupBox();
this.OCRParamsCheckedListBox = new System.Windows.Forms.CheckedListBox();
this.LightsGroupBox = new System.Windows.Forms.GroupBox();
this.LightsCheckedListBox = new System.Windows.Forms.CheckedListBox();
this.DocViewCheckBox = new System.Windows.Forms.CheckBox();
this.StartButton = new System.Windows.Forms.Button();
this.FieldsTabControl = new System.Windows.Forms.TabControl();
this.OcrTab = new System.Windows.Forms.TabPage();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.FieldsDataGridView = new System.Windows.Forms.DataGridView();
this.IndexColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.FieldIDColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ValueColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.StatusColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.FieldImagePictureBox = new System.Windows.Forms.PictureBox();
this.FieldImageGroup = new System.Windows.Forms.GroupBox();
this.ValuesGroup = new System.Windows.Forms.GroupBox();
this.RAWValueLabel = new System.Windows.Forms.Label();
this.RLabel = new System.Windows.Forms.Label();
this.FLabel = new System.Windows.Forms.Label();
this.StandardizedValueLabel = new System.Windows.Forms.Label();
this.SLabel = new System.Windows.Forms.Label();
this.FormattedValueLabel = new System.Windows.Forms.Label();
this.DataTab = new System.Windows.Forms.TabPage();
this.SignatureGroupBox = new System.Windows.Forms.GroupBox();
this.SignaturePictureBox = new System.Windows.Forms.PictureBox();
this.PhotoGroupBox = new System.Windows.Forms.GroupBox();
this.PhotoPictureBox = new System.Windows.Forms.PictureBox();
this.DocumentGroupBox = new System.Windows.Forms.GroupBox();
this.Validity = new System.Windows.Forms.Label();
this.Number = new System.Windows.Forms.Label();
this.Page = new System.Windows.Forms.Label();
this.Type = new System.Windows.Forms.Label();
this.Issuer = new System.Windows.Forms.Label();
this.ValidityLabel = new System.Windows.Forms.Label();
this.IssuerLabel = new System.Windows.Forms.Label();
this.PageLabel = new System.Windows.Forms.Label();
this.DocNumberLabel = new System.Windows.Forms.Label();
this.TypeLabel = new System.Windows.Forms.Label();
this.PersonalGroupBox = new System.Windows.Forms.GroupBox();
this.Sex = new System.Windows.Forms.Label();
this.Nationality = new System.Windows.Forms.Label();
this.Birth = new System.Windows.Forms.Label();
this.Name2 = new System.Windows.Forms.Label();
this.Name1 = new System.Windows.Forms.Label();
this.SexLabel = new System.Windows.Forms.Label();
this.NationalityLabel = new System.Windows.Forms.Label();
this.BirthLabel = new System.Windows.Forms.Label();
this.NameLabel = new System.Windows.Forms.Label();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.OptionsTabControl.SuspendLayout();
this.OptionsTab.SuspendLayout();
this.DevicesGroupBox.SuspendLayout();
this.OCRGroupBox.SuspendLayout();
this.LightsGroupBox.SuspendLayout();
this.FieldsTabControl.SuspendLayout();
this.OcrTab.SuspendLayout();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.FieldsDataGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.FieldImagePictureBox)).BeginInit();
this.ValuesGroup.SuspendLayout();
this.DataTab.SuspendLayout();
this.SignatureGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.SignaturePictureBox)).BeginInit();
this.PhotoGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PhotoPictureBox)).BeginInit();
this.DocumentGroupBox.SuspendLayout();
this.PersonalGroupBox.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.IsSplitterFixed = true;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.OptionsTabControl);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.FieldsTabControl);
this.splitContainer1.Size = new System.Drawing.Size(1016, 533);
this.splitContainer1.SplitterDistance = 283;
this.splitContainer1.TabIndex = 2;
//
// OptionsTabControl
//
this.OptionsTabControl.Controls.Add(this.OptionsTab);
this.OptionsTabControl.Location = new System.Drawing.Point(0, 0);
this.OptionsTabControl.Name = "OptionsTabControl";
this.OptionsTabControl.SelectedIndex = 0;
this.OptionsTabControl.Size = new System.Drawing.Size(280, 533);
this.OptionsTabControl.TabIndex = 0;
//
// OptionsTab
//
this.OptionsTab.Controls.Add(this.DevicesGroupBox);
this.OptionsTab.Controls.Add(this.OCRGroupBox);
this.OptionsTab.Controls.Add(this.LightsGroupBox);
this.OptionsTab.Controls.Add(this.StartButton);
this.OptionsTab.Location = new System.Drawing.Point(4, 22);
this.OptionsTab.Name = "OptionsTab";
this.OptionsTab.Padding = new System.Windows.Forms.Padding(3);
this.OptionsTab.Size = new System.Drawing.Size(272, 507);
this.OptionsTab.TabIndex = 2;
this.OptionsTab.Text = "Options";
this.OptionsTab.UseVisualStyleBackColor = true;
//
// DevicesGroupBox
//
this.DevicesGroupBox.Controls.Add(this.DisconnectButton);
this.DevicesGroupBox.Controls.Add(this.ConnectButton);
this.DevicesGroupBox.Controls.Add(this.DevicesListBox);
this.DevicesGroupBox.Location = new System.Drawing.Point(7, 3);
this.DevicesGroupBox.Name = "DevicesGroupBox";
this.DevicesGroupBox.Size = new System.Drawing.Size(259, 160);
this.DevicesGroupBox.TabIndex = 11;
this.DevicesGroupBox.TabStop = false;
this.DevicesGroupBox.Text = "Devices";
//
// DisconnectButton
//
this.DisconnectButton.Enabled = false;
this.DisconnectButton.Location = new System.Drawing.Point(137, 112);
this.DisconnectButton.Name = "DisconnectButton";
this.DisconnectButton.Size = new System.Drawing.Size(83, 23);
this.DisconnectButton.TabIndex = 8;
this.DisconnectButton.Text = "Disconnect";
this.DisconnectButton.UseVisualStyleBackColor = true;
this.DisconnectButton.Click += new System.EventHandler(this.DisconnectButton_Click);
//
// ConnectButton
//
this.ConnectButton.Location = new System.Drawing.Point(38, 112);
this.ConnectButton.Name = "ConnectButton";
this.ConnectButton.Size = new System.Drawing.Size(83, 23);
this.ConnectButton.TabIndex = 6;
this.ConnectButton.Text = "Connect";
this.ConnectButton.UseVisualStyleBackColor = true;
this.ConnectButton.Click += new System.EventHandler(this.ConnectButton_Click);
//
// DevicesListBox
//
this.DevicesListBox.FormattingEnabled = true;
this.DevicesListBox.Location = new System.Drawing.Point(12, 19);
this.DevicesListBox.Name = "DevicesListBox";
this.DevicesListBox.Size = new System.Drawing.Size(236, 69);
this.DevicesListBox.TabIndex = 5;
//
// OCRGroupBox
//
this.OCRGroupBox.Controls.Add(this.OCRParamsCheckedListBox);
this.OCRGroupBox.Location = new System.Drawing.Point(7, 334);
this.OCRGroupBox.Name = "OCRGroupBox";
this.OCRGroupBox.Size = new System.Drawing.Size(259, 107);
this.OCRGroupBox.TabIndex = 10;
this.OCRGroupBox.TabStop = false;
this.OCRGroupBox.Text = "OCR";
//
// OCRParamsCheckedListBox
//
this.OCRParamsCheckedListBox.CheckOnClick = true;
this.OCRParamsCheckedListBox.FormattingEnabled = true;
this.OCRParamsCheckedListBox.Items.AddRange(new object[] {
"MRZ fields",
"VIZ fields",
"BCR fields"});
this.OCRParamsCheckedListBox.Location = new System.Drawing.Point(12, 19);
this.OCRParamsCheckedListBox.Name = "OCRParamsCheckedListBox";
this.OCRParamsCheckedListBox.Size = new System.Drawing.Size(236, 64);
this.OCRParamsCheckedListBox.TabIndex = 0;
//
// LightsGroupBox
//
this.LightsGroupBox.Controls.Add(this.LightsCheckedListBox);
this.LightsGroupBox.Controls.Add(this.DocViewCheckBox);
this.LightsGroupBox.Location = new System.Drawing.Point(7, 169);
this.LightsGroupBox.Name = "LightsGroupBox";
this.LightsGroupBox.Size = new System.Drawing.Size(259, 159);
this.LightsGroupBox.TabIndex = 7;
this.LightsGroupBox.TabStop = false;
this.LightsGroupBox.Text = "Images";
//
// LightsCheckedListBox
//
this.LightsCheckedListBox.CheckOnClick = true;
this.LightsCheckedListBox.FormattingEnabled = true;
this.LightsCheckedListBox.Location = new System.Drawing.Point(12, 19);
this.LightsCheckedListBox.Name = "LightsCheckedListBox";
this.LightsCheckedListBox.Size = new System.Drawing.Size(236, 109);
this.LightsCheckedListBox.TabIndex = 0;
//
// DocViewCheckBox
//
this.DocViewCheckBox.AutoSize = true;
this.DocViewCheckBox.Location = new System.Drawing.Point(12, 134);
this.DocViewCheckBox.Name = "DocViewCheckBox";
this.DocViewCheckBox.Size = new System.Drawing.Size(149, 17);
this.DocViewCheckBox.TabIndex = 11;
this.DocViewCheckBox.Text = "Crop and rotate document";
this.DocViewCheckBox.UseVisualStyleBackColor = true;
//
// StartButton
//
this.StartButton.Enabled = false;
this.StartButton.Location = new System.Drawing.Point(69, 458);
this.StartButton.Name = "StartButton";
this.StartButton.Size = new System.Drawing.Size(133, 34);
this.StartButton.TabIndex = 9;
this.StartButton.Text = "Start";
this.StartButton.UseVisualStyleBackColor = true;
this.StartButton.Click += new System.EventHandler(this.StartButton_Click);
//
// FieldsTabControl
//
this.FieldsTabControl.Controls.Add(this.OcrTab);
this.FieldsTabControl.Controls.Add(this.DataTab);
this.FieldsTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.FieldsTabControl.Location = new System.Drawing.Point(0, 0);
this.FieldsTabControl.Name = "FieldsTabControl";
this.FieldsTabControl.SelectedIndex = 0;
this.FieldsTabControl.Size = new System.Drawing.Size(729, 533);
this.FieldsTabControl.TabIndex = 0;
//
// OcrTab
//
this.OcrTab.Controls.Add(this.splitContainer2);
this.OcrTab.Location = new System.Drawing.Point(4, 22);
this.OcrTab.Name = "OcrTab";
this.OcrTab.Size = new System.Drawing.Size(721, 507);
this.OcrTab.TabIndex = 0;
this.OcrTab.Text = "OCR";
this.OcrTab.UseVisualStyleBackColor = true;
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.FieldsDataGridView);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.BackColor = System.Drawing.Color.Transparent;
this.splitContainer2.Panel2.Controls.Add(this.FieldImagePictureBox);
this.splitContainer2.Panel2.Controls.Add(this.FieldImageGroup);
this.splitContainer2.Panel2.Controls.Add(this.ValuesGroup);
this.splitContainer2.Size = new System.Drawing.Size(721, 507);
this.splitContainer2.SplitterDistance = 327;
this.splitContainer2.TabIndex = 0;
//
// FieldsDataGridView
//
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.FieldsDataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.FieldsDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.FieldsDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.IndexColumn,
this.FieldIDColumn,
this.ValueColumn,
this.StatusColumn});
this.FieldsDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.FieldsDataGridView.Location = new System.Drawing.Point(0, 0);
this.FieldsDataGridView.Name = "FieldsDataGridView";
this.FieldsDataGridView.Size = new System.Drawing.Size(721, 327);
this.FieldsDataGridView.TabIndex = 0;
this.FieldsDataGridView.SelectionChanged += new System.EventHandler(this.FieldsDataGridView_SelectionChanged);
//
// IndexColumn
//
this.IndexColumn.HeaderText = "Index";
this.IndexColumn.Name = "IndexColumn";
this.IndexColumn.Visible = false;
//
// FieldIDColumn
//
this.FieldIDColumn.HeaderText = "Field ID";
this.FieldIDColumn.MinimumWidth = 160;
this.FieldIDColumn.Name = "FieldIDColumn";
this.FieldIDColumn.ReadOnly = true;
//
// ValueColumn
//
this.ValueColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.ValueColumn.HeaderText = "Value";
this.ValueColumn.Name = "ValueColumn";
this.ValueColumn.ReadOnly = true;
//
// StatusColumn
//
this.StatusColumn.HeaderText = "Status";
this.StatusColumn.Name = "StatusColumn";
this.StatusColumn.ReadOnly = true;
//
// FieldImagePictureBox
//
this.FieldImagePictureBox.Location = new System.Drawing.Point(141, 112);
this.FieldImagePictureBox.Name = "FieldImagePictureBox";
this.FieldImagePictureBox.Size = new System.Drawing.Size(566, 53);
this.FieldImagePictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.FieldImagePictureBox.TabIndex = 3;
this.FieldImagePictureBox.TabStop = false;
//
// FieldImageGroup
//
this.FieldImageGroup.Location = new System.Drawing.Point(3, 101);
this.FieldImageGroup.Name = "FieldImageGroup";
this.FieldImageGroup.Size = new System.Drawing.Size(710, 69);
this.FieldImageGroup.TabIndex = 7;
this.FieldImageGroup.TabStop = false;
this.FieldImageGroup.Text = "Field image";
//
// ValuesGroup
//
this.ValuesGroup.Controls.Add(this.RAWValueLabel);
this.ValuesGroup.Controls.Add(this.RLabel);
this.ValuesGroup.Controls.Add(this.FLabel);
this.ValuesGroup.Controls.Add(this.StandardizedValueLabel);
this.ValuesGroup.Controls.Add(this.SLabel);
this.ValuesGroup.Controls.Add(this.FormattedValueLabel);
this.ValuesGroup.Location = new System.Drawing.Point(3, 3);
this.ValuesGroup.Name = "ValuesGroup";
this.ValuesGroup.Size = new System.Drawing.Size(710, 92);
this.ValuesGroup.TabIndex = 8;
this.ValuesGroup.TabStop = false;
this.ValuesGroup.Text = "Values";
//
// RAWValueLabel
//
this.RAWValueLabel.AutoSize = true;
this.RAWValueLabel.Location = new System.Drawing.Point(141, 16);
this.RAWValueLabel.Name = "RAWValueLabel";
this.RAWValueLabel.Size = new System.Drawing.Size(0, 13);
this.RAWValueLabel.TabIndex = 6;
//
// RLabel
//
this.RLabel.AutoSize = true;
this.RLabel.Location = new System.Drawing.Point(8, 19);
this.RLabel.Name = "RLabel";
this.RLabel.Size = new System.Drawing.Size(36, 13);
this.RLabel.TabIndex = 2;
this.RLabel.Text = "RAW:";
//
// FLabel
//
this.FLabel.AutoSize = true;
this.FLabel.Location = new System.Drawing.Point(8, 41);
this.FLabel.Name = "FLabel";
this.FLabel.Size = new System.Drawing.Size(57, 13);
this.FLabel.TabIndex = 1;
this.FLabel.Text = "Formatted:";
//
// StandardizedValueLabel
//
this.StandardizedValueLabel.AutoSize = true;
this.StandardizedValueLabel.Location = new System.Drawing.Point(141, 60);
this.StandardizedValueLabel.Name = "StandardizedValueLabel";
this.StandardizedValueLabel.Size = new System.Drawing.Size(0, 13);
this.StandardizedValueLabel.TabIndex = 6;
//
// SLabel
//
this.SLabel.AutoSize = true;
this.SLabel.Location = new System.Drawing.Point(8, 63);
this.SLabel.Name = "SLabel";
this.SLabel.Size = new System.Drawing.Size(72, 13);
this.SLabel.TabIndex = 2;
this.SLabel.Text = "Standardized:";
//
// FormattedValueLabel
//
this.FormattedValueLabel.AutoSize = true;
this.FormattedValueLabel.Location = new System.Drawing.Point(141, 38);
this.FormattedValueLabel.Name = "FormattedValueLabel";
this.FormattedValueLabel.Size = new System.Drawing.Size(0, 13);
this.FormattedValueLabel.TabIndex = 5;
//
// DataTab
//
this.DataTab.Controls.Add(this.SignatureGroupBox);
this.DataTab.Controls.Add(this.PhotoGroupBox);
this.DataTab.Controls.Add(this.DocumentGroupBox);
this.DataTab.Controls.Add(this.PersonalGroupBox);
this.DataTab.Location = new System.Drawing.Point(4, 22);
this.DataTab.Name = "DataTab";
this.DataTab.Size = new System.Drawing.Size(721, 507);
this.DataTab.TabIndex = 1;
this.DataTab.Text = "Data";
this.DataTab.UseVisualStyleBackColor = true;
//
// SignatureGroupBox
//
this.SignatureGroupBox.Controls.Add(this.SignaturePictureBox);
this.SignatureGroupBox.Location = new System.Drawing.Point(3, 334);
this.SignatureGroupBox.Name = "SignatureGroupBox";
this.SignatureGroupBox.Size = new System.Drawing.Size(574, 158);
this.SignatureGroupBox.TabIndex = 4;
this.SignatureGroupBox.TabStop = false;
this.SignatureGroupBox.Text = "Signature";
//
// SignaturePictureBox
//
this.SignaturePictureBox.Location = new System.Drawing.Point(6, 19);
this.SignaturePictureBox.Name = "SignaturePictureBox";
this.SignaturePictureBox.Size = new System.Drawing.Size(562, 133);
this.SignaturePictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.SignaturePictureBox.TabIndex = 0;
this.SignaturePictureBox.TabStop = false;
//
// PhotoGroupBox
//
this.PhotoGroupBox.Controls.Add(this.PhotoPictureBox);
this.PhotoGroupBox.Location = new System.Drawing.Point(583, 3);
this.PhotoGroupBox.Name = "PhotoGroupBox";
this.PhotoGroupBox.Size = new System.Drawing.Size(130, 160);
this.PhotoGroupBox.TabIndex = 3;
this.PhotoGroupBox.TabStop = false;
this.PhotoGroupBox.Text = "Face Photo";
//
// PhotoPictureBox
//
this.PhotoPictureBox.Location = new System.Drawing.Point(6, 19);
this.PhotoPictureBox.Name = "PhotoPictureBox";
this.PhotoPictureBox.Size = new System.Drawing.Size(118, 135);
this.PhotoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.PhotoPictureBox.TabIndex = 0;
this.PhotoPictureBox.TabStop = false;
//
// DocumentGroupBox
//
this.DocumentGroupBox.Controls.Add(this.Validity);
this.DocumentGroupBox.Controls.Add(this.Number);
this.DocumentGroupBox.Controls.Add(this.Page);
this.DocumentGroupBox.Controls.Add(this.Type);
this.DocumentGroupBox.Controls.Add(this.Issuer);
this.DocumentGroupBox.Controls.Add(this.ValidityLabel);
this.DocumentGroupBox.Controls.Add(this.IssuerLabel);
this.DocumentGroupBox.Controls.Add(this.PageLabel);
this.DocumentGroupBox.Controls.Add(this.DocNumberLabel);
this.DocumentGroupBox.Controls.Add(this.TypeLabel);
this.DocumentGroupBox.Location = new System.Drawing.Point(3, 169);
this.DocumentGroupBox.Name = "DocumentGroupBox";
this.DocumentGroupBox.Size = new System.Drawing.Size(574, 159);
this.DocumentGroupBox.TabIndex = 2;
this.DocumentGroupBox.TabStop = false;
this.DocumentGroupBox.Text = "Document Data";
//
// Validity
//
this.Validity.AutoSize = true;
this.Validity.Location = new System.Drawing.Point(88, 130);
this.Validity.Name = "Validity";
this.Validity.Size = new System.Drawing.Size(0, 13);
this.Validity.TabIndex = 9;
//
// Number
//
this.Number.AutoSize = true;
this.Number.Location = new System.Drawing.Point(88, 104);
this.Number.Name = "Number";
this.Number.Size = new System.Drawing.Size(0, 13);
this.Number.TabIndex = 8;
//
// Page
//
this.Page.AutoSize = true;
this.Page.Location = new System.Drawing.Point(88, 78);
this.Page.Name = "Page";
this.Page.Size = new System.Drawing.Size(0, 13);
this.Page.TabIndex = 7;
//
// Type
//
this.Type.AutoSize = true;
this.Type.Location = new System.Drawing.Point(88, 52);
this.Type.Name = "Type";
this.Type.Size = new System.Drawing.Size(0, 13);
this.Type.TabIndex = 6;
//
// Issuer
//
this.Issuer.AutoSize = true;
this.Issuer.Location = new System.Drawing.Point(88, 26);
this.Issuer.Name = "Issuer";
this.Issuer.Size = new System.Drawing.Size(0, 13);
this.Issuer.TabIndex = 5;
//
// ValidityLabel
//
this.ValidityLabel.AutoSize = true;
this.ValidityLabel.Location = new System.Drawing.Point(6, 130);
this.ValidityLabel.Name = "ValidityLabel";
this.ValidityLabel.Size = new System.Drawing.Size(33, 13);
this.ValidityLabel.TabIndex = 4;
this.ValidityLabel.Text = "Valid:";
//
// IssuerLabel
//
this.IssuerLabel.AutoSize = true;
this.IssuerLabel.Location = new System.Drawing.Point(6, 26);
this.IssuerLabel.Name = "IssuerLabel";
this.IssuerLabel.Size = new System.Drawing.Size(38, 13);
this.IssuerLabel.TabIndex = 0;
this.IssuerLabel.Text = "Issuer:";
//
// PageLabel
//
this.PageLabel.AutoSize = true;
this.PageLabel.Location = new System.Drawing.Point(6, 78);
this.PageLabel.Name = "PageLabel";
this.PageLabel.Size = new System.Drawing.Size(35, 13);
this.PageLabel.TabIndex = 2;
this.PageLabel.Text = "Page:";
//
// DocNumberLabel
//
this.DocNumberLabel.AutoSize = true;
this.DocNumberLabel.Location = new System.Drawing.Point(6, 104);
this.DocNumberLabel.Name = "DocNumberLabel";
this.DocNumberLabel.Size = new System.Drawing.Size(47, 13);
this.DocNumberLabel.TabIndex = 3;
this.DocNumberLabel.Text = "Number:";
//
// TypeLabel
//
this.TypeLabel.AutoSize = true;
this.TypeLabel.Location = new System.Drawing.Point(6, 52);
this.TypeLabel.Name = "TypeLabel";
this.TypeLabel.Size = new System.Drawing.Size(34, 13);
this.TypeLabel.TabIndex = 1;
this.TypeLabel.Text = "Type:";
//
// PersonalGroupBox
//
this.PersonalGroupBox.Controls.Add(this.Sex);
this.PersonalGroupBox.Controls.Add(this.Nationality);
this.PersonalGroupBox.Controls.Add(this.Birth);
this.PersonalGroupBox.Controls.Add(this.Name2);
this.PersonalGroupBox.Controls.Add(this.Name1);
this.PersonalGroupBox.Controls.Add(this.SexLabel);
this.PersonalGroupBox.Controls.Add(this.NationalityLabel);
this.PersonalGroupBox.Controls.Add(this.BirthLabel);
this.PersonalGroupBox.Controls.Add(this.NameLabel);
this.PersonalGroupBox.Location = new System.Drawing.Point(3, 3);
this.PersonalGroupBox.Name = "PersonalGroupBox";
this.PersonalGroupBox.Size = new System.Drawing.Size(574, 160);
this.PersonalGroupBox.TabIndex = 1;
this.PersonalGroupBox.TabStop = false;
this.PersonalGroupBox.Text = "Personal Data";
//
// Sex
//
this.Sex.AutoSize = true;
this.Sex.Location = new System.Drawing.Point(88, 132);
this.Sex.Name = "Sex";
this.Sex.Size = new System.Drawing.Size(0, 13);
this.Sex.TabIndex = 8;
//
// Nationality
//
this.Nationality.AutoSize = true;
this.Nationality.Location = new System.Drawing.Point(88, 106);
this.Nationality.Name = "Nationality";
this.Nationality.Size = new System.Drawing.Size(0, 13);
this.Nationality.TabIndex = 7;
//
// Birth
//
this.Birth.AutoSize = true;
this.Birth.Location = new System.Drawing.Point(88, 80);
this.Birth.Name = "Birth";
this.Birth.Size = new System.Drawing.Size(0, 13);
this.Birth.TabIndex = 6;
//
// Name2
//
this.Name2.AutoSize = true;
this.Name2.Location = new System.Drawing.Point(88, 54);
this.Name2.Name = "Name2";
this.Name2.Size = new System.Drawing.Size(0, 13);
this.Name2.TabIndex = 5;
//
// Name1
//
this.Name1.AutoSize = true;
this.Name1.Location = new System.Drawing.Point(88, 28);
this.Name1.Name = "Name1";
this.Name1.Size = new System.Drawing.Size(0, 13);
this.Name1.TabIndex = 4;
//
// SexLabel
//
this.SexLabel.AutoSize = true;
this.SexLabel.Location = new System.Drawing.Point(6, 132);
this.SexLabel.Name = "SexLabel";
this.SexLabel.Size = new System.Drawing.Size(28, 13);
this.SexLabel.TabIndex = 3;
this.SexLabel.Text = "Sex:";
//
// NationalityLabel
//
this.NationalityLabel.AutoSize = true;
this.NationalityLabel.Location = new System.Drawing.Point(6, 106);
this.NationalityLabel.Name = "NationalityLabel";
this.NationalityLabel.Size = new System.Drawing.Size(59, 13);
this.NationalityLabel.TabIndex = 2;
this.NationalityLabel.Text = "Nationality:";
//
// BirthLabel
//
this.BirthLabel.AutoSize = true;
this.BirthLabel.Location = new System.Drawing.Point(6, 80);
this.BirthLabel.Name = "BirthLabel";
this.BirthLabel.Size = new System.Drawing.Size(31, 13);
this.BirthLabel.TabIndex = 1;
this.BirthLabel.Text = "Birth:";
//
// NameLabel
//
this.NameLabel.AutoSize = true;
this.NameLabel.Location = new System.Drawing.Point(6, 28);
this.NameLabel.Name = "NameLabel";
this.NameLabel.Size = new System.Drawing.Size(38, 13);
this.NameLabel.TabIndex = 0;
this.NameLabel.Text = "Name:";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1016, 533);
this.Controls.Add(this.splitContainer1);
this.Name = "Form1";
this.Text = "Scanner Sample";
this.Load += new System.EventHandler(this.FormLoad);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormClose);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.OptionsTabControl.ResumeLayout(false);
this.OptionsTab.ResumeLayout(false);
this.DevicesGroupBox.ResumeLayout(false);
this.OCRGroupBox.ResumeLayout(false);
this.LightsGroupBox.ResumeLayout(false);
this.LightsGroupBox.PerformLayout();
this.FieldsTabControl.ResumeLayout(false);
this.OcrTab.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
this.splitContainer2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.FieldsDataGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.FieldImagePictureBox)).EndInit();
this.ValuesGroup.ResumeLayout(false);
this.ValuesGroup.PerformLayout();
this.DataTab.ResumeLayout(false);
this.SignatureGroupBox.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.SignaturePictureBox)).EndInit();
this.PhotoGroupBox.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.PhotoPictureBox)).EndInit();
this.DocumentGroupBox.ResumeLayout(false);
this.DocumentGroupBox.PerformLayout();
this.PersonalGroupBox.ResumeLayout(false);
this.PersonalGroupBox.PerformLayout();
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.ListBox DevicesListBox;
private System.Windows.Forms.Button ConnectButton;
private System.Windows.Forms.Button DisconnectButton;
private System.Windows.Forms.GroupBox LightsGroupBox;
private System.Windows.Forms.CheckedListBox LightsCheckedListBox;
private System.Windows.Forms.CheckBox DocViewCheckBox;
private System.Windows.Forms.GroupBox OCRGroupBox;
private System.Windows.Forms.CheckedListBox OCRParamsCheckedListBox;
private System.Windows.Forms.Button StartButton;
private System.Windows.Forms.TabControl FieldsTabControl;
private System.Windows.Forms.TabPage OcrTab;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.DataGridView FieldsDataGridView;
private System.Windows.Forms.Label RAWValueLabel;
private System.Windows.Forms.Label FormattedValueLabel;
private System.Windows.Forms.Label StandardizedValueLabel;
private System.Windows.Forms.PictureBox FieldImagePictureBox;
private System.Windows.Forms.Label RLabel;
private System.Windows.Forms.Label FLabel;
private System.Windows.Forms.Label SLabel;
private System.Windows.Forms.DataGridViewTextBoxColumn IndexColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn FieldIDColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn ValueColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn StatusColumn;
private System.Windows.Forms.TabPage DataTab;
private System.Windows.Forms.Label NameLabel;
private System.Windows.Forms.GroupBox PersonalGroupBox;
private System.Windows.Forms.Label SexLabel;
private System.Windows.Forms.Label NationalityLabel;
private System.Windows.Forms.Label BirthLabel;
private System.Windows.Forms.GroupBox DocumentGroupBox;
private System.Windows.Forms.Label ValidityLabel;
private System.Windows.Forms.Label DocNumberLabel;
private System.Windows.Forms.Label PageLabel;
private System.Windows.Forms.Label TypeLabel;
private System.Windows.Forms.Label IssuerLabel;
private System.Windows.Forms.Label Validity;
private System.Windows.Forms.Label Number;
private System.Windows.Forms.Label Page;
private System.Windows.Forms.Label Type;
private System.Windows.Forms.Label Issuer;
private System.Windows.Forms.Label Sex;
private System.Windows.Forms.Label Nationality;
private System.Windows.Forms.Label Birth;
private System.Windows.Forms.Label Name2;
private System.Windows.Forms.Label Name1;
private System.Windows.Forms.GroupBox PhotoGroupBox;
private System.Windows.Forms.PictureBox PhotoPictureBox;
private System.Windows.Forms.GroupBox SignatureGroupBox;
private System.Windows.Forms.PictureBox SignaturePictureBox;
private System.Windows.Forms.GroupBox DevicesGroupBox;
private System.Windows.Forms.GroupBox FieldImageGroup;
private System.Windows.Forms.GroupBox ValuesGroup;
private System.Windows.Forms.TabPage OptionsTab;
private System.Windows.Forms.TabControl OptionsTabControl;
}
}

Which portion of this code do you need converted? A lot of this code is in the category of "Code Behind" and is generated by the form designer, which in this case appears to be Winforms. My understanding is the code conversion utility is meant more for converting user code or user written classes.


I send you by WeTransfer the packeg complete,

May be i'ts better to you

As Michael mentions here, a good portion of this code, (Form1.Designer.cs and event handling code in Form1.cs ) is generated and maintained by the WinForm designer. In order to convert this to COBOL, I believe that you will have to create a COBOL Winform Application project and redesign the form so that it generates COBOL instead of C#. The other user written code in Form1 that interfaces to Pr22 can be converted manually once the Form1 code is generated by the Designer.


As Michael mentions here, a good portion of this code, (Form1.Designer.cs and event handling code in Form1.cs ) is generated and maintained by the WinForm designer. In order to convert this to COBOL, I believe that you will have to create a COBOL Winform Application project and redesign the form so that it generates COBOL instead of C#. The other user written code in Form1 that interfaces to Pr22 can be converted manually once the Form1 code is generated by the Designer.

Hi Chris and Michael,

I think I understand your idea.
I'm going to take advantage of the Easter weekend to try to create the base program in WindowsForm (or in WPF).
I will also do the basic programming part and then I will try to convert the PR22 interface parts.

I'll give you news soon.
Thanks again for the help.
A good Easter to everyone.

Hi Chris and Michael,

I think I understand your idea.
I'm going to take advantage of the Easter weekend to try to create the base program in WindowsForm (or in WPF).
I will also do the basic programming part and then I will try to convert the PR22 interface parts.

I'll give you news soon.
Thanks again for the help.
A good Easter to everyone.

Hi, 

As agreed, I already did the "conversion" of the Windows Forms part and the screen part already worked (see ScanARHV2.exe in the debug folder).
Now the problem is two:
- The parts that I couldn't convert due to an error in "">cs2cobol.microfocuscloud.com/"
- Errors that appear after conversion.

I converted part by part and some of the complete ones have some errors.

All the ones with "method + end.metod" were the ones I couldn't convert (I put it like that to make it easier to see the sequence).

I couldn't understand why it gives errors in the conversion.
Most of the compilation errors have to do with the type of instruction that uses the "+" symbol (ex: "set pr::ImageScanned to pr::ImageScanned + ImageScanned
".

I don't know if they can help me, I'm waiting.

I sent via wetransfer the project I created and where everything I mentioned above is.

The link to download is as follows: 
https://we.tl/t-DARLHMmRDr?utm_campaign=TRN_TDL_05&utm_source=sendgrid&utm_medium=email&trk=TRN_TDL_05


Thanks again

Hello,

At first glance many of the syntax errors in your event handling code are due to the fact that you are invoking Instance methods as static methods. e.g.

FieldsTabControl is an instantiated object, but you are treating the Clear() method as a static method by invoking it with the keyword "type".

Instead of:

invoke type FieldsTabControl.Controls::Clear()

It should be:

invoke FieldsTabControl.Controls::Clear()

You don't need the Type keyword on non-static or instance methods.

Also in at least one case the "+" is used as a concatenation character for a String concatenation. It should be "&"

In several cases it appears the pr object has events that need to be attached to event handlers, but would need to see original C# code.

set pr::Connection to pr::Connection + DeviceConnected
set pr::PresenceStateChanged to pr::PresenceStateChanged + DocumentStateChanged
set pr::ImageScanned to pr::ImageScanned + ImageScanned
set pr::ScanFinished to pr::ScanFinished + ScanFinished
set pr::DocFrameFound to pr::DocFrameFound + DocFrameFound


I cannot test it here but here is a converted version of the code that no longer reports errors. No guarantees that it will actually run correctly:

      $set ilusing(System)
      $set ilusing(System.Collections.Generic)
      $set ilusing(System.Drawing)
      $set ilusing(System.Windows.Forms)
      $set ilusing(Pr22)
      $set ilusing(Pr22.Processing)
      $set ilusing(Pr22.Exceptions)

      $SET SQL(DBMAN=ODBC)
       class-id ScanARHV2.Form1 is partial inherits type System.Windows.Forms.Form.

       working-storage section.
       01 pr type Pr22.DocumentReaderDevice initialize only private.
       01 DeviceIsConnected condition-value private.
       01 ScanCtrl type Pr22.Task.TaskControl private.
       01 AnalyzeResult type Pr22.Processing.Document private.

       method-id NEW.
       procedure division.
           invoke self::InitializeComponent
           try
               set pr to new Pr22.DocumentReaderDevice()
           catch ex as type Exception
               if ex instance of type DllNotFoundException or ex instance of type Pr22.Exceptions.FileOpen
           declare platform as binary-long = type IntPtr::Size * 8
                   declare codepl as binary-long = GetCodePlatform()
                   invoke type MessageBox::Show("This sample program", "Error", type MessageBoxButtons::OK, type MessageBoxIcon::Stop)
               else
                   invoke type MessageBox::Show(ex::Message, "Error", type MessageBoxButtons::OK, type MessageBoxIcon::Stop)
               end-if
           end-try
       end method.

       method-id FormLoad (sender as object, e as type EventArgs) private.
           if pr = null
               invoke #Close()
               goback
           end-if

           *>set pr::Connection to pr::Connection + DeviceConnected
           attach method self::DeviceConnected to pr::Connection
           attach method self::DocumentStateChanged to pr::PresenceStateChanged
           attach method self::ImageScanned to pr::ImageScanned
           attach method self::ScanFinished to pr::ScanFinished
           attach method self::DocFrameFound to pr::DocFrameFound 
       end method.

       method-id FormClose (sender as object, e as type FormClosingEventArgs) private.
           if DeviceIsConnected
               invoke CloseScan()
               invoke pr::Close()
           end-if
       end method.

       *> This raises only when no device is used or when the currently used
       *> device is disconnected.
       method-id DeviceConnected (sender as object, e as type Pr22.Events.ConnectionEventArgs) private.
           invoke UpdateDeviceList()
       end method.

       method-id UpdateDeviceList private.
           if InvokeRequired
               invoke BeginInvoke(new MethodInvoker(method UpdateDeviceList))
               goback
           end-if
           declare Devices as type List[string] = type Pr22.DocumentReaderDevice::GetDeviceList()
           invoke DevicesListBox::Items::Clear()
           perform varying s as string thru Devices
               invoke DevicesListBox::Items::Add(s)
           end-perform
       end method.

       method-id ConnectButton_Click (sender as object, e as type EventArgs) private.
           if DevicesListBox::SelectedIndex < 0
               goback
           end-if

           set ConnectButton::Enabled to false
           set #Cursor to type Cursors::WaitCursor
           try
               invoke pr::UseDevice(DevicesListBox::Text)
               set DeviceIsConnected to true
               invoke pr::Scanner::StartTask(type Pr22.Task.FreerunTask::Detection())
               set DisconnectButton::Enabled to true
               declare Lights as type List[type Pr22.Imaging.Light] = pr::Scanner::Info::GetLights()
               perform varying light as type Pr22.Imaging.Light thru Lights
                   invoke LightsCheckedListBox::Items::Add(light)
               end-perform
               set StartButton::Enabled to true
           catch ex as type Pr22.Exceptions.General
               invoke type MessageBox::Show(ex::Message, "Error", type MessageBoxButtons::OK, type MessageBoxIcon::Stop)
               invoke DisconnectButton_Click(sender, e)
           end-try
           set #Cursor to type Cursors::Default
       end method.

       method-id DisconnectButton_Click (sender as object, e as type EventArgs) private.
           if DeviceIsConnected
               invoke CloseScan()
               invoke type Application::DoEvents()
               invoke pr::Close()
               set DeviceIsConnected to false
           end-if
           set ConnectButton::Enabled to true
           set DisconnectButton::Enabled to false
           set StartButton::Enabled to false
           invoke LightsCheckedListBox::Items::Clear()
           invoke FieldsTabControl::Controls::Clear()
           invoke FieldsTabControl::Controls::Add(OcrTab)
           invoke FieldsTabControl::Controls::Add(DataTab)
           invoke FieldsDataGridView::Rows::Clear()
           invoke ClearOCRData()
           invoke ClearDataPage()
       end method.

      * To raise this event FreerunTask.Detection() has to be started.
       method-id DocumentStateChanged (sender as object, e as type Pr22.Events.DetectionEventArgs) private.
           if e::State = type Pr22.Util.PresenceState::Present
               invoke BeginInvoke(new EventHandler(method StartButton_Click), sender, e)
           end-if
       end method.

       method-id StartButton_Click (sender as object, e as type EventArgs) private.
           invoke FieldsTabControl::Controls::Clear()
           invoke FieldsTabControl::Controls::Add(OcrTab)
           invoke FieldsTabControl::Controls::Add(DataTab)
           invoke FieldsDataGridView::Rows::Clear()
           invoke ClearOCRData()
           invoke ClearDataPage()
           if LightsCheckedListBox::CheckedItems::Count = 0
               invoke type MessageBox::Show("No light selected to scan!", "Info", type MessageBoxButtons::OK, type MessageBoxIcon::Information)
               goback
           end-if
           set StartButton::Enabled to false
           declare ScanTask as type Pr22.Task.DocScannerTask = new Pr22.Task.DocScannerTask()
           perform varying light as type Pr22.Imaging.Light thru LightsCheckedListBox::CheckedItems
               invoke AddTabPage(light::ToString())
               invoke ScanTask::Add(light)
           end-perform
           set ScanCtrl to pr::Scanner::StartScanning(ScanTask, type Pr22.Imaging.PagePosition::First)
       end method.

       method-id ImageScanned (sender as object, e as type Pr22.Events.ImageEventArgs) private.
           invoke DrawImage(e)
       end method.

       method-id DocFrameFound (sender as object, e as type Pr22.Events.PageEventArgs) private.
       end method.

       method-id DrawImage (e as type Pr22.Events.ImageEventArgs) private.
       end method.

       method-id ScanFinished (sender as object, e as type Pr22.Events.PageEventArgs) private.
           invoke BeginInvoke(new MethodInvoker(Analyze))
           invoke BeginInvoke(new MethodInvoker(method CloseScan))
       end method.

       method-id CloseScan private.
           try
               if ScanCtrl <> null
                   invoke ScanCtrl::Wait()
               end-if
           catch ex as type Pr22.Exceptions.General
               invoke type MessageBox::Show(ex::Message, "Error", type MessageBoxButtons::OK, type MessageBoxIcon::Stop)
           end-try
           set ScanCtrl to null
           set StartButton::Enabled to true
       end method.


       *>----------------------------------------------------------------------

       method-id Analyze private.
       end method.

       method-id FillOcrDataGrid private.
       end method.

       method-id FieldsDataGridView_SelectionChanged (sender as object, e as type EventArgs) private.
       end method.

       method-id FillDataPage private.
       end method.

       method-id GetAmid (#field as type Field) returning return-value as string private.
       end method.

       method-id GetFieldValue (#Id as type Pr22.Processing.FieldId) returning return-value as string private.
       end method.

       method-id PrintBinary (arr as binary-char unsigned occurs any, #pos as binary-long, sz as binary-long) returning return-value as string static private.
           declare p0 as binary-long
           declare str as string = ""
           declare str2 as string = ""
           perform varying p0 from #pos by 1 until not (p0 < arr::Length and p0 < #pos + sz)
               set str to str & arr[p0]::ToString("X2") & " "
               if arr[p0] < h"21" or arr[p0] > h"7e"
                  set str2 to str2 & '.'
               else
                  set str2 to str2 & arr[p0] as character
               end-if
           end-perform
           perform until not (p0 < #pos + sz)
               set str to str & "   "
               set str2 to str2 & " "
               set p0 to p0 + 1
           end-perform
           set return-value to str & str2
       end method.

       method-id AddTabPage (lightName as string) returning return-value as type Control occurs any private.
           declare ImageTabPage as type TabPage = new TabPage(lightName)
           set ImageTabPage::Name to lightName
           declare PBox as type PictureBox = new PictureBox()
           invoke ImageTabPage::Controls::Add(PBox)
           invoke FieldsTabControl::Controls::Add(ImageTabPage)
           set PBox::Size to ImageTabPage::Size
           set return-value to table of type Control (ImageTabPage)
       end method.

       method-id ClearOCRData private.
           set FieldImagePictureBox::Image to null
           set RAWValueLabel::Text to ""
           set FormattedValueLabel::Text to ""
           set StandardizedValueLabel::Text to "" 
       end method.

       method-id ClearDataPage private.
           set Name1::Text to ""
           set Name2::Text to ""
           set Birth::Text to ""
           set Nationality::Text to ""
           set Sex::Text to ""
           set Issuer::Text to ""
           set Typex::Text to ""
           set Pagex::Text to Numberx::Text      
           set PhotoPictureBox::Image to null
           set SignaturePictureBox::Image to null
       end method.

       method-id GetCodePlatform returning return-value as binary-long private.
           declare pek as type System.Reflection.PortableExecutableKinds
           declare mac as type System.Reflection.ImageFileMachine
           invoke type System.Reflection.Assembly::GetExecutingAssembly::ManifestModule::GetPEKind(pek, mac)
           if (pek b-and type System.Reflection.PortableExecutableKinds::PE32Plus) <> 0

               set return-value to 64
               goback
           end-if
           if (pek b-and type System.Reflection.PortableExecutableKinds::Required32Bit) <> 0
               set return-value to 32
               goback
           end-if
           set return-value to 0
       end method.


       end class.

       class-id StrCon.
       01 fstr string private value "".
       01 cstr string private value "".

       method-id new.
       end method.

       method-id new (bounder as string).
           set cstr to bounder & " "
       end method.

       operator-id + (csv as type StrCon, str as string) returning return-value as string static.
           if str <> ""
               set str to csv::cstr & str
           end-if
           if csv::fstr <> "" and str <> "" and str[0] <> ','
               set csv::fstr to csv::fstr & " "
           end-if
           set return-value to csv::fstr & str
       end operator.

       operator-id + (str as string, csv as type StrCon) returning return-value as type StrCon static.
           set csv::fstr to str
           set return-value to csv
       end operator.

       end class.


I cannot test it here but here is a converted version of the code that no longer reports errors. No guarantees that it will actually run correctly:

      $set ilusing(System)
      $set ilusing(System.Collections.Generic)
      $set ilusing(System.Drawing)
      $set ilusing(System.Windows.Forms)
      $set ilusing(Pr22)
      $set ilusing(Pr22.Processing)
      $set ilusing(Pr22.Exceptions)

      $SET SQL(DBMAN=ODBC)
       class-id ScanARHV2.Form1 is partial inherits type System.Windows.Forms.Form.

       working-storage section.
       01 pr type Pr22.DocumentReaderDevice initialize only private.
       01 DeviceIsConnected condition-value private.
       01 ScanCtrl type Pr22.Task.TaskControl private.
       01 AnalyzeResult type Pr22.Processing.Document private.

       method-id NEW.
       procedure division.
           invoke self::InitializeComponent
           try
               set pr to new Pr22.DocumentReaderDevice()
           catch ex as type Exception
               if ex instance of type DllNotFoundException or ex instance of type Pr22.Exceptions.FileOpen
           declare platform as binary-long = type IntPtr::Size * 8
                   declare codepl as binary-long = GetCodePlatform()
                   invoke type MessageBox::Show("This sample program", "Error", type MessageBoxButtons::OK, type MessageBoxIcon::Stop)
               else
                   invoke type MessageBox::Show(ex::Message, "Error", type MessageBoxButtons::OK, type MessageBoxIcon::Stop)
               end-if
           end-try
       end method.

       method-id FormLoad (sender as object, e as type EventArgs) private.
           if pr = null
               invoke #Close()
               goback
           end-if

           *>set pr::Connection to pr::Connection + DeviceConnected
           attach method self::DeviceConnected to pr::Connection
           attach method self::DocumentStateChanged to pr::PresenceStateChanged
           attach method self::ImageScanned to pr::ImageScanned
           attach method self::ScanFinished to pr::ScanFinished
           attach method self::DocFrameFound to pr::DocFrameFound 
       end method.

       method-id FormClose (sender as object, e as type FormClosingEventArgs) private.
           if DeviceIsConnected
               invoke CloseScan()
               invoke pr::Close()
           end-if
       end method.

       *> This raises only when no device is used or when the currently used
       *> device is disconnected.
       method-id DeviceConnected (sender as object, e as type Pr22.Events.ConnectionEventArgs) private.
           invoke UpdateDeviceList()
       end method.

       method-id UpdateDeviceList private.
           if InvokeRequired
               invoke BeginInvoke(new MethodInvoker(method UpdateDeviceList))
               goback
           end-if
           declare Devices as type List[string] = type Pr22.DocumentReaderDevice::GetDeviceList()
           invoke DevicesListBox::Items::Clear()
           perform varying s as string thru Devices
               invoke DevicesListBox::Items::Add(s)
           end-perform
       end method.

       method-id ConnectButton_Click (sender as object, e as type EventArgs) private.
           if DevicesListBox::SelectedIndex < 0
               goback
           end-if

           set ConnectButton::Enabled to false
           set #Cursor to type Cursors::WaitCursor
           try
               invoke pr::UseDevice(DevicesListBox::Text)
               set DeviceIsConnected to true
               invoke pr::Scanner::StartTask(type Pr22.Task.FreerunTask::Detection())
               set DisconnectButton::Enabled to true
               declare Lights as type List[type Pr22.Imaging.Light] = pr::Scanner::Info::GetLights()
               perform varying light as type Pr22.Imaging.Light thru Lights
                   invoke LightsCheckedListBox::Items::Add(light)
               end-perform
               set StartButton::Enabled to true
           catch ex as type Pr22.Exceptions.General
               invoke type MessageBox::Show(ex::Message, "Error", type MessageBoxButtons::OK, type MessageBoxIcon::Stop)
               invoke DisconnectButton_Click(sender, e)
           end-try
           set #Cursor to type Cursors::Default
       end method.

       method-id DisconnectButton_Click (sender as object, e as type EventArgs) private.
           if DeviceIsConnected
               invoke CloseScan()
               invoke type Application::DoEvents()
               invoke pr::Close()
               set DeviceIsConnected to false
           end-if
           set ConnectButton::Enabled to true
           set DisconnectButton::Enabled to false
           set StartButton::Enabled to false
           invoke LightsCheckedListBox::Items::Clear()
           invoke FieldsTabControl::Controls::Clear()
           invoke FieldsTabControl::Controls::Add(OcrTab)
           invoke FieldsTabControl::Controls::Add(DataTab)
           invoke FieldsDataGridView::Rows::Clear()
           invoke ClearOCRData()
           invoke ClearDataPage()
       end method.

      * To raise this event FreerunTask.Detection() has to be started.
       method-id DocumentStateChanged (sender as object, e as type Pr22.Events.DetectionEventArgs) private.
           if e::State = type Pr22.Util.PresenceState::Present
               invoke BeginInvoke(new EventHandler(method StartButton_Click), sender, e)
           end-if
       end method.

       method-id StartButton_Click (sender as object, e as type EventArgs) private.
           invoke FieldsTabControl::Controls::Clear()
           invoke FieldsTabControl::Controls::Add(OcrTab)
           invoke FieldsTabControl::Controls::Add(DataTab)
           invoke FieldsDataGridView::Rows::Clear()
           invoke ClearOCRData()
           invoke ClearDataPage()
           if LightsCheckedListBox::CheckedItems::Count = 0
               invoke type MessageBox::Show("No light selected to scan!", "Info", type MessageBoxButtons::OK, type MessageBoxIcon::Information)
               goback
           end-if
           set StartButton::Enabled to false
           declare ScanTask as type Pr22.Task.DocScannerTask = new Pr22.Task.DocScannerTask()
           perform varying light as type Pr22.Imaging.Light thru LightsCheckedListBox::CheckedItems
               invoke AddTabPage(light::ToString())
               invoke ScanTask::Add(light)
           end-perform
           set ScanCtrl to pr::Scanner::StartScanning(ScanTask, type Pr22.Imaging.PagePosition::First)
       end method.

       method-id ImageScanned (sender as object, e as type Pr22.Events.ImageEventArgs) private.
           invoke DrawImage(e)
       end method.

       method-id DocFrameFound (sender as object, e as type Pr22.Events.PageEventArgs) private.
       end method.

       method-id DrawImage (e as type Pr22.Events.ImageEventArgs) private.
       end method.

       method-id ScanFinished (sender as object, e as type Pr22.Events.PageEventArgs) private.
           invoke BeginInvoke(new MethodInvoker(Analyze))
           invoke BeginInvoke(new MethodInvoker(method CloseScan))
       end method.

       method-id CloseScan private.
           try
               if ScanCtrl <> null
                   invoke ScanCtrl::Wait()
               end-if
           catch ex as type Pr22.Exceptions.General
               invoke type MessageBox::Show(ex::Message, "Error", type MessageBoxButtons::OK, type MessageBoxIcon::Stop)
           end-try
           set ScanCtrl to null
           set StartButton::Enabled to true
       end method.


       *>----------------------------------------------------------------------

       method-id Analyze private.
       end method.

       method-id FillOcrDataGrid private.
       end method.

       method-id FieldsDataGridView_SelectionChanged (sender as object, e as type EventArgs) private.
       end method.

       method-id FillDataPage private.
       end method.

       method-id GetAmid (#field as type Field) returning return-value as string private.
       end method.

       method-id GetFieldValue (#Id as type Pr22.Processing.FieldId) returning return-value as string private.
       end method.

       method-id PrintBinary (arr as binary-char unsigned occurs any, #pos as binary-long, sz as binary-long) returning return-value as string static private.
           declare p0 as binary-long
           declare str as string = ""
           declare str2 as string = ""
           perform varying p0 from #pos by 1 until not (p0 < arr::Length and p0 < #pos + sz)
               set str to str & arr[p0]::ToString("X2") & " "
               if arr[p0] < h"21" or arr[p0] > h"7e"
                  set str2 to str2 & '.'
               else
                  set str2 to str2 & arr[p0] as character
               end-if
           end-perform
           perform until not (p0 < #pos + sz)
               set str to str & "   "
               set str2 to str2 & " "
               set p0 to p0 + 1
           end-perform
           set return-value to str & str2
       end method.

       method-id AddTabPage (lightName as string) returning return-value as type Control occurs any private.
           declare ImageTabPage as type TabPage = new TabPage(lightName)
           set ImageTabPage::Name to lightName
           declare PBox as type PictureBox = new PictureBox()
           invoke ImageTabPage::Controls::Add(PBox)
           invoke FieldsTabControl::Controls::Add(ImageTabPage)
           set PBox::Size to ImageTabPage::Size
           set return-value to table of type Control (ImageTabPage)
       end method.

       method-id ClearOCRData private.
           set FieldImagePictureBox::Image to null
           set RAWValueLabel::Text to ""
           set FormattedValueLabel::Text to ""
           set StandardizedValueLabel::Text to "" 
       end method.

       method-id ClearDataPage private.
           set Name1::Text to ""
           set Name2::Text to ""
           set Birth::Text to ""
           set Nationality::Text to ""
           set Sex::Text to ""
           set Issuer::Text to ""
           set Typex::Text to ""
           set Pagex::Text to Numberx::Text      
           set PhotoPictureBox::Image to null
           set SignaturePictureBox::Image to null
       end method.

       method-id GetCodePlatform returning return-value as binary-long private.
           declare pek as type System.Reflection.PortableExecutableKinds
           declare mac as type System.Reflection.ImageFileMachine
           invoke type System.Reflection.Assembly::GetExecutingAssembly::ManifestModule::GetPEKind(pek, mac)
           if (pek b-and type System.Reflection.PortableExecutableKinds::PE32Plus) <> 0

               set return-value to 64
               goback
           end-if
           if (pek b-and type System.Reflection.PortableExecutableKinds::Required32Bit) <> 0
               set return-value to 32
               goback
           end-if
           set return-value to 0
       end method.


       end class.

       class-id StrCon.
       01 fstr string private value "".
       01 cstr string private value "".

       method-id new.
       end method.

       method-id new (bounder as string).
           set cstr to bounder & " "
       end method.

       operator-id + (csv as type StrCon, str as string) returning return-value as string static.
           if str <> ""
               set str to csv::cstr & str
           end-if
           if csv::fstr <> "" and str <> "" and str[0] <> ','
               set csv::fstr to csv::fstr & " "
           end-if
           set return-value to csv::fstr & str
       end operator.

       operator-id + (str as string, csv as type StrCon) returning return-value as type StrCon static.
           set csv::fstr to str
           set return-value to csv
       end operator.

       end class.

Hello Michael and Chris,

With your great help I only have two problems:
- errors in the #close and #cursor variables
- Routines that give errors when converting using "C# to MicroFocus Converter"
I still can't understand why it gives an error, I've tried removing parts but it gives an error.
The parts that I cannot "convert" because it gives an error are those indicated below.


        void DocFrameFound(object sender, Pr22.Events.PageEventArgs e)
        {
            if (!DocViewCheckBox.Checked) return;
            foreach (Control tab in FieldsTabControl.Controls)
            {
                try
                {
                    Pr22.Imaging.Light light = (Pr22.Imaging.Light)Enum.Parse(typeof(Pr22.Imaging.Light), tab.Text);
                    if (((PictureBox)tab.Controls[0]).Image != null)
                        DrawImage(new Pr22.Events.ImageEventArgs(e.Page, light));
                }
                catch (System.ArgumentException) { }
            }
        }

        void DrawImage(Pr22.Events.ImageEventArgs e)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new Action<Pr22.Events.ImageEventArgs>(DrawImage), e);
                return;
            }
            Pr22.Imaging.DocImage docImage = pr.Scanner.GetPage(e.Page).Select(e.Light);
            Control[] tabs = FieldsTabControl.Controls.Find(e.Light.ToString(), false);
            //if (tabs.Length == 0) tabs = AddTabPage(e.Light.ToString());
            if (tabs.Length == 0) return;
            PictureBox pb = (PictureBox)tabs[0].Controls[0];
            Bitmap bmap = docImage.ToBitmap();
            if (DocViewCheckBox.Checked)
            {
                try { bmap = docImage.DocView().ToBitmap(); }
                catch (Pr22.Exceptions.General) { }
            }
            pb.SizeMode = PictureBoxSizeMode.Zoom;
            pb.Image = bmap;
            pb.Refresh();
        }

       void Analyze()
       {
           Pr22.Task.EngineTask OcrTask = new Pr22.Task.EngineTask();

           if (OCRParamsCheckedListBox.GetItemCheckState(0) == CheckState.Checked)
               OcrTask.Add(FieldSource.Mrz, FieldId.All);
           if (OCRParamsCheckedListBox.GetItemCheckState(1) == CheckState.Checked)
               OcrTask.Add(FieldSource.Viz, FieldId.All);
           if (OCRParamsCheckedListBox.GetItemCheckState(2) == CheckState.Checked)
               OcrTask.Add(FieldSource.Barcode, FieldId.All);

           Pr22.Processing.Page page;
           try { page = pr.Scanner.GetPage(0); }
           catch (Pr22.Exceptions.General) { return; }
           try { AnalyzeResult = pr.Engine.Analyze(page, OcrTask); }
           catch (Pr22.Exceptions.General ex)
           {
               MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
               return;
           }
           FillOcrDataGrid();
           FillDataPage();
       }

       void FillOcrDataGrid()
       {
           List<Pr22.Processing.FieldReference> Fields = AnalyzeResult.GetFields();
           for (int i = 0; i < Fields.Count; i++)
           {
               try
               {
                   Pr22.Processing.Field field = AnalyzeResult.GetField(Fields[i]);
                   string[] values = new string[4];
                   values[0] = i.ToString();
                   values[1] = Fields[i].ToString(" ") + new StrCon() + GetAmid(field);
                   try { values[2] = field.GetBestStringValue(); }
                   catch (Pr22.Exceptions.InvalidParameter)
                   {
                       values[2] = PrintBinary(field.GetBinaryValue(), 0, 16);
                   }
                   catch (Pr22.Exceptions.General) { }
                   values[3] = field.GetStatus().ToString();

                   FieldsDataGridView.Rows.Add(values);
               }
               catch (Pr22.Exceptions.General) { }
           }
       }

       void FieldsDataGridView_SelectionChanged(object sender, EventArgs e)
       {
           ClearOCRData();
           if (FieldsDataGridView.SelectedCells.Count == 0) return;
           int ix = FieldsDataGridView.SelectedCells[0].RowIndex;
           if (AnalyzeResult == null || ix < 0 || AnalyzeResult.GetFields().Count <= ix
               || ix == FieldsDataGridView.Rows.Count - 1) return;

           ix = int.Parse(FieldsDataGridView.Rows[ix].Cells[0].Value.ToString());
           Pr22.Processing.FieldReference SelectedField = AnalyzeResult.GetFields()[ix];
           Pr22.Processing.Field field = AnalyzeResult.GetField(SelectedField);
           try { RAWValueLabel.Text = field.GetRawStringValue(); }
           catch (Pr22.Exceptions.General) { }
           try { FormattedValueLabel.Text = field.GetFormattedStringValue(); }
           catch (Pr22.Exceptions.General) { }
           try { StandardizedValueLabel.Text = field.GetStandardizedStringValue(); }
           catch (Pr22.Exceptions.General) { }
           try { FieldImagePictureBox.Image = field.GetImage().ToBitmap(); }
           catch (Pr22.Exceptions.General) { }
       }

       void FillDataPage()
       {
           Name1.Text = GetFieldValue(FieldId.Surname);
           if (Name1.Text != "")
           {
               Name1.Text += " " + GetFieldValue(FieldId.Surname2);
               Name2.Text = GetFieldValue(FieldId.Givenname) + new StrCon()
                   + GetFieldValue(FieldId.MiddleName);
           }
           else Name1.Text = GetFieldValue(FieldId.Name);

           Birth.Text = new StrCon("on") + GetFieldValue(FieldId.BirthDate)
               + new StrCon("in") + GetFieldValue(FieldId.BirthPlace);

           Nationality.Text = GetFieldValue(FieldId.Nationality);

           Sex.Text = GetFieldValue(FieldId.Sex);

           Issuer.Text = GetFieldValue(FieldId.IssueCountry) + new StrCon()
               + GetFieldValue(FieldId.IssueState);

           Type.Text = GetFieldValue(FieldId.DocType) + new StrCon()
               + GetFieldValue(FieldId.DocTypeDisc);
           if (Type.Text == "") Type.Text = GetFieldValue(FieldId.Type);

           Page.Text = GetFieldValue(FieldId.DocPage);

           Number.Text = GetFieldValue(FieldId.DocumentNumber);

           Validity.Text = new StrCon("from") + GetFieldValue(FieldId.IssueDate)
               + new StrCon("to") + GetFieldValue(FieldId.ExpiryDate);

           try
           {
               PhotoPictureBox.Image = AnalyzeResult.GetField(FieldSource.Viz,
                   FieldId.Face).GetImage().ToBitmap();
           }
           catch (Pr22.Exceptions.General) { }

           try
           {
               SignaturePictureBox.Image = AnalyzeResult.GetField(FieldSource.Viz,
                   FieldId.Signature).GetImage().ToBitmap();
           }
           catch (Pr22.Exceptions.General) { }
       }

       #endregion

       #region General tools
       //----------------------------------------------------------------------

       string GetAmid(Field field)
       {
           try
           {
               return field.ToVariant().GetChild((int)Pr22.Util.VariantId.AMID, 0);
           }
           catch (Pr22.Exceptions.General) { return ""; }
       }

       string GetFieldValue(Pr22.Processing.FieldId Id)
       {
           FieldReference filter = new FieldReference(FieldSource.All, Id);
           List<FieldReference> Fields = AnalyzeResult.GetFields(filter);
           foreach (FieldReference FR in Fields)
           {
               try
               {
                   string value = AnalyzeResult.GetField(FR).GetBestStringValue();
                   if (value != "") return value;
               }
               catch (Pr22.Exceptions.EntryNotFound) { }
           }
           return "";
       }

Hello Michael and Chris,

With your great help I only have two problems:
- errors in the #close and #cursor variables
- Routines that give errors when converting using "C# to MicroFocus Converter"
I still can't understand why it gives an error, I've tried removing parts but it gives an error.
The parts that I cannot "convert" because it gives an error are those indicated below.


        void DocFrameFound(object sender, Pr22.Events.PageEventArgs e)
        {
            if (!DocViewCheckBox.Checked) return;
            foreach (Control tab in FieldsTabControl.Controls)
            {
                try
                {
                    Pr22.Imaging.Light light = (Pr22.Imaging.Light)Enum.Parse(typeof(Pr22.Imaging.Light), tab.Text);
                    if (((PictureBox)tab.Controls[0]).Image != null)
                        DrawImage(new Pr22.Events.ImageEventArgs(e.Page, light));
                }
                catch (System.ArgumentException) { }
            }
        }

        void DrawImage(Pr22.Events.ImageEventArgs e)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new Action<Pr22.Events.ImageEventArgs>(DrawImage), e);
                return;
            }
            Pr22.Imaging.DocImage docImage = pr.Scanner.GetPage(e.Page).Select(e.Light);
            Control[] tabs = FieldsTabControl.Controls.Find(e.Light.ToString(), false);
            //if (tabs.Length == 0) tabs = AddTabPage(e.Light.ToString());
            if (tabs.Length == 0) return;
            PictureBox pb = (PictureBox)tabs[0].Controls[0];
            Bitmap bmap = docImage.ToBitmap();
            if (DocViewCheckBox.Checked)
            {
                try { bmap = docImage.DocView().ToBitmap(); }
                catch (Pr22.Exceptions.General) { }
            }
            pb.SizeMode = PictureBoxSizeMode.Zoom;
            pb.Image = bmap;
            pb.Refresh();
        }

       void Analyze()
       {
           Pr22.Task.EngineTask OcrTask = new Pr22.Task.EngineTask();

           if (OCRParamsCheckedListBox.GetItemCheckState(0) == CheckState.Checked)
               OcrTask.Add(FieldSource.Mrz, FieldId.All);
           if (OCRParamsCheckedListBox.GetItemCheckState(1) == CheckState.Checked)
               OcrTask.Add(FieldSource.Viz, FieldId.All);
           if (OCRParamsCheckedListBox.GetItemCheckState(2) == CheckState.Checked)
               OcrTask.Add(FieldSource.Barcode, FieldId.All);

           Pr22.Processing.Page page;
           try { page = pr.Scanner.GetPage(0); }
           catch (Pr22.Exceptions.General) { return; }
           try { AnalyzeResult = pr.Engine.Analyze(page, OcrTask); }
           catch (Pr22.Exceptions.General ex)
           {
               MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
               return;
           }
           FillOcrDataGrid();
           FillDataPage();
       }

       void FillOcrDataGrid()
       {
           List<Pr22.Processing.FieldReference> Fields = AnalyzeResult.GetFields();
           for (int i = 0; i < Fields.Count; i++)
           {
               try
               {
                   Pr22.Processing.Field field = AnalyzeResult.GetField(Fields[i]);
                   string[] values = new string[4];
                   values[0] = i.ToString();
                   values[1] = Fields[i].ToString(" ") + new StrCon() + GetAmid(field);
                   try { values[2] = field.GetBestStringValue(); }
                   catch (Pr22.Exceptions.InvalidParameter)
                   {
                       values[2] = PrintBinary(field.GetBinaryValue(), 0, 16);
                   }
                   catch (Pr22.Exceptions.General) { }
                   values[3] = field.GetStatus().ToString();

                   FieldsDataGridView.Rows.Add(values);
               }
               catch (Pr22.Exceptions.General) { }
           }
       }

       void FieldsDataGridView_SelectionChanged(object sender, EventArgs e)
       {
           ClearOCRData();
           if (FieldsDataGridView.SelectedCells.Count == 0) return;
           int ix = FieldsDataGridView.SelectedCells[0].RowIndex;
           if (AnalyzeResult == null || ix < 0 || AnalyzeResult.GetFields().Count <= ix
               || ix == FieldsDataGridView.Rows.Count - 1) return;

           ix = int.Parse(FieldsDataGridView.Rows[ix].Cells[0].Value.ToString());
           Pr22.Processing.FieldReference SelectedField = AnalyzeResult.GetFields()[ix];
           Pr22.Processing.Field field = AnalyzeResult.GetField(SelectedField);
           try { RAWValueLabel.Text = field.GetRawStringValue(); }
           catch (Pr22.Exceptions.General) { }
           try { FormattedValueLabel.Text = field.GetFormattedStringValue(); }
           catch (Pr22.Exceptions.General) { }
           try { StandardizedValueLabel.Text = field.GetStandardizedStringValue(); }
           catch (Pr22.Exceptions.General) { }
           try { FieldImagePictureBox.Image = field.GetImage().ToBitmap(); }
           catch (Pr22.Exceptions.General) { }
       }

       void FillDataPage()
       {
           Name1.Text = GetFieldValue(FieldId.Surname);
           if (Name1.Text != "")
           {
               Name1.Text += " " + GetFieldValue(FieldId.Surname2);
               Name2.Text = GetFieldValue(FieldId.Givenname) + new StrCon()
                   + GetFieldValue(FieldId.MiddleName);
           }
           else Name1.Text = GetFieldValue(FieldId.Name);

           Birth.Text = new StrCon("on") + GetFieldValue(FieldId.BirthDate)
               + new StrCon("in") + GetFieldValue(FieldId.BirthPlace);

           Nationality.Text = GetFieldValue(FieldId.Nationality);

           Sex.Text = GetFieldValue(FieldId.Sex);

           Issuer.Text = GetFieldValue(FieldId.IssueCountry) + new StrCon()
               + GetFieldValue(FieldId.IssueState);

           Type.Text = GetFieldValue(FieldId.DocType) + new StrCon()
               + GetFieldValue(FieldId.DocTypeDisc);
           if (Type.Text == "") Type.Text = GetFieldValue(FieldId.Type);

           Page.Text = GetFieldValue(FieldId.DocPage);

           Number.Text = GetFieldValue(FieldId.DocumentNumber);

           Validity.Text = new StrCon("from") + GetFieldValue(FieldId.IssueDate)
               + new StrCon("to") + GetFieldValue(FieldId.ExpiryDate);

           try
           {
               PhotoPictureBox.Image = AnalyzeResult.GetField(FieldSource.Viz,
                   FieldId.Face).GetImage().ToBitmap();
           }
           catch (Pr22.Exceptions.General) { }

           try
           {
               SignaturePictureBox.Image = AnalyzeResult.GetField(FieldSource.Viz,
                   FieldId.Signature).GetImage().ToBitmap();
           }
           catch (Pr22.Exceptions.General) { }
       }

       #endregion

       #region General tools
       //----------------------------------------------------------------------

       string GetAmid(Field field)
       {
           try
           {
               return field.ToVariant().GetChild((int)Pr22.Util.VariantId.AMID, 0);
           }
           catch (Pr22.Exceptions.General) { return ""; }
       }

       string GetFieldValue(Pr22.Processing.FieldId Id)
       {
           FieldReference filter = new FieldReference(FieldSource.All, Id);
           List<FieldReference> Fields = AnalyzeResult.GetFields(filter);
           foreach (FieldReference FR in Fields)
           {
               try
               {
                   string value = AnalyzeResult.GetField(FR).GetBestStringValue();
                   if (value != "") return value;
               }
               catch (Pr22.Exceptions.EntryNotFound) { }
           }
           return "";
       }

Hello again,


While waiting for MicroFocus to release my post, I was doing more tests and noticed that the errors in the conversion have to do with the "catch" line.

I tried adding the "ex" variable and there was no error (I don't know if it's the same thing).

What I did was in "catch (Pr22.Exceptions.EntryNotFound) { }" which gave an error, I put "catch (Pr22.Exceptions.EntryNotFound ex) { }" and it stopped giving an error.

Therefore, I will have the conversion done with only 9 errors.


I send a new version of the conversion to ask for one last bit of help (I hope) with this process.
The link to download is:

we.tl/t-30mEHsjJtz

Hello again,


While waiting for MicroFocus to release my post, I was doing more tests and noticed that the errors in the conversion have to do with the "catch" line.

I tried adding the "ex" variable and there was no error (I don't know if it's the same thing).

What I did was in "catch (Pr22.Exceptions.EntryNotFound) { }" which gave an error, I put "catch (Pr22.Exceptions.EntryNotFound ex) { }" and it stopped giving an error.

Therefore, I will have the conversion done with only 9 errors.


I send a new version of the conversion to ask for one last bit of help (I hope) with this process.
The link to download is:

we.tl/t-30mEHsjJtz

You're getting an error on #tab, because you are trying to use it out of scope. It is declared in the perform varying and is only in scope (i.e. available) in that perform varying code block.

Try this:

declare #tab as type Control *> this level of scope allows it to be used anywhere in the method
perform varying #tab thru FieldsTabControl::Controls
end-perform
try
    declare light as type Pr22.Imaging.Light = type Enum::Parse(type of Pr22.Imaging.Light, #tab::Text) as type Pr22.Imaging.Light
    if (#tab::Controls[0] as type PictureBox)::Image <> null
        invoke DrawImage(new Pr22.Events.ImageEventArgs(e::Page, light))
    end-if
catch
    ex as type System.ArgumentException
end-try

Yes, if you want to use a non-default Exception type, you will need to declare it on the Catch clause.

If you don't declare anything, by default we create a standard System.Exception exception object for you (called exception-object)

e.g.

try

   some error code

catch

   display exception-object::Message

end-try


You're getting an error on #tab, because you are trying to use it out of scope. It is declared in the perform varying and is only in scope (i.e. available) in that perform varying code block.

Try this:

declare #tab as type Control *> this level of scope allows it to be used anywhere in the method
perform varying #tab thru FieldsTabControl::Controls
end-perform
try
    declare light as type Pr22.Imaging.Light = type Enum::Parse(type of Pr22.Imaging.Light, #tab::Text) as type Pr22.Imaging.Light
    if (#tab::Controls[0] as type PictureBox)::Image <> null
        invoke DrawImage(new Pr22.Events.ImageEventArgs(e::Page, light))
    end-if
catch
    ex as type System.ArgumentException
end-try

Yes, if you want to use a non-default Exception type, you will need to declare it on the Catch clause.

If you don't declare anything, by default we create a standard System.Exception exception object for you (called exception-object)

e.g.

try

   some error code

catch

   display exception-object::Message

end-try

I believe on the #tab issue that Michael points out you may really just want to move the end-perform to after the end-try.

The only other error I am seeing is on the line:

set ix to binary-long::Parse(FieldsDataGridView::Rows[ix]::Cells[0] . Value::ToString())

which should be 

set ix to binary-long::Parse(FieldsDataGridView::Rows[ix]::Cells[0]::Value::ToString())


I believe on the #tab issue that Michael points out you may really just want to move the end-perform to after the end-try.

The only other error I am seeing is on the line:

set ix to binary-long::Parse(FieldsDataGridView::Rows[ix]::Cells[0] . Value::ToString())

which should be 

set ix to binary-long::Parse(FieldsDataGridView::Rows[ix]::Cells[0]::Value::ToString())

Chris and Michael, thank you very much for your excellent help and collaboration.

The application is already working, now it just needs a few small corrections as
there are details that are not yet correct.

Best regards