/// <summary> /// extracts the variant and component from the dialog, depending upon whether we're /// called from an "Insert Variant" or "Variant Of..." context. /// </summary> /// <param name="variant"></param> /// <param name="componentLexeme"></param> private void GetVariantAndComponentAndSelectedEntryType(out ILexEntry variant, out IVariantComponentLexeme componentLexeme, out ILexEntryType selectedEntryType) { variant = null; componentLexeme = null; if (m_fBackRefToVariant) { // in "Insert Variant" contexts, // we're calling the dialog from the component lexeme, so consider SelectedID as the variant. componentLexeme = m_startingEntry; variant = LexEntry.CreateFromDBObject(m_cache, SelectedID); } else { // in "Variant of..." contexts, // we're calling the dialog from the variant, so consider SelectedID the componentLexeme. variant = m_startingEntry; componentLexeme = CmObject.CreateFromDBObject(m_cache, SelectedID) as IVariantComponentLexeme; } if (m_fGetVariantEntryTypeFromTreeCombo) { selectedEntryType = LexEntryType.CreateFromDBObject(m_cache, SelectedVariantEntryTypeHvo); } else { selectedEntryType = null; } }
/// <summary> /// Create ILexEntryType instance. /// </summary> /// <param name="guid"></param> /// <param name="hvo"></param> /// <param name="owner"></param> /// <param name="index"></param> /// <param name="name"></param> /// <param name="nameWs"></param> /// <param name="abbreviation"></param> /// <param name="abbreviationWs"></param> /// <returns></returns> void ILexEntryTypeFactoryInternal.Create(Guid guid, int hvo, ICmPossibilityList owner, int index, ITsString name, int nameWs, ITsString abbreviation, int abbreviationWs) { if (owner == null) throw new ArgumentNullException("owner"); if (name == null) throw new ArgumentNullException("name"); if (abbreviation == null) throw new ArgumentNullException("abbreviation"); var lexEntryType = new LexEntryType( m_cache, hvo, guid); owner.PossibilitiesOS.Add(lexEntryType); lexEntryType.Name.set_String(nameWs, name); lexEntryType.Abbreviation.set_String(abbreviationWs, abbreviation); lexEntryType.IsProtected = true; // They are all protected as fas as this factory method is concerned. }