/// <summary>
        /// Executes in two distinct scenarios.
        ///
        /// 1. If disposing is true, the method has been called directly
        /// or indirectly by a user's code via the Dispose method.
        /// Both managed and unmanaged resources can be disposed.
        ///
        /// 2. If disposing is false, the method has been called by the
        /// runtime from inside the finalizer and you should not reference (access)
        /// other managed objects, as they already have been garbage collected.
        /// Only unmanaged resources can be disposed.
        /// </summary>
        /// <param name="disposing"></param>
        /// <remarks>
        /// If any exceptions are thrown, that is fine.
        /// If the method is being done in a finalizer, it will be ignored.
        /// If it is thrown by client code calling Dispose,
        /// it needs to be handled by fixing the bug.
        ///
        /// If subclasses override this method, they should call the base implementation.
        /// </remarks>
        protected virtual void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (m_isDisposed)
            {
                return;
            }

            if (disposing)
            {
                // Dispose managed resources here.
            }

            // Dispose unmanaged resources here, whether disposing is true or false.
            m_callbacks = null;

            m_isDisposed = true;
        }
		/// <summary>
		/// Initialize the dialog after creating it.
		/// </summary>
		/// <param name="configurationParameters"></param>
		/// <param name="cache"></param>
		/// <param name="styleSheet"></param>
		/// <param name="mainWindowDelegateCallbacks"></param>
		/// <param name="mediator"></param>
		public void SetConfigDlgInfo(XmlNode configurationParameters, FdoCache cache,
			FwStyleSheet styleSheet, IMainWindowDelegateCallbacks mainWindowDelegateCallbacks,
			Mediator mediator, string sLayoutPropertyName)
		{
			CheckDisposed();
			m_configurationParameters = configurationParameters;
			string labelKey = XmlUtils.GetAttributeValue(configurationParameters, "viewTypeLabelKey");
			if (!String.IsNullOrEmpty(labelKey))
			{
				string sLabel = xWorksStrings.ResourceManager.GetString(labelKey);
				if (!String.IsNullOrEmpty(sLabel))
					m_lblViewType.Text = sLabel;
			}
			m_cache = cache;
			m_mdc = m_cache.MetaDataCacheAccessor;
			m_styleSheet = styleSheet;
			m_callbacks = mainWindowDelegateCallbacks;
			m_mediator = mediator;
			m_sLayoutPropertyName = sLayoutPropertyName;
			if (m_mediator != null && m_mediator.HasStringTable)
				m_stringTbl = m_mediator.StringTbl;
			m_layouts = Inventory.GetInventory("layouts", cache.DatabaseName);
			m_parts = Inventory.GetInventory("parts", cache.DatabaseName);
			string configObjectName = XmlUtils.GetLocalizedAttributeValue(m_mediator.StringTbl,
				configurationParameters, "configureObjectName", "");
			this.Text = String.Format(this.Text, configObjectName);
			m_defaultRootLayoutName = XmlUtils.GetAttributeValue(configurationParameters, "layout");
			string sLayoutType = null;
			if (m_mediator != null && m_mediator.PropertyTable != null)
			{
				object objType = m_mediator.PropertyTable.GetValue(m_sLayoutPropertyName);
				if (objType != null)
					sLayoutType = (string)objType;
			}
			if (String.IsNullOrEmpty(sLayoutType))
				sLayoutType = m_defaultRootLayoutName;
			CreateComboAndTreeItems(sLayoutType);

			// Restore the location and size from last time we called this dialog.
			if (m_mediator != null && m_mediator.PropertyTable != null)
			{
				object locWnd = m_mediator.PropertyTable.GetValue("XmlDocConfigureDlg_Location");
				object szWnd = m_mediator.PropertyTable.GetValue("XmlDocConfigureDlg_Size");
				if (locWnd != null && szWnd != null)
				{
					Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd);
					ScreenUtils.EnsureVisibleRect(ref rect);
					DesktopBounds = rect;
					StartPosition = FormStartPosition.Manual;
				}
			}

			// Make a help topic ID
			m_helpTopicID = generateChooserHelpTopicID(configObjectName);

			// Load the list for the styles combo box.
			SetStylesList();
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="callbacks">Main window</param>
		/// ------------------------------------------------------------------------------------
		public MainWindowDelegate(IMainWindowDelegateCallbacks callbacks)
		{
			m_callbacks = callbacks;
		}
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="callbacks">Main window</param>
 /// ------------------------------------------------------------------------------------
 public MainWindowDelegate(IMainWindowDelegateCallbacks callbacks)
 {
     m_callbacks = callbacks;
 }
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		protected virtual void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (m_isDisposed)
				return;

			if (disposing)
			{
				// Dispose managed resources here.
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_callbacks = null;

			m_isDisposed = true;
		}