SIL.FieldWorks.Common.Framework.FwApp.ResumeSynchronize C# (CSharp) Method

ResumeSynchronize() public method

Resume execution of synchronize messages. If there are any messages in the queue execute them now.
public ResumeSynchronize ( ) : void
return void
		public void ResumeSynchronize()
		{
			CheckDisposed();

			if (m_suppressedCacheInfo == null)
				return; // Nothing to do

			m_suppressedCacheInfo.Count--;
			if (m_suppressedCacheInfo.Count > 0)
				return; // Still nested

			BeginUpdate();
			Queue<SyncMsg> messages = m_suppressedCacheInfo.Queue;
			m_suppressedCacheInfo = null;

			bool fProcessUndoRedoAfter = false;
			SyncMsg savedUndoRedo = SyncMsg.ksyncFullRefresh; // Arbitrary
			foreach (SyncMsg synchMsg in messages)
			{
				if (synchMsg == SyncMsg.ksyncUndoRedo)
				{
					// we must process this synch message after all the others
					fProcessUndoRedoAfter = true;
					savedUndoRedo = synchMsg;
					continue;
				}
				// Do the synch
				if (!Synchronize(synchMsg))
				{
					fProcessUndoRedoAfter = false; // Refresh already done, final UndoRedo unnecessary
					break; // One resulted in Refresh everything, ignore other synch msgs.
				}
			}
			if (fProcessUndoRedoAfter)
				Synchronize(savedUndoRedo);

			// NOTE: This code may present a race condition, because there is a slight
			// possibility that a sync message can come to the App at
			// this point and then get cleared from the syncMessages list and never get run.
			EndUpdate();
		}