// initialization
        private void OnLoad(object sender, EventArgs e)
        {
            // program title
            Text = "Pdf417DecoderDemo - " + Pdf417Decoder.VersionNumber + " \u00a9 2019 Uzi Granot. All rights reserved.";

                #if DEBUG
            // current directory
            string CurDir  = Environment.CurrentDirectory;
            string WorkDir = CurDir.Replace("bin\\Debug", "Work");
            if (WorkDir != CurDir && Directory.Exists(WorkDir))
            {
                Environment.CurrentDirectory = WorkDir;
            }

            // open trace file
            Pdf417Trace.Open("Pdf417DecoderTrace.txt");
            Pdf417Trace.Write("Pdf417DecoderDemo");
                #endif

            // create decoder
            Pdf417Decoder = new Pdf417Decoder();

            // resize window
            OnResize(sender, e);
            return;
        }
        /// <summary>
        /// Program initialization
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event arguments</param>
        private void OnLoad(object sender, EventArgs e)
        {
            // program title
            Text = "Pdf417VideoDecoder - " + Pdf417Decoder.VersionNumber + " \u00a9 2019 Uzi Granot. All rights reserved.";

                #if DEBUG
            // current directory
            string CurDir  = Environment.CurrentDirectory;
            string WorkDir = CurDir.Replace("bin\\Debug", "Work");
            if (WorkDir != CurDir && Directory.Exists(WorkDir))
            {
                Environment.CurrentDirectory = WorkDir;
            }

            // open trace file
            Pdf417Trace.Open("Pdf417VideoDecoderTrace.txt");
            Pdf417Trace.Write(Text);
                #endif

            // disable reset button
            ResetButton.Enabled   = false;
            GoToUriButton.Enabled = false;

            // get an array of web camera devices
            DsDevice[] CameraDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);

            // make sure at least one is available
            if (CameraDevices == null || CameraDevices.Length == 0)
            {
                MessageBox.Show("No video cameras in this computer");
                Close();
                return;
            }

            // select the first camera
            DsDevice CameraDevice = CameraDevices[0];

            // Device moniker
            IMoniker CameraMoniker = CameraDevice.Moniker;

            // get a list of frame sizes available
            FrameSize[] FrameSizes = Camera.GetFrameSizeList(CameraMoniker);

            // make sure there is at least one frame size
            if (FrameSizes == null || FrameSizes.Length == 0)
            {
                MessageBox.Show("No video cameras in this computer");
                Close();
                return;
            }

            // test if our frame size is available
            int Index;
            for (Index = 0; Index < FrameSizes.Length &&
                 (FrameSizes[Index].Width != FrameSize.Width || FrameSizes[Index].Height != FrameSize.Height); Index++)
            {
                ;
            }

            // select first frame size
            if (Index == FrameSizes.Length)
            {
                FrameSize = FrameSizes[0];
            }

            // Set selected camera to camera control with default frame size
            // Create camera object
            VideoCamera = new Camera(PreviewPanel, CameraMoniker, FrameSize);

            // create QR code decoder
            Decoder = new Pdf417Decoder();

            // resize window
            OnResize(sender, e);

            // create timer
            VideoDecoderTimer          = new Timer();
            VideoDecoderTimer.Interval = 200;
            VideoDecoderTimer.Tick    += VideoDecoderTimer_Tick;
            VideoDecoderTimer.Enabled  = true;
            return;
        }