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

Synchronize() public method

Cycle through the applications main windows and synchronize them with database changes.
public Synchronize ( SyncMsg sync ) : bool
sync SyncMsg synchronization information record
return bool
		public virtual bool Synchronize(SyncMsg sync)
		{
			CheckDisposed();

			if (m_suppressedCacheInfo != null)
			{
				Queue<SyncMsg> messages = m_suppressedCacheInfo.Queue;
				if (!messages.Contains(sync))
					messages.Enqueue(sync);
				return true;
			}

			if (sync == SyncMsg.ksyncFullRefresh)
			{
				RefreshAllViews();
				return false;
			}

			foreach (IFwMainWnd wnd in MainWindows)
				wnd.PreSynchronize(sync);

			if (sync == SyncMsg.ksyncWs)
			{
				// REVIEW TeTeam: AfLpInfo::Synchronize calls AfLpInfo::FullRefresh, which
				// clears the cache, loads the styles, loads ws and updates wsf, load project
				// basics, updates LinkedFiles root, load overlays and refreshes possibility
				// lists. I don't think we need to do any of these here.
				RefreshAllViews();
				return false;
			}

			foreach (IFwMainWnd wnd in MainWindows)
			{
				if (!wnd.Synchronize(sync))
				{
					// The window itself was not able to process the message successfully;
					// play safe and refresh everything
					RefreshAllViews();
					return false;
				}
			}

			return true;
		}