Beispiel #1
0
        public static bool TryFetchAvailableOCRLanguagesFromPassportPDF(out string[] availableLanguages, IWin32Window owner = null)
        {
            using (frmFetchingInfoFromServer fetchWindow = new frmFetchingInfoFromServer())
            {
                fetchWindow._passportPdfRequestWorker.RunWorkerAsync(BackgroundOperationType.FetchOCRSupportedLanguages);
                fetchWindow.SetFormFetchingMessageAndShowUntilWorkCompletion(owner, FrameworkGlobals.MessagesLocalizer.GetString("message_fetching_ocr_languages", FrameworkGlobals.ApplicationLanguage));

                if (fetchWindow._apiCallException != null)
                {
                    // An exception occured when calling the API
                    DialogUtilities.ShowErrorMessage(LogMessagesUtils.ReplaceMessageSequencesAndReferences(FrameworkGlobals.MessagesLocalizer.GetString("message_fetching_ocr_languages_failure", FrameworkGlobals.ApplicationLanguage),
                                                                                                           additionalMessage: fetchWindow._apiCallException.Message), FrameworkGlobals.MessagesLocalizer.GetString("caption_error", FrameworkGlobals.ApplicationLanguage));
                    availableLanguages = null;
                    return(false);
                }
                else
                {
                    if (fetchWindow._getAvailableOCRLanguagesResponse.Error == null)
                    {
                        availableLanguages = fetchWindow._getAvailableOCRLanguagesResponse.Value.ToArray();
                        return(true);
                    }
                    else
                    {
                        DialogUtilities.ShowErrorMessage(LogMessagesUtils.ReplaceMessageSequencesAndReferences(FrameworkGlobals.MessagesLocalizer.GetString("message_fetching_ocr_languages_failure", FrameworkGlobals.ApplicationLanguage),
                                                                                                               additionalMessage: PassportPDFErrorUtilities.GetMessageFromResultCode(fetchWindow._getAvailableOCRLanguagesResponse.Error.ResultCode)), FrameworkGlobals.MessagesLocalizer.GetString("caption_error", FrameworkGlobals.ApplicationLanguage));
                        availableLanguages = null;
                        return(false);
                    }
                }
            }
        }
Beispiel #2
0
        public static bool?IsCurrentApplicationVersionSupported(string appId, Version currentVersion, IWin32Window owner = null)
        {
            using (frmFetchingInfoFromServer fetchWindow = new frmFetchingInfoFromServer())
            {
                fetchWindow._appId      = appId;
                fetchWindow._appVersion = currentVersion;
                fetchWindow._passportPdfRequestWorker.RunWorkerAsync(BackgroundOperationType.CheckCurrentAppVersionIsSupported);
                fetchWindow.SetFormFetchingMessageAndShowUntilWorkCompletion(owner, FrameworkGlobals.MessagesLocalizer.GetString("message_fetching_app_minimum_version", FrameworkGlobals.ApplicationLanguage));

                return(fetchWindow._currentAppVersionIsSupported);
            }
        }
Beispiel #3
0
        public static bool?IsNewVersionAvailable(string appId, Version currentVersion, out string latestVersionNumber, IWin32Window owner = null)
        {
            using (frmFetchingInfoFromServer fetchWindow = new frmFetchingInfoFromServer())
            {
                fetchWindow._appId      = appId;
                fetchWindow._appVersion = currentVersion;
                fetchWindow._passportPdfRequestWorker.RunWorkerAsync(BackgroundOperationType.CheckNewVersionAvailable);
                fetchWindow.SetFormFetchingMessageAndShowUntilWorkCompletion(owner, FrameworkGlobals.MessagesLocalizer.GetString("message_fetching_app_latest_version", FrameworkGlobals.ApplicationLanguage));
                latestVersionNumber = fetchWindow._latestVersionNumber;

                return(fetchWindow._newVersionAvailable);
            }
        }
Beispiel #4
0
        public static bool FetchConfigurationFromPassportPDF(string appId, IWin32Window owner = null)
        {
            using (frmFetchingInfoFromServer fetchWindow = new frmFetchingInfoFromServer())
            {
                fetchWindow._appId = appId;
                fetchWindow._passportPdfRequestWorker.RunWorkerAsync(BackgroundOperationType.FetchConfiguration);
                fetchWindow.SetFormFetchingMessageAndShowUntilWorkCompletion(owner, FrameworkGlobals.MessagesLocalizer.GetString("message_fetching_configuration", FrameworkGlobals.ApplicationLanguage));

                if (fetchWindow._apiCallException != null)
                {
                    // An exception occured when calling the API
                    DialogUtilities.ShowErrorMessage(LogMessagesUtils.ReplaceMessageSequencesAndReferences(FrameworkGlobals.MessagesLocalizer.GetString("message_configuration_fetching_failure", FrameworkGlobals.ApplicationLanguage),
                                                                                                           additionalMessage: fetchWindow._apiCallException.Message), FrameworkGlobals.MessagesLocalizer.GetString("caption_error", FrameworkGlobals.ApplicationLanguage));
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }