public void enablePeriodSync() { this.syncTimer.Stop(); this.syncTimer.Enabled = false; if (ParameterService.isPeriodSyncEnabled()) { this.syncTimer.Interval = ParameterService.getPeriodSyncInterval(); this.syncTimer.Enabled = true; this.lastSyncTick = DateTime.Now; this.syncTimer.Start(); } else { this.timeToSyncLabel.Text = "Sincronización desactivada"; } }
private void setTimeToSyncLabel() { int syncTimerSeconds = (int) this.getSyncTimeSpam().TotalSeconds; int timeToSync = ParameterService.getPeriodSyncInterval() / 1000 - syncTimerSeconds; if (ParameterService.isPeriodSyncEnabled()) { //this.timeToSyncLabel.Text = syncTimerSeconds == 0 ? "" : "Sincronización en: " + timeToSync; this.timeToSyncLabel.Text = syncTimerSeconds == 0 ? "" : "Sincronización en: " + FormatService.formatSecondsToMinutes(timeToSync); } else { this.timeToSyncLabel.Text = "Sincronización desactivada"; } }
private async void processPeridicSynchronization(DateTime? pDrawDate = null, long pDrawType = 0) { // Lanzar sincronización periódica solamente si está activa if (ParameterService.isPeriodSyncEnabled()) { // Tareas previas a la sincronización Console.WriteLine("Inicia SyncPeriodica: " + DateTime.Now.ToString("HH:mm:ss")); this.setSyncStatusText(LabelConstants.SYNC_PENDING_TRANSACTIONS_LABEL_TEXT); this.displaySyncStatusComponents(true); // Invocar la sincronización SynchronizeService service = new SynchronizeService(); await service.syncPendingListNumberToServerAsync(pDrawDate, pDrawType); // Tareas posteriores a la sincronización this.mediator.updateTotalBoxes(); this.setSyncStatusText(LabelConstants.COMPLETED_SYNC_TRANSACTIONS_LABEL_TEXT); this.displaySyncStatusComponents(false); Console.WriteLine("Finaliza SyncPeriodica: " + DateTime.Now.ToString("HH:mm:ss")); } }
public void fillParameterBoxes() { this.txtSyncPeriod.Text = ParameterService.getPeriodSyncIntervalInSeconds().ToString(); this.cbxEnableSync.Checked = ParameterService.isPeriodSyncEnabled() ? true : false; }