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

EnableMainWindows() public method

Enable or disable all top-level windows. This allows nesting. In other words, calling EnableMainWindows(false) twice requires 2 calls to EnableMainWindows(true) before the top level windows are actually enabled. An example of where not allowing nesting was a problem was the Tools/Options dialog, which could open a PossListChooser dialog. Before, when you closed the PossListChooser, you could select the main window.
public EnableMainWindows ( bool fEnable ) : void
fEnable bool Enable (true) or disable (false).
return void
		public void EnableMainWindows(bool fEnable)
		{
			CheckDisposed();

			if (!fEnable)
				m_nEnableLevel--;
			else if (++m_nEnableLevel != 0)
				return;

			// TE-1913: Prevent user from accessing windows that are open to the same project.
			// Originally this was used for importing.
			foreach (IFwMainWnd fwMainWnd in MainWindows)
			{
				if (fwMainWnd is Form)
					((Form)fwMainWnd).Enabled = fEnable;
			}
		}