private void VideoDecoderTimer_Tick(object sender, EventArgs e)
        {
            VideoDecoderTimer.Enabled = false;
            Bitmap Pdf417Image;

            try
            {
                Pdf417Image = VideoCamera.SnapshotSourceImage();

                // trace
                        #if DEBUG
                Pdf417Trace.Format("Image width: {0}, Height: {1}", Pdf417Image.Width, Pdf417Image.Height);
                        #endif
            }

            catch (Exception EX)
            {
                DataTextBox.Text          = "Decode exception.\r\n" + EX.Message;
                VideoDecoderTimer.Enabled = true;
                return;
            }

            // decode image to byte array (Pdf417Decoder.BarcodeBinaryData)
            string BarcodeText = null;

            // decode barcodes
            int BarcodesCount = Decoder.Decode(Pdf417Image);

            // dispose bitmap
            Pdf417Image.Dispose();

            // we have no Pdf417 barcode
            if (BarcodesCount == 0)
            {
                VideoDecoderTimer.Enabled = true;
                return;
            }

            // decoding was successful
            // convert binary data to text string
            BarcodeText = Decoder.BinaryDataToString(0);

            // we have no Pdf417 barcode
            if (BarcodeText == null || BarcodeText.Length == 0)
            {
                VideoDecoderTimer.Enabled = true;
                return;
            }

            VideoCamera.PauseGraph();

            DataTextBox.Text    = BarcodeText;
            ResetButton.Enabled = true;
            if (IsValidUri(DataTextBox.Text))
            {
                GoToUriButton.Enabled = true;
            }
            return;
        }
        // user pressed load image button
        private void OnLoadImage(object sender, EventArgs e)
        {
            // get file name to decode
            OpenFileDialog Dialog = new OpenFileDialog
            {
                Filter           = "Image Files(*.png;*.jpg;*.gif;*.tif)|*.png;*.jpg;*.gif;*.tif;*.bmp)|All files (*.*)|*.*",
                Title            = "Load PDF417 Barcode Image",
                InitialDirectory = Directory.GetCurrentDirectory(),
                RestoreDirectory = true,
                FileName         = string.Empty
            };

            // display dialog box
            if (Dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            // display file name
            int Ptr  = Dialog.FileName.LastIndexOf('\\');
            int Ptr1 = Dialog.FileName.LastIndexOf('\\', Ptr - 1);

            ImageFileLabel.Text = Dialog.FileName.Substring(Ptr1 + 1);

            // disable buttons
            LoadImageButton.Enabled = false;

            // dispose previous image
            if (Pdf417InputImage != null)
            {
                Pdf417InputImage.Dispose();
            }

            // load image to bitmap
            Pdf417InputImage = new Bitmap(Dialog.FileName);

            // trace
                #if DEBUG
            Pdf417Trace.Format("****");
            Pdf417Trace.Format("Decode image: {0} ", Dialog.FileName);
            Pdf417Trace.Format("Image width: {0}, Height: {1}", Pdf417InputImage.Width, Pdf417InputImage.Height);
                #endif

            // decode barcodes
            int BarcodesCount = Pdf417Decoder.Decode(Pdf417InputImage);

            // no barcodes were found
            if (BarcodesCount == 0)
            {
                        #if DEBUG
                Pdf417Trace.Format("Image has no barcodes: {0}", Dialog.FileName);
                        #endif

                // clear barcode data text box
                DataTextBox.Text = null;
                MessageBox.Show(string.Format("Image has no barcodes: {0}", Dialog.FileName));
            }

            // one barcodes was found
            else if (BarcodesCount == 1)
            {
                // decoding was successful
                // convert binary data to text string
                DataTextBox.Text = Pdf417Decoder.BinaryDataToString(0);
            }

            // more than one barcode
            else
            {
                StringBuilder Str = new StringBuilder();

                for (int Count = 0; Count < BarcodesCount; Count++)
                {
                    Str.AppendFormat("Barcode No. {0}\r\n{1}\r\n", Count + 1, Pdf417Decoder.BinaryDataToString(Count));
                }
                DataTextBox.Text = Str.ToString();
            }

            // enable buttons
            LoadImageButton.Enabled = true;

            // force repaint
            Invalidate();
            return;
        }