Пример #1
0
        public static DictionaryNodeOptions GetFullyEnabledListOptions(LcmCache cache, DictionaryNodeListOptions.ListIds listName)
        {
            List <DictionaryNodeListOptions.DictionaryNodeOption> dnoList;
            var useParaOptions = false;

            switch (listName)
            {
            case DictionaryNodeListOptions.ListIds.Minor:
                dnoList = DictionaryDetailsControllerTests.ListOfEnabledDNOsFromStrings(
                    new[] { XmlViewsUtils.GetGuidForUnspecifiedVariantType(), XmlViewsUtils.GetGuidForUnspecifiedComplexFormType() }
                    .Select(guid => guid.ToString())
                    .Union(cache.LangProject.LexDbOA.ComplexEntryTypesOA.PossibilitiesOS
                           .Union(cache.LangProject.LexDbOA.VariantEntryTypesOA.PossibilitiesOS).Select(item => item.Guid.ToString())));
                break;

            case DictionaryNodeListOptions.ListIds.Variant:
                dnoList = DictionaryDetailsControllerTests.ListOfEnabledDNOsFromStrings(
                    new[] { XmlViewsUtils.GetGuidForUnspecifiedVariantType().ToString() }
                    .Union(cache.LangProject.LexDbOA.VariantEntryTypesOA.PossibilitiesOS.Select(item => item.Guid.ToString())));
                break;

            case DictionaryNodeListOptions.ListIds.Complex:
                useParaOptions = true;
                dnoList        = DictionaryDetailsControllerTests.ListOfEnabledDNOsFromStrings(
                    new[] { XmlViewsUtils.GetGuidForUnspecifiedComplexFormType().ToString() }
                    .Union(cache.LangProject.LexDbOA.ComplexEntryTypesOA.PossibilitiesOS.Select(item => item.Guid.ToString())));
                break;

            case DictionaryNodeListOptions.ListIds.Note:
                useParaOptions = true;
                dnoList        = DictionaryDetailsControllerTests.ListOfEnabledDNOsFromStrings(
                    new[] { XmlViewsUtils.GetGuidForUnspecifiedExtendedNoteType().ToString() }
                    .Union(cache.LangProject.LexDbOA.ExtendedNoteTypesOA.PossibilitiesOS.Select(item => item.Guid.ToString())));
                break;

            default:
                throw new NotImplementedException(string.Format("Unknown list id {0}", listName));
            }

            DictionaryNodeListOptions listOptions = useParaOptions ? new DictionaryNodeListAndParaOptions() : new DictionaryNodeListOptions();

            listOptions.ListId  = listName;
            listOptions.Options = dnoList;
            return(listOptions);
        }