Exemple #1
0
        private bool Init()
        {
            // Check support required to use this program
            if (RasterSupport.IsLocked(RasterSupportType.Barcodes1D) && RasterSupport.IsLocked(RasterSupportType.Barcodes2D))
            {
                Messager.ShowError(this, BarcodeGlobalization.GetResxString(GetType(), "Resx_LEADBarcodeSupport"));
                return(false);
            }

            try
            {
                _rasterCodecs = new RasterCodecs();
            }
            catch (Exception ex)
            {
                Messager.ShowError(this, string.Format("RasterCodec initialize error: {0}", ex.Message));
                return(false);
            }

            // this is very important, must be placed leadtools.engine.dll in this path
            _rasterCodecs.Options.Pdf.InitialPath = AppDomain.CurrentDomain.BaseDirectory;

            _barcodeOptions = BarcodeOptions.Load();

            //BarcodeSymbology[] supportedSymbologies = BarcodeEngine.GetSupportedSymbologies();
            WriteLine(string.Format("{0} Supported symbologies:", _barcodeOptions.ReadOptionsSymbologies.Length), TraceEventType.Information);
            foreach (BarcodeSymbology symbology in _barcodeOptions.ReadOptionsSymbologies)
            {
                WriteLine(string.Format("{0}: {1}", symbology, BarcodeEngine.GetSymbologyFriendlyName(symbology)), TraceEventType.Information);
            }
            WriteLine(string.Format("----------"), TraceEventType.Information);

            _sampleSymbologiesRasterImage = null;

            // Create the barcodes symbologies multi-frame RasterImage
            using (Stream stream = GetType().Assembly.GetManifestResourceStream("BarcodeSplitManage.Resources.Symbologies.tif"))
            {
                _rasterCodecs.Options.Load.AllPages = true;
                _sampleSymbologiesRasterImage       = _rasterCodecs.Load(stream);
            }

            _barcodeEngine = new BarcodeEngine();
            _barcodeEngine.Reader.ImageType = BarcodeImageType.Unknown;
            _barcodeEngine.Reader.EnableReturnFourPoints = false;
            // Continue on errors
            _barcodeEngine.Reader.ErrorMode = BarcodeReaderErrorMode.IgnoreAll;

            _directorySettings = new DirectorySettings();

            return(true);
        }
Exemple #2
0
        public ReadBarcodeOptionsDialogBox(BarcodeEngine barcodeEngine, RasterImage sampleSymbologiesRasterImage, BarcodeOptions barcodeOptions)
        {
            InitializeComponent();

            _availableSymbologyListBox.SampleSymbologiesRasterImage = sampleSymbologiesRasterImage;
            _toReadSymbologyListBox.SampleSymbologiesRasterImage    = sampleSymbologiesRasterImage;

            _barcodeEngine = barcodeEngine;

            _selectedGroupIndex  = barcodeOptions.ReadOptionsGroupIndex;
            _selectedSymbologies = barcodeOptions.ReadOptionsSymbologies;
            _imageResolution     = barcodeOptions.ImageResolution;
        }