/// <summary>
		/// Pops up a dialog to ask the user how they want to initialize their anthro lists.
		/// Returns a string indicating what file to load, or null if the user selected the custom (make your own) option
		/// </summary>
		public static string PickAnthroList(string description, IHelpTopicProvider helpTopicProvider)
		{
			// Figure out what lists are available (in {FW}/Templates/*.xml).

			var sFilePattern = Path.Combine(FwDirectoryFinder.TemplateDirectory, "*.xml");
			var fHaveOCM = false;
			var fHaveFRAME = false;
			var rgsAnthroFiles = new List<string>();
			var rgsXmlFiles = Directory.GetFiles(FwDirectoryFinder.TemplateDirectory, "*.xml", SearchOption.TopDirectoryOnly);
			string sFile;
			for (var i = 0; i < rgsXmlFiles.Length; ++i)
			{
				sFile = Path.GetFileName(rgsXmlFiles[i]);
				if (Path.GetFileName(sFile) == "OCM.xml")
					fHaveOCM = true;
				else if (Path.GetFileName(sFile) == "OCM-Frame.xml")
					fHaveFRAME = true;
				else if (sFile != "NewLangProj.xml" && IsAnthroList(rgsXmlFiles[i]))
					rgsAnthroFiles.Add(sFile);
			}

			// display a dialog for the user to select a list.

			sFile = null;
			if (fHaveOCM || fHaveFRAME || rgsAnthroFiles.Count > 0)
			{
				using (FwCheckAnthroListDlg dlg = new FwCheckAnthroListDlg())
				{
					dlg.SetValues(fHaveOCM, fHaveFRAME, rgsAnthroFiles, helpTopicProvider);
					if (!String.IsNullOrEmpty(description))
						dlg.SetDescription(description);
					//EnableRelatedWindows(hwnd, false);
					DialogResult res = dlg.ShowDialog();
					//EnableRelatedWindows(hwnd, true);
					if (res == DialogResult.OK)
					{
						int nChoice = dlg.GetChoice();
						switch (nChoice)
						{
							case kralUserDef:
								break;
							case kralOCM:
								sFile = Path.Combine(FwDirectoryFinder.TemplateDirectory, "OCM.xml");
								break;
							case kralFRAME:
								sFile = Path.Combine(FwDirectoryFinder.TemplateDirectory, "OCM-Frame.xml");
								break;
							default:
								Debug.Assert(nChoice >= 0 && nChoice < rgsAnthroFiles.Count);
								sFile = Path.Combine(FwDirectoryFinder.TemplateDirectory, rgsAnthroFiles[nChoice]);
								break;
						}
					}
				}
			}

			return sFile;
		}
        /// <summary>
        /// Pops up a dialog to ask the user how they want to initialize their anthro lists.
        /// Returns a string indicating what file to load, or null if the user selected the custom (make your own) option
        /// </summary>
        public static string PickAnthroList(string description, IHelpTopicProvider helpTopicProvider)
        {
            // Figure out what lists are available (in {FW}/Templates/*.xml).

            var    sFilePattern   = Path.Combine(FwDirectoryFinder.TemplateDirectory, "*.xml");
            var    fHaveOCM       = false;
            var    fHaveFRAME     = false;
            var    rgsAnthroFiles = new List <string>();
            var    rgsXmlFiles    = Directory.GetFiles(FwDirectoryFinder.TemplateDirectory, "*.xml", SearchOption.TopDirectoryOnly);
            string sFile;

            for (var i = 0; i < rgsXmlFiles.Length; ++i)
            {
                sFile = Path.GetFileName(rgsXmlFiles[i]);
                if (Path.GetFileName(sFile) == "OCM.xml")
                {
                    fHaveOCM = true;
                }
                else if (Path.GetFileName(sFile) == "OCM-Frame.xml")
                {
                    fHaveFRAME = true;
                }
                else if (sFile != "NewLangProj.xml" && IsAnthroList(rgsXmlFiles[i]))
                {
                    rgsAnthroFiles.Add(sFile);
                }
            }

            // display a dialog for the user to select a list.

            sFile = null;
            if (fHaveOCM || fHaveFRAME || rgsAnthroFiles.Count > 0)
            {
                using (FwCheckAnthroListDlg dlg = new FwCheckAnthroListDlg())
                {
                    dlg.SetValues(fHaveOCM, fHaveFRAME, rgsAnthroFiles, helpTopicProvider);
                    if (!String.IsNullOrEmpty(description))
                    {
                        dlg.SetDescription(description);
                    }
                    //EnableRelatedWindows(hwnd, false);
                    DialogResult res = dlg.ShowDialog();
                    //EnableRelatedWindows(hwnd, true);
                    if (res == DialogResult.OK)
                    {
                        int nChoice = dlg.GetChoice();
                        switch (nChoice)
                        {
                        case kralUserDef:
                            break;

                        case kralOCM:
                            sFile = Path.Combine(FwDirectoryFinder.TemplateDirectory, "OCM.xml");
                            break;

                        case kralFRAME:
                            sFile = Path.Combine(FwDirectoryFinder.TemplateDirectory, "OCM-Frame.xml");
                            break;

                        default:
                            Debug.Assert(nChoice >= 0 && nChoice < rgsAnthroFiles.Count);
                            sFile = Path.Combine(FwDirectoryFinder.TemplateDirectory, rgsAnthroFiles[nChoice]);
                            break;
                        }
                    }
                }
            }

            return(sFile);
        }
        /// <summary>
        /// Check whether the anthropology list exists.  If not, initialize it, popping
        /// up a dialog to ask the user how he wants it done.
        /// Returning true indicates an anthro list was actually loaded during first-time initialization.
        /// </summary>
        public bool CheckAnthroList(ILangProject proj, Form parent, int wsDefault, IHelpTopicProvider helpTopicProvider)
        {
            // Don't bother loading the list into a memory-only project.  These are used for
            // testing, and don't want to be slowed down by disk accesses.
            if (proj.Cache.ProjectId.Type == FDOBackendProviderType.kMemoryOnly)
            {
                return(false);
            }

            // 1. Determine whether or not the Anthropology List has been initialized.
            if (proj.AnthroListOA != null && proj.AnthroListOA.Name.StringCount > 0)
            {
                if (proj.AnthroListOA.ItemClsid == 0 || proj.AnthroListOA.Depth == 0)
                {
                    proj.Cache.DomainDataByFlid.BeginNonUndoableTask();
                    proj.AnthroListOA.ItemClsid = CmAnthroItemTags.kClassId;
                    proj.AnthroListOA.Depth     = 127;
                    proj.Cache.DomainDataByFlid.EndNonUndoableTask();
                }
                return(false);
                // The Anthropology List may still be empty, but it's initialized!
            }
            // 2. Figure out what lists are available (in {FW}/Templates/*.xml).

            string        sFilePattern   = Path.Combine(DirectoryFinder.TemplateDirectory, "*.xml");
            bool          fHaveOCM       = false;
            bool          fHaveFRAME     = false;
            List <string> rgsAnthroFiles = new List <string>();

            string[] rgsXmlFiles = Directory.GetFiles(DirectoryFinder.TemplateDirectory, "*.xml", SearchOption.TopDirectoryOnly);
            string   sFile;

            for (int i = 0; i < rgsXmlFiles.Length; ++i)
            {
                sFile = Path.GetFileName(rgsXmlFiles[i]);
                if (Path.GetFileName(sFile) == "OCM.xml")
                {
                    fHaveOCM = true;
                }
                else if (Path.GetFileName(sFile) == "OCM-Frame.xml")
                {
                    fHaveFRAME = true;
                }
                else if (sFile != "NewLangProj.xml" && IsAnthroList(rgsXmlFiles[i]))
                {
                    rgsAnthroFiles.Add(sFile);
                }
            }

            // 3. display a dialog for the user to select a list.

            sFile = null;
            if (fHaveOCM || fHaveFRAME || rgsAnthroFiles.Count > 0)
            {
                using (FwCheckAnthroListDlg dlg = new FwCheckAnthroListDlg())
                {
                    dlg.SetValues(fHaveOCM, fHaveFRAME, rgsAnthroFiles, helpTopicProvider);
                    if (!String.IsNullOrEmpty(m_sDescription))
                    {
                        dlg.SetDescription(m_sDescription);
                    }
                    //EnableRelatedWindows(hwnd, false);
                    DialogResult res = dlg.ShowDialog(parent);
                    //EnableRelatedWindows(hwnd, true);
                    if (res == DialogResult.OK)
                    {
                        int nChoice = dlg.GetChoice();
                        switch (nChoice)
                        {
                        case FwCheckAnthroListDlg.kralUserDef:
                            break;

                        case FwCheckAnthroListDlg.kralOCM:
                            sFile = Path.Combine(DirectoryFinder.TemplateDirectory, "OCM.xml");
                            break;

                        case FwCheckAnthroListDlg.kralFRAME:
                            sFile = Path.Combine(DirectoryFinder.TemplateDirectory, "OCM-Frame.xml");
                            break;

                        default:
                            Debug.Assert(nChoice >= 0 && nChoice < rgsAnthroFiles.Count);
                            sFile = Path.Combine(DirectoryFinder.TemplateDirectory, rgsAnthroFiles[nChoice]);
                            break;
                        }
                    }
                }
            }

            // 4. Load the selected list, or initialize properly for a User-defined (empty) list.

            using (new WaitCursor(parent))
            {
                if (String.IsNullOrEmpty(sFile))
                {
                    proj.Cache.DomainDataByFlid.BeginNonUndoableTask();
                    proj.AnthroListOA.Name.set_String(wsDefault, FwCoreDlgs.ksAnthropologyCategories);
                    proj.AnthroListOA.Abbreviation.set_String(wsDefault, FwCoreDlgs.ksAnth);
                    proj.AnthroListOA.ItemClsid = CmAnthroItemTags.kClassId;
                    proj.AnthroListOA.Depth     = 127;
                    proj.Cache.DomainDataByFlid.EndNonUndoableTask();
                }
                else
                {
                    XmlList xlist = new XmlList();
                    xlist.ImportList(proj, "AnthroList", sFile, null);
                }
            }

            // 5. create the corresponding overlays if the list is not empty.

            ICmOverlay over = null;

            foreach (ICmOverlay x in proj.OverlaysOC)
            {
                if (x.PossListRA == proj.AnthroListOA)
                {
                    over = x;
                    break;
                }
            }
            if (over != null)
            {
                proj.Cache.DomainDataByFlid.BeginNonUndoableTask();
                foreach (ICmPossibility poss in proj.AnthroListOA.PossibilitiesOS)
                {
                    over.PossItemsRC.Add(poss);
                    AddSubPossibilitiesToOverlay(over, poss);
                }
                proj.Cache.DomainDataByFlid.EndNonUndoableTask();
            }
            return(true);
        }