SIL.FieldWorks.XWorks.FwXWindow.RefreshDisplay C# (CSharp) Method

RefreshDisplay() public method

Collect refreshable caches from every child which has one and refresh them (once each). Call RefreshDisplay for every child control (recursively) which implements it. returns true if all the children have been processed by this class.
public RefreshDisplay ( ) : bool
return bool
		public bool RefreshDisplay()
		{
			Cache.ServiceLocator.GetInstance<IUndoStackManager>().Refresh();
			var cacheCollector = new HashSet<IRefreshCache>();
			var clerkCollector = new HashSet<RecordClerk>();
			CollectCachesToRefresh(this, cacheCollector, clerkCollector);
			foreach (var cache in cacheCollector)
				cache.Refresh();
			foreach (var clerk in clerkCollector)
				clerk.ReloadIfNeeded();
			try
			{
				// In many cases ReconstructViews, which calls RefreshViews, will also try to Refresh the same caches.
				// Not only is this a waste, but it may wipe out data that ReloadIfNeeded has carefully re-created.
				// So suspend refresh for the caches we have already refreshed.
				foreach (var cache in cacheCollector)
				{
					if (cache is ISuspendRefresh)
						((ISuspendRefresh)cache).SuspendRefresh();
				}
				// Don't be lured into simplifying this to ReconstructViews(this). That has the loop,
				// but also calls this method again, making a stack overflow.
				foreach (Control c in Controls)
					ReconstructViews(c);
			}
			finally
			{
				foreach (var cache in cacheCollector)
				{
					if (cache is ISuspendRefresh)
						((ISuspendRefresh)cache).ResumeRefresh();
				}
			}
			return true;
		}
FwXWindow