static Messager()
 {
     if (BarcodeGlobalization.GetCurrentThreadLanguage() == GlobalizationLanguage.Japanese)
     {
         _fileOpenErrorMessage = "Error opening file:";
         _fileSaveErrorMessage = "Error saving file:";
     }
     else
     {
         _fileOpenErrorMessage = "Error opening file:";
         _fileSaveErrorMessage = "Error saving file:";
     }
 }
Beispiel #2
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);
        }
Beispiel #3
0
        private void _helpButton_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(BarcodeGlobalization.GetResxString(GetType(), "Resx_Help1stLine"));
            sb.AppendLine();
            sb.AppendLine(BarcodeGlobalization.GetResxString(GetType(), "Resx_Help2ndLine"));
            sb.AppendLine();
            sb.AppendLine(BarcodeGlobalization.GetResxString(GetType(), "Resx_Help3rdLine"));
            sb.AppendLine(BarcodeGlobalization.GetResxString(GetType(), "Resx_Help4thLine"));
            sb.AppendLine();
            sb.AppendLine(BarcodeGlobalization.GetResxString(GetType(), "Resx_Help5thLine"));

            MessageBox.Show(this, sb.ToString(), BarcodeGlobalization.GetResxString(GetType(), "Resx_HelpMsg"), MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Beispiel #4
0
        private void ShowError(Exception ex)
        {
            RasterException re = ex as RasterException;

            if (re != null)
            {
                Messager.ShowError(this, string.Format(BarcodeGlobalization.GetResxString(GetType(), "Resx_LEADError"), re.Code, ex.Message));
            }
            else
            {
                TwainException tw = ex as TwainException;
                if (tw != null)
                {
                    Messager.ShowError(this, string.Format(BarcodeGlobalization.GetResxString(GetType(), "Resx_TwainError"), tw.Code, ex.Message));
                }
                else
                {
                    Messager.ShowError(this, ex);
                }
            }
        }