/// <summary> /// Initializes a new instance of the <see cref="Barcoder"/> class. /// </summary> public Barcoder() { // build the maps first since they get used by the UI // so make sure that they're constructed before the UI // gets built. _mySymbologyMap = new[] { new SymbologyMap("Aztec", Symbologies.Aztec), new SymbologyMap("Australia Post", Symbologies.AustraliaPost), new SymbologyMap("Codabar", Symbologies.Codabar), new SymbologyMap("Code 11", Symbologies.Code11), new SymbologyMap("Code 128", Symbologies.Code128), new SymbologyMap("Code 32", Symbologies.Code32), new SymbologyMap("Code 39", Symbologies.Code39), new SymbologyMap("Code 93", Symbologies.Code93), new SymbologyMap("Data Matrix", Symbologies.Datamatrix), new SymbologyMap("Ean 13", Symbologies.Ean13), new SymbologyMap("Ean 8", Symbologies.Ean8), new SymbologyMap("I 2 of 5", Symbologies.I2of5), new SymbologyMap("Intelligent Mail", Symbologies.IntelligentMail), new SymbologyMap("ITF-14", Symbologies.Itf14), new SymbologyMap("Micro QR Code", Symbologies.MicroQr), new SymbologyMap("Patch", Symbologies.Patch), new SymbologyMap("PDF 417", Symbologies.Pdf417), new SymbologyMap("Planet", Symbologies.Planet), new SymbologyMap("Plus 2", Symbologies.Plus2), new SymbologyMap("Plus 5", Symbologies.Plus5), new SymbologyMap("Postnet", Symbologies.Postnet), new SymbologyMap("QR", Symbologies.Qr), new SymbologyMap("Royal Mail +4 State Customer Code", Symbologies.Rm4scc), new SymbologyMap("RSS-14", Symbologies.Rss14), new SymbologyMap("RSS Limited", Symbologies.RssLimited), new SymbologyMap("Telepen", Symbologies.Telepen), new SymbologyMap("UPC A", Symbologies.Upca), new SymbologyMap("UPC E", Symbologies.Upce), }; _directionMap = new[] { new ScanDirectionMap("Left to Right", Directions.East), new ScanDirectionMap("Right to Left", Directions.West), new ScanDirectionMap("Top to Bottom", Directions.South), new ScanDirectionMap("Bottom to Top", Directions.North), new ScanDirectionMap("Bottom Left to Top Right", Directions.NorthEast), new ScanDirectionMap("Top Left to Bottom Right", Directions.SouthEast), new ScanDirectionMap("Top Right to Bottom Left", Directions.SouthWest), new ScanDirectionMap("Bottom Right to Top Left", Directions.NorthWest), }; // Ensure we'll open the image with one of our licensed decoders WinDemoHelperMethods.PopulateDecoders(RegisteredDecoders.Decoders); // Sets the default Pixel Format Changer to use Thresholding. // This may cause problems for people with PhotoFree or PhotoPro licenses. AtalaImage.PixelFormatChanger = new DocumentPixelFormatChanger(new AtalaPixelFormatChanger()); InitializeComponent(); }
// Respond to a file open private void OpenButton_Click(object sender, EventArgs e) { // try to locate images folder var imagesFolder = Application.ExecutablePath; // we assume we are running under the DotImage install folder var pos = imagesFolder.IndexOf("DotImage ", StringComparison.Ordinal); if (pos != -1) { imagesFolder = imagesFolder.Substring(0, imagesFolder.IndexOf(@"\", pos, StringComparison.Ordinal)) + @"\Images\Barcodes"; } // use this folder as starting point _openFileDialog.InitialDirectory = imagesFolder; // Filter on the available, licensed decoders _openFileDialog.Filter = WinDemoHelperMethods.CreateDialogFilter(true); if (_openFileDialog.ShowDialog(this) != DialogResult.OK) { return; } try { _tmpImg = new AtalaImage(_openFileDialog.FileName); // Loads the image into the viewer - applying the desired morphology if needed UpdateMorphology(); //// workspaceViewer.Open(openFileDialog1.FileName); } catch { MessageBox.Show(Resources.Barcoder_OpenButton_UnableToLoad + _openFileDialog.FileName + @"."); _imageLoaded = false; return; } _imageLoaded = true; // check if its OK start a recognize at this point ValidateRecognize(0, 0); _finalResults = null; }