void messagePuller_EnabledChanged(object sender, EventArgs e) { if (!messagePuller.Enabled) { txtSyncStatus.Text = "Offline"; this.Status = SyncWindowStatus.Offline; } else { this.Status = SyncWindowStatus.Syncing; } UpdateUI(); }
void SyncOnce() { messagePuller.Algorithm = radAlgorithmBulkDownload.Active ? MessagePullerAlgorithm.BulkDownload : MessagePullerAlgorithm.OptimizeReading; if (chkHistoryLimitDays.Active) { messagePuller.HistoryLimitDays = (int)txtHistoryLimitDays.Value; } else { messagePuller.HistoryLimitDays = 0; } messagePuller.Process(); if (messagePuller.HistoryProgress != null) { txtGroupHistory.Text = messagePuller.HistoryProgress.Value.ToString(); } if (this.appContext.YamsterApi.Throttled) { txtSyncStatus.Text = "A request was throttled due to Yammer rate limits"; this.Status = SyncWindowStatus.Throttled; } else if (messagePuller.UpToDate) { txtSyncStatus.Text = "Up to date."; this.Status = SyncWindowStatus.UpToDate; } else { // If it's been more than 3 seconds since the last service call, then we're waiting if (unchecked (Environment.TickCount - lastServiceCallTime) > 3000) { txtSyncStatus.Text = "Waiting..."; } this.Status = SyncWindowStatus.Syncing; } }
bool OnPollTimer() { if (destroyed) { return(false); } try { if (this.IsSyncing) { SyncOnce(); } } catch (Exception ex) { txtSyncStatus.Text = "ERROR: " + ex.Message; this.IsSyncing = false; this.Status = SyncWindowStatus.Error; Utilities.ShowApplicationException(ex); } return(true); }