public LanguageText AddGloss(string language, string text) { LanguageText lexGloss = null; NonUndoableUnitOfWorkHelper.Do(m_gloss.Cache.ActionHandlerAccessor, () => { CoreWritingSystemDefinition ws; if (!m_lexicon.Cache.ServiceLocator.WritingSystemManager.TryGet(language, out ws)) { throw new ArgumentException("The specified language is unrecognized.", "language"); } m_gloss.Form.set_String(ws.Handle, text.Normalize(NormalizationForm.FormD)); lexGloss = new FdoLanguageText(language, text); }); m_lexicon.OnLexiconGlossAdded(new FdoWordformLexeme(m_lexicon, m_lexemeKey), this, lexGloss); return(lexGloss); }
public LanguageText AddGloss(string language, string text) { using (m_lexicon.ActivationContext.Activate()) { LanguageText lexGloss = null; NonUndoableUnitOfWorkHelper.Do(m_lexSense.Cache.ActionHandlerAccessor, () => { IWritingSystem ws; if (!m_lexicon.Cache.ServiceLocator.WritingSystemManager.TryGet(language, out ws)) throw new ArgumentException("The specified language is unrecognized.", "language"); m_lexSense.Gloss.set_String(ws.Handle, text.Normalize(NormalizationForm.FormD)); lexGloss = new FdoLanguageText(language, text); }); m_lexicon.OnLexiconGlossAdded(new FdoLexEntryLexeme(m_lexicon, m_lexemeKey), this, lexGloss); return lexGloss; } }