internal static ConnectionResult OsDbConnectionRetry(OSoperations osDbOperations,
            ConnectionResult connectionResult)
        {
            MainImportingEngine.ThisProgress.Progress
                (MainImportingEngine.CurrentProgress,
                 "OSdb did not respond. Retrying... ");

            Thread.Sleep(2000);

            try
            {
                connectionResult.OsDbLoginResult =
                    osDbOperations.SiteLogin();

                MainImportingEngine.ThisProgress.Progress
                    (MainImportingEngine.CurrentProgress,
                     "login status: " +
                     connectionResult.OsDbLoginResult.Status);

                Thread.Sleep(3000);

                connectionResult.OsDbIsOnline = true;

            }
            catch (Exception)
            {
                connectionResult =
                    DisableOsDbConnection(connectionResult);
            }

            return connectionResult;
        }
        internal static ConnectionResult ConnectToOsDb(ConnectionResult connectionResult)
        {
            if (!connectionResult.InternetConnectionAvailable
                &&
                Settings.ConnectionDiagnosticsEnabled)
            {
                connectionResult.OsDbIsOnline = false;
                return connectionResult;
            }

            OSoperations osDbOperations = new OSoperations();

            connectionResult =
                TryConnection(osDbOperations, connectionResult);

            return connectionResult;
        }
        internal static ConnectionResult OsDbConnectionFirstTry(OSoperations osDbOperations,
            ConnectionResult connectionResult)
        {
            connectionResult.OsDbLoginResult =
                osDbOperations.SiteLogin();

            MainImportingEngine.ThisProgress.Progress
                (MainImportingEngine.CurrentProgress,
                 "login status: " +
                 connectionResult.OsDbLoginResult.Status);

            Thread.Sleep(3000);

            connectionResult.OsDbIsOnline = true;

            return connectionResult;
        }
        private static ConnectionResult TryConnection(OSoperations osDbOperations,
            ConnectionResult connectionResult)
        {
            Helpers.UpdateProgress("Performing Diagnostic Operations... ",
                                   "Connecting to OSDb...", null);

            try
            {
                connectionResult =
                    OsDbConnectionFirstTry
                        (osDbOperations, connectionResult);
            }
            catch (Exception)
            {
                connectionResult =
                    OsDbConnectionRetry
                        (osDbOperations, connectionResult);
            }

            return connectionResult;
        }