Пример #1
0
        private void ShowError(Exception ex)
        {
            // Shows an error, check if the exception is an OCR, raster or general one
            OcrException ocr = ex as OcrException;

            if (ocr != null)
            {
                Messager.ShowError(this, string.Format(DemosGlobalization.GetResxString(GetType(), "Resx_OCRError"), ocr.Code, ocr.Message));
                return;
            }

#if LEADTOOLS_V175_OR_LATER
            OcrComponentMissingException ocrComponent = ex as OcrComponentMissingException;
            if (ocrComponent != null)
            {
                Messager.ShowError(this, string.Format("OCR Component Missing\n\n{0}\n\nUse 'Engine/Componets' from the menu to show the available components and instructions of how to install the additional components of this OCR engine.", ocrComponent.Message));
                return;
            }
#endif // #if LEADTOOLS_V175_OR_LATER

            RasterException raster = ex as RasterException;
            if (raster != null)
            {
                Messager.ShowError(this, string.Format(DemosGlobalization.GetResxString(GetType(), "Resx_LEADError"), raster.Code, raster.Message));
                return;
            }

            Messager.ShowError(this, ex);
        }
Пример #2
0
 public void ShowError(Exception ex, IWin32Window owner, OcrEngineType engineType)
 {
     if (ex is OcrException)
     {
         OcrException oe = ex as OcrException;
         Messager.ShowError(owner, string.Format("LEADTOOLS Error\nCode: {0}\nMessage:{1}", oe.Code, ex.Message));
     }
     else if (ex is RasterException)
     {
         RasterException re = ex as RasterException;
         Messager.ShowError(owner, string.Format("OCR Error\nCode: {0}\nMessage:{1}", re.Code, ex.Message));
     }
     else
     {
         Messager.ShowError(owner, ex);
     }
 }
Пример #3
0
 private void ShowError(Exception ex)
 {
     if (ex is OcrException)
     {
         OcrException oe = ex as OcrException;
         Messager.ShowError(this, string.Format("LEADTOOLS Error\nCode: {0}\nMessage:{1}", oe.Code, ex.Message));
         _canceled = true;
     }
     else if (ex is RasterException)
     {
         RasterException re = ex as RasterException;
         Messager.ShowError(this, string.Format("OCR Error\nCode: {0}\nMessage:{1}", re.Code, ex.Message));
         _canceled = true;
     }
     else
     {
         Messager.ShowError(this, ex);
         _canceled = true;
     }
 }
Пример #4
0
 private void DoShowError(Exception ex)
 {
     BeginInvoke(new MethodInvoker(delegate()
     {
         // Shows an error, check if the exception is an OCR, raster or general one
         OcrException oe = ex as OcrException;
         if (oe != null)
         {
             Messager.ShowError(this, string.Format("LEADTOOLS Error\n\nCode: {0}\n\n{1}", oe.Code, ex.Message));
         }
         else
         {
             RasterException re = ex as RasterException;
             if (re != null)
             {
                 Messager.ShowError(this, string.Format("OCR Error\n\nCode: {0}\n\n{1}", re.Code, ex.Message));
             }
             else
             {
                 Messager.ShowError(this, ex);
             }
         }
     }));
 }