Пример #1
0
        /// <summary>Returns HVO's of the entries to publish. If there are none, returns an empty array.</summary>
        public int[] GetEntriesToPublish(Mediator mediator, int virtualFlid, string dictionaryType = null)
        {
            if (dictionaryType == null)
            {
                dictionaryType = DictionaryConfigurationListener.GetDictionaryConfigurationBaseType(mediator);
            }
            // LT-16426: Listener here needs to return a non-localized version or all non-English dictionaries will be empty!
            switch (dictionaryType)
            {
            case "Dictionary":
                return(VecProp(Cache.LangProject.LexDbOA.Hvo, virtualFlid));

            case "Reversal Index":
            {
                var reversalIndexGuid = ReversalIndexEntryUi.GetObjectGuidIfValid(mediator, "ReversalIndexGuid");
                if (reversalIndexGuid != Guid.Empty)
                {
                    var currentReversalIndex = Cache.ServiceLocator.GetObject(reversalIndexGuid) as IReversalIndex;
                    if (currentReversalIndex != null)
                    {
                        return(GetSortedAndFilteredReversalEntries(currentReversalIndex.Hvo, virtualFlid));
                    }
                }
                break;
            }
            }
            return(new int[] { });
        }
Пример #2
0
        public void GetDictionaryConfigurationBaseType_ReportsCorrectlyForDictionaryAndReversal()
        {
            m_propertyTable.SetProperty("currentContentControl", "lexiconEdit", true);
            Assert.AreEqual("Dictionary", DictionaryConfigurationListener.GetDictionaryConfigurationBaseType(m_propertyTable), "did not return expected type");
            m_propertyTable.SetProperty("currentContentControl", "lexiconBrowse", true);
            Assert.AreEqual("Dictionary", DictionaryConfigurationListener.GetDictionaryConfigurationBaseType(m_propertyTable), "did not return expected type");
            m_propertyTable.SetProperty("currentContentControl", "lexiconDictionary", true);
            Assert.AreEqual("Dictionary", DictionaryConfigurationListener.GetDictionaryConfigurationBaseType(m_propertyTable), "did not return expected type");

            m_propertyTable.SetProperty("currentContentControl", "reversalToolEditComplete", true);
            Assert.AreEqual("Reversal Index", DictionaryConfigurationListener.GetDictionaryConfigurationBaseType(m_propertyTable), "did not return expected type");
            m_propertyTable.SetProperty("currentContentControl", "reversalToolBulkEditReversalEntries", true);
            Assert.AreEqual("Reversal Index", DictionaryConfigurationListener.GetDictionaryConfigurationBaseType(m_propertyTable), "did not return expected type");

            m_propertyTable.SetProperty("currentContentControl", "somethingElse", true);
            Assert.IsNull(DictionaryConfigurationListener.GetDictionaryConfigurationBaseType(m_propertyTable), "Other areas should return null");
        }