protected override void HandleApplicationClosing() { base.HandleApplicationClosing(); if (!_appInfo.AutoRun && (!ConfigurationManager.SaveConfiguration(PdfOCRGlobals.GetApplicationConfigurationFilePath(), FrameworkGlobals.ApplicationConfiguration) || !ConfigurationManager.SaveConfiguration(PdfOCRGlobals.GetOCRActionConfigurationFilePath(), PdfOCRGlobals.OCRActionConfiguration))) { MessageBox.Show(FrameworkGlobals.MessagesLocalizer.GetString("saveConfigurationFailure", FrameworkGlobals.ApplicationConfiguration.Language), FrameworkGlobals.MessagesLocalizer.GetString("saveConfigurationFailureTitle", FrameworkGlobals.ApplicationConfiguration.Language), MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected override bool InitializeAppConfiguration() { if (!base.InitializeAppConfiguration()) { return(false); } if (!frmFetchingInfoFromServer.TryFetchAvailableOCRLanguagesFromPassportPDF(out PdfOCRGlobals.AvailableOCRLanguages, _view.WindowInstance)) { return(false); } if (!_appInfo.AutoRun) { try { PdfOCRGlobals.OCRActionConfiguration = (PDFOCRActionConfiguration)ConfigurationManager.InitializeConfigurationInstanceEx(PdfOCRGlobals.GetOCRActionConfigurationFilePath(), typeof(PDFOCRActionConfiguration)); } catch (Exception) { MessageBox.Show(FrameworkGlobals.MessagesLocalizer.GetString("readOCRConfigurationFailure", FrameworkGlobals.ApplicationConfiguration.Language), FrameworkGlobals.MessagesLocalizer.GetString("readConfigurationFailureTitle", FrameworkGlobals.ApplicationConfiguration.Language), MessageBoxButtons.OK, MessageBoxIcon.Error); PdfOCRGlobals.OCRActionConfiguration = ConfigurationManager.ResetDefaultPDFOCRActionConfiguration(); } } else { PdfOCRGlobals.OCRActionConfiguration = ConfigurationManager.ResetDefaultPDFOCRActionConfiguration(); CommandLineParsingUtilities.ParseCommandLineArgs(_appInfo.CommandLineArguments, FrameworkGlobals.ApplicationConfiguration, ocrActionConfiguration: PdfOCRGlobals.OCRActionConfiguration); if (FrameworkGlobals.ApplicationConfiguration.MinimizedWindow) { _view.Minimize(); } } return(true); }
public PDFOCRController(bool autoRun, string[] args) : base( new PassportPDFDesktopAppInformation( PdfOCRGlobals.PRODUCT_NAME, PdfOCRGlobals.PASSPORT_PDF_APP_ID, PdfOCRGlobals.SOURCE_CODE_LINK, AssemblyUtilities.GetVersion(), Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location), Properties.Resources.logo_pdfocrcloud, PdfOCRGlobals.INPUT_FILE_TYPE, PdfOCRGlobals.GetApplicationConfigurationFilePath(), autoRun, args)) { }