本文整理汇总了C#中ICmPossibility类的典型用法代码示例。如果您正苦于以下问题:C# ICmPossibility类的具体用法?C# ICmPossibility怎么用?C# ICmPossibility使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICmPossibility类属于命名空间,在下文中一共展示了ICmPossibility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LfItemKeyString
public string LfItemKeyString(ICmPossibility fdoOptionListItem, int ws)
{
string result;
if (fdoOptionListItem == null)
return null;
if (_lfOptionList != null)
{
if (_lfOptionListItemKeyByGuid.TryGetValue(fdoOptionListItem.Guid, out result))
return result;
// We shouldn't get here, because the option list SHOULD be pre-populated.
_logger.Error("Got an option list item without a corresponding LF option list item. " +
"In option list name '{0}', list code '{1}': " +
"FDO option list item '{2}' had GUID {3} but no LF option list item was found",
_lfOptionList.Name, _lfOptionList.Code,
fdoOptionListItem.AbbrAndName, fdoOptionListItem.Guid
);
return null;
}
if (fdoOptionListItem.Abbreviation == null || fdoOptionListItem.Abbreviation.get_String(ws) == null)
{
// Last-ditch effort
char ORC = '\ufffc';
return fdoOptionListItem.AbbrevHierarchyString.Split(ORC).LastOrDefault();
}
else
{
return ConvertFdoToMongoTsStrings.TextFromTsString(fdoOptionListItem.Abbreviation.get_String(ws), _wsf);
}
}
示例2: XmlNoteCategory
/// ------------------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="XmlNoteCategory"/> class based on the
/// specified category.
/// </summary>
/// ------------------------------------------------------------------------------------
public XmlNoteCategory(ICmPossibility category, ILgWritingSystemFactory lgwsf)
{
List<CategoryNode> categoryList = GetCategoryHierarchyList(category);
m_categoryPath = category.NameHierarchyString;
InitializeCategory(categoryList, lgwsf);
}
示例3: HasPossibilityReferences
private int HasPossibilityReferences(out ICmPossibility poss1)
{
var refs = m_listToDelete.ReallyReallyAllPossibilities.Where(
poss => poss.ReferringObjects.Count > 0).ToList();
poss1 = refs.FirstOrDefault();
return refs.Count;
}
示例4: CreateTestData
/// ------------------------------------------------------------------------------------
/// <summary>
/// Implement CreateTestData, called by InMemoryFdoTestBase set up.
/// </summary>
/// ------------------------------------------------------------------------------------
protected override void CreateTestData()
{
var servloc = Cache.ServiceLocator;
ICmPossibilityFactory possibilityFactory = servloc.GetInstance<ICmPossibilityFactory>();
// Add an annotation category (for Discourse)
m_categoryDiscourse = possibilityFactory.Create();
var affixCatList = servloc.GetInstance<ICmPossibilityListFactory>().Create();
Cache.LangProject.AffixCategoriesOA = affixCatList;
affixCatList.PossibilitiesOS.Add(m_categoryDiscourse);
// Add an annotation category (for Grammar)
m_categoryGrammar = possibilityFactory.Create();
affixCatList.PossibilitiesOS.Add(m_categoryGrammar);
// add a sub-annotation category (for "Pronominal reference")
m_categoryGrammar_PronominalRef = possibilityFactory.Create();
m_categoryGrammar.SubPossibilitiesOS.Add(m_categoryGrammar_PronominalRef);
// Set up a filter, with a CmCell we can test on.
ICmFilter filter = servloc.GetInstance<ICmFilterFactory>().Create();
Cache.LangProject.FiltersOC.Add(filter);
ICmRow row = servloc.GetInstance<ICmRowFactory>().Create();
filter.RowsOS.Add(row);
m_cell = servloc.GetInstance<ICmCellFactory>().Create();
row.CellsOS.Add(m_cell);
}
示例5: ValidateTypeRA
/// ------------------------------------------------------------------------------------
/// <summary>
/// Validates the type RA.
/// </summary>
/// <param name="newObjValue">The new obj value.</param>
/// ------------------------------------------------------------------------------------
partial void ValidateTypeRA(ref ICmPossibility newObjValue)
{
// For Flex Example Sentences, it's quite legal for the user to mark the type as
// unknown/empty/null. See FWR-549.
if (newObjValue == null && OwningFlid != LexExampleSentenceTags.kflidTranslations)
throw new ArgumentException("New value must not be null.");
// This check only applies if the translation belongs to a paragraph.
if (Cache.FullyInitializedAndReadyToRock && Owner is IStTxtPara &&
newObjValue.Guid != LangProjectTags.kguidTranBackTranslation)
{
throw new ArgumentException("Back translations are the only type of translation allowed for paragraphs");
}
}
示例6: DictionaryPublicationDecorator
/// <summary>
/// Create one. The SDA passed MAY be the DomainDataByFlid of the cache, but it is usually another
/// decorator.
/// </summary>
/// <param name="cache"></param>
/// <param name="domainDataByFlid"></param>
public DictionaryPublicationDecorator(FdoCache cache, ISilDataAccessManaged domainDataByFlid, int mainFlid, ICmPossibility publication)
: base(domainDataByFlid)
{
Cache = cache;
m_entryRepo = Cache.ServiceLocator.GetInstance<ILexEntryRepository>();
m_lexRefRepo = Cache.ServiceLocator.GetInstance<ILexReferenceRepository>();
m_senseRepo = Cache.ServiceLocator.GetInstance<ILexSenseRepository>();
m_lerRepo = Cache.ServiceLocator.GetInstance<ILexEntryRefRepository>();
m_LexDbEntriesFlid = mainFlid;
m_headwordFlid = Cache.MetaDataCacheAccessor.GetFieldId2(LexEntryTags.kClassId, "HeadWord", false);
m_mlHeadwordFlid = Cache.MetaDataCacheAccessor.GetFieldId2(LexEntryTags.kClassId, "MLHeadWord", false);
m_picsOfSensesFlid = Cache.MetaDataCacheAccessor.GetFieldId2(LexEntryTags.kClassId, "PicturesOfSenses", false);
m_senseOutlineFlid = Cache.MetaDataCacheAccessor.GetFieldId2(LexSenseTags.kClassId, "LexSenseOutline", false);
m_mlOwnerOutlineFlid = Cache.MetaDataCacheAccessor.GetFieldId2(LexSenseTags.kClassId, "MLOwnerOutlineName", false);
m_publishAsMinorEntryFlid = Cache.MetaDataCacheAccessor.GetFieldId2(LexEntryTags.kClassId, "PublishAsMinorEntry", false);
m_doNotShowMainEntryInFlid = Cache.MetaDataCacheAccessor.GetFieldId2(LexEntryTags.kClassId, "DoNotShowMainEntryIn", false);
m_headwordRefFlid = Cache.MetaDataCacheAccessor.GetFieldId2(LexEntryTags.kClassId, "HeadWordRef", false);
m_headwordReversalFlid = Cache.MetaDataCacheAccessor.GetFieldId2(LexEntryTags.kClassId, "HeadWordReversal", false);
m_reversalNameFlid = Cache.MetaDataCacheAccessor.GetFieldId2(LexSenseTags.kClassId, "ReversalName", false);
Publication = publication;
BuildExcludedObjects();
BuildFieldsToFilter();
BuildHomographInfo();
}
示例7: ReadPossItem
private void ReadPossItem(XmlReader xrdrSub, ICmPossibility poss, string sItemClassName, string ownerPath,
Dictionary<string, ICmPossibility> mapNameToPoss)
{
xrdrSub.Read();
Debug.Assert(xrdrSub.Name == sItemClassName || m_itemClassNames.Contains(xrdrSub.Name));
try
{
string abbrXml = null;
string descXml = null;
string aliasXml = null;
string revabbrXml = null;
string revabbrevXml = null;
string revnameXml = null;
string questionsXml = null;
while (xrdrSub.Read())
{
if (xrdrSub.NodeType == XmlNodeType.Element)
{
switch (xrdrSub.Name)
{
case "Abbreviation":
if (poss != null)
SetMultiUnicodeFromXml(xrdrSub, poss.Abbreviation);
else
abbrXml = GetXmlOfElement(xrdrSub);
break;
case "Description":
if (poss != null)
SetMultiStringFromXml(xrdrSub, poss.Description);
else
descXml = GetXmlOfElement(xrdrSub);
break;
case "Name":
if (poss != null)
{
SetMultiUnicodeFromXml(xrdrSub, poss.Name);
}
else
{
poss = FindPossibilityAndSetName(xrdrSub, ownerPath, mapNameToPoss);
if (poss != null)
{
if (abbrXml != null)
{
using (var srdr = new StringReader(abbrXml))
{
using (var xrdrAbbr = XmlReader.Create(srdr))
{
SetMultiUnicodeFromXml(xrdrAbbr, poss.Abbreviation);
xrdrAbbr.Close();
abbrXml = null;
}
}
}
if (descXml != null)
{
using (var srdr = new StringReader(descXml))
{
using (var xrdrDesc = XmlReader.Create(srdr))
{
SetMultiStringFromXml(xrdrDesc, poss.Description);
xrdrDesc.Close();
descXml = null;
}
}
}
if (aliasXml != null)
{
if (poss is ICmPerson)
{
using (var srdr = new StringReader(aliasXml))
{
using (var xrdrT = XmlReader.Create(srdr))
{
SetMultiUnicodeFromXml(xrdrT, (poss as ICmPerson).Alias);
xrdrT.Close();
}
}
}
else if (poss is ICmLocation)
{
using (var srdr = new StringReader(aliasXml))
{
using (var xrdrT = XmlReader.Create(srdr))
{
SetMultiUnicodeFromXml(xrdrT, (poss as ICmLocation).Alias);
xrdrT.Close();
}
}
}
else
{
ReportUnexpectedElement(sItemClassName, "Alias");
}
aliasXml = null;
}
if (revabbrXml != null)
{
if (poss is ILexEntryType)
{
//.........这里部分代码省略.........
示例8: PopulateChildNodes
/// ------------------------------------------------------------------------------------
/// <summary>
/// Populate the node with the children of the possibility. (recursive)
/// </summary>
/// <param name="node">given node</param>
/// <param name="possibility">The possibility whose subpossibilities will be added as
/// the child nodes</param>
/// ------------------------------------------------------------------------------------
protected virtual void PopulateChildNodes(TreeNode node, ICmPossibility possibility)
{
foreach (ICmPossibility subPossibility in possibility.SubPossibilitiesOS)
node.Nodes.Add(CreateNode(subPossibility));
}
示例9: GetPossibilityText
/// ------------------------------------------------------------------------------------
/// <summary>
/// Get the text representing the possibility.
/// </summary>
/// ------------------------------------------------------------------------------------
protected virtual string GetPossibilityText(ICmPossibility possibility)
{
return possibility.Name.BestAnalysisAlternative.Text;
}
示例10: LoadSubPossibilitiesFromXml
private void LoadSubPossibilitiesFromXml(XmlReader xrdr, ICmPossibility owner, string sItemClassName)
{
Debug.Assert(owner != null);
if (xrdr.ReadToDescendant(sItemClassName))
{
do
{
string sGuid = xrdr.GetAttribute("guid");
xrdr.MoveToElement();
Guid guid = Guid.Empty;
if (!String.IsNullOrEmpty(sGuid))
guid = new Guid(sGuid);
ICmPossibility poss = null;
switch (sItemClassName)
{
case "CmPossibility":
poss = m_factPoss.Create(EnsureGuid(guid), owner);
break;
case "CmAnthroItem":
Debug.Assert(owner is ICmAnthroItem);
poss = m_factAnthro.Create(EnsureGuid(guid), owner as ICmAnthroItem) as ICmPossibility;
break;
case "CmSemanticDomain":
Debug.Assert(owner is ICmSemanticDomain);
poss = m_factSemDom.Create(EnsureGuid(guid), owner as ICmSemanticDomain) as ICmPossibility;
break;
case "PartOfSpeech":
Debug.Assert(owner is IPartOfSpeech);
poss = m_factPOS.Create(guid, (IPartOfSpeech)owner);
break;
default:
// TODO: implement the other subclasses of CmPossibility?
break;
}
Debug.Assert(poss != null);
ReadPossItem(xrdr.ReadSubtree(), poss, sItemClassName);
} while (xrdr.ReadToNextSibling(sItemClassName));
}
xrdr.Read(); // reads end element.
}
示例11: MakeTemplate
/// <summary>
/// N.B. If actually using columns in tests, you must add the following line after creating the chart.
/// m_ccl.Chart.TemplateRA = m_template;
/// </summary>
/// <returns></returns>
public ICmPossibility MakeTemplate()
{
// The exact organization of columns is not of great
// importance for the current tests (still less the names), but we do want there
// to be a hierarchy, since that is a common problem, and naming them conventionally
// may make debugging easier.
m_template = m_fdoCache.LangProject.GetDefaultChartTemplate();
return m_template;
}
示例12: VerifyChangeColumn
private static void VerifyChangeColumn(IEnumerable<IConstituentChartCellPart> cellPartsToMove, ICmPossibility column, string message)
{
foreach (var cellPart in cellPartsToMove)
Assert.AreEqual(column, cellPart.ColumnRA, message);
}
示例13: VerifyInsertMarker
private void VerifyInsertMarker(ICmPossibility marker)
{
VerifyRow(0, "1a", 2);
VerifyTag(0, 1, m_allColumns[1], marker);
}
示例14: VerifyMovedText
/// <summary>
/// Verify that there is a row with the specified index that has a cell part
/// (subclass ConstChartMovedTextMarker) with the specified index which belongs to the
/// specified column and points to the specified WordGroup object in the right direction.
/// </summary>
/// <param name="irow"></param>
/// <param name="icellPart"></param>
/// <param name="column"></param>
/// <param name="wordGrp"></param>
/// <param name="fPrepose"></param>
void VerifyMovedText(int irow, int icellPart, ICmPossibility column, IConstChartWordGroup wordGrp, bool fPrepose)
{
m_helper.VerifyMovedTextMarker(irow, icellPart, column, wordGrp, fPrepose);
}
示例15: GetPossibility
/// ------------------------------------------------------------------------------------
/// <summary>
/// Shows the Chooser dialog to allow the user to select a single possibility.
/// </summary>
/// <remarks>Used for filtering</remarks>
/// <param name="list">The possibility list used to populate the tree</param>
/// <param name="initialSelected">The possibility to check initially, or null to
/// show with no initial selection</param>
/// <returns>A single chosen CmPossibility, or null if user cancels or chooses
/// nothing.</returns>
/// ------------------------------------------------------------------------------------
public ICmPossibility GetPossibility(ICmPossibilityList list, ICmPossibility initialSelected)
{
//CheckDisposed();
//m_initiallySelectedHvos = new List<int>(1);
//m_initiallySelectedHvos.Add(hvoPoss);
//if (list != (CmPossibilityList)m_list)
//{
// m_list = list;
// SetTitle();
//}
//tvPossibilities.Load(m_list, m_initiallySelectedHvos);
//if (ShowDialog() != DialogResult.OK)
// return 0;
//List<int> newHvos = tvPossibilities.SelectedHvos;
//return (newHvos != null && newHvos.Count > 0 ? newHvos[0] : 0);
// REVIEW: Currently, the chooser tree doesn't allow the user to select
// only one possibility. If this method and single node selection is ever
// necessary, then this method will need to be rewritten.
return null;
}