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

RemoveWindow() public method

Removes the specified IFwMainWnd from the list of windows. If it is ok to close down the application and the count of main windows is zero, then this method will also shut down the application.
public RemoveWindow ( IFwMainWnd fwMainWindow ) : void
fwMainWindow IFwMainWnd The IFwMainWnd to remove
return void
		public virtual void RemoveWindow(IFwMainWnd fwMainWindow)
		{
			if (IsDisposed || BeingDisposed)
				return;

			if (!m_rgMainWindows.Contains(fwMainWindow))
				return; // It isn't our window.

			// NOTE: The main window that was passed in is most likely already disposed, so
			// make sure we don't call anything that would throw an ObjectDisposedException!
			m_rgMainWindows.Remove(fwMainWindow);
			Form form = (Form)fwMainWindow;
			form.Activated -= fwMainWindow_Activated;
			form.HandleDestroyed -= fwMainWindow_HandleDestroyed;

			if (m_activeMainWindow == fwMainWindow)
				m_activeMainWindow = null; // Just in case

			if (m_rgMainWindows.Count == 0)
				m_fwManager.ExecuteAsync(m_fwManager.ShutdownApp, this);
		}
		#endregion