public void InitializeSynchronizers(bool initRecovery = false) { SQLiteRepositoryDAO repoDAO = new SQLiteRepositoryDAO(); LocalRepository repo = repoDAO.FindOrCreateByRootName(RuntimeSettings.HomePath); if (initRecovery || repo.Recovering) { initRecovery = true; repo.Recovering = true; repoDAO.Update(repo); } Thread.Sleep(5000); Thread startSync; startSync = new Thread(delegate() { try { Logger.LogInfo("INFO", "Initializing Synchronizers!"); synchronizerResolver = SynchronizerResolver.GetInstance(); recoverySynchronizer = RecoverySynchronizer.GetInstance(); remoteSynchronizer = RemoteEventsSynchronizer.GetInstance(); localSynchronizer = LocalEventsSynchronizer.GetInstance(); if (initRecovery) { recoverySynchronizer.Start(); while (!((RecoverySynchronizer)recoverySynchronizer).StartedSync) Thread.Sleep(1000); synchronizerResolver.Start(); while (!recoverySynchronizer.FinishedSync) { Thread.Sleep(1000); } } else { synchronizerResolver.Start(); } localSynchronizer.Start(); remoteSynchronizer.Start(); loadedSynchronizers = true; Logger.LogInfo("INFO", "Synchronizers Ready!"); if (initRecovery || repo.Recovering) { repo.Recovering = false; repoDAO.Update(repo); } ErrorType = ERROR_TYPE.NULL; OnIdle(); } catch (Exception e) { Console.WriteLine(e.Message); } }); startSync.Start(); }