public void Shutdown() { if (IsPeriodicSyncStarted) { SyncStartService.Stop(OnTimerElapsed); } }
private async Task StartPeriodicSync() { if (IsPeriodicSyncStarted) { SyncStartService.Stop(OnTimerElapsed); IsPeriodicSyncStarted = false; UpdateStatus($"Periodic Sync Stopped : {DateTime.Now}"); UpdateStatus(StatusHelper.GetMessage(SyncStateEnum.LogSeparator)); } else { var result = await SyncStartService.Start(OnTimerElapsed); if (result) { foreach (var syncProfile in ScheduledSyncProfiles) { if (syncProfile.IsSyncEnabled && syncProfile.SyncFrequency != null) { syncProfile.NextSync = syncProfile.SyncFrequency.GetNextSyncTime(DateTime.Now); } } IsPeriodicSyncStarted = true; UpdateStatus($"Periodic Sync Started : {DateTime.Now}"); UpdateStatus(StatusHelper.GetMessage(SyncStateEnum.LogSeparator)); } } }