protected override void Execute() { Tracer._Trace("DoEnum()"); if (Settings.IdleModeManager.CheckIdleAndSyncComplete()) { Tracer._Trace("IsSyncComplete()"); return; } Settings.IdleModeManager.SetIdleFlag(); MailSync mailSync = new MailSync(_computeCount, _indexStartDate, _idle); mailSync.PrepareMailResources(); foreach (IEMsgStore msgStore in OutlookSession.GetMsgStores()) { if (msgStore == null) { continue; } if (OutlookProcessor.IsIgnoredInfoStore(msgStore)) { continue; } string storeID = msgStore.GetBinProp(MAPIConst.PR_STORE_ENTRYID); string name = msgStore.GetStringProp(MAPIConst.PR_DISPLAY_NAME); FolderDescriptorEnumerator.Do(msgStore, storeID, name, mailSync); if (Settings.IdleModeManager.Interrupted) { if (Settings.IdleIndexing) { Settings.IdleModeManager.DropInterrupted(); OutlookSession.OutlookProcessor.QueueIdleJob(this); } break; } } if (Settings.IdleModeManager.CompletedIdle) { OutlookSession.OutlookProcessor.SetSyncComplete(); mailSync.RemoveDeletedMailsFromIndex(); } else if (!Settings.IdleModeManager.Idle) { if (mailSync.IndexStartDate == DateTime.MinValue) { OutlookSession.OutlookProcessor.SetSyncComplete(); } mailSync.RemoveDeletedMailsFromIndex(); } return; }
protected override void Execute() { if (OutlookSession.OutlookProcessor.ShuttingDown) { return; } IStatusWriter statusWriter = Core.UIManager.GetStatusWriter(this, StatusPane.Network); statusWriter.ShowStatus("Performing background mail synchronization..."); Tracer._Trace("MailSyncBackground is executed"); foreach (IEMsgStore msgStore in OutlookSession.GetMsgStores()) { if (OutlookSession.OutlookProcessor.ShuttingDown) { break; } OutlookSession.ProcessJobs(); if (msgStore == null) { continue; } if (OutlookProcessor.IsIgnoredInfoStore(msgStore)) { continue; } string storeID = msgStore.GetBinProp(MAPIConst.PR_STORE_ENTRYID); string name = msgStore.GetStringProp(MAPIConst.PR_DISPLAY_NAME); FolderDescriptorEnumerator.Do(msgStore, storeID, name, this); } statusWriter.ClearStatus(); ProcessedFolders.DecRef(); }