本文整理汇总了C#中IVwRootBox.OnTyping方法的典型用法代码示例。如果您正苦于以下问题:C# IVwRootBox.OnTyping方法的具体用法?C# IVwRootBox.OnTyping怎么用?C# IVwRootBox.OnTyping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwRootBox
的用法示例。
在下文中一共展示了IVwRootBox.OnTyping方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChooseNaturalClass
/// <summary>
/// Bring up a chooser for selecting a natural class, and insert it into the string
/// representation stored in the rootbox. This static method is used by
/// SIL.FieldWorks.Common.Framework.DetailControls.PhoneEnvReferenceSlice and
/// SIL.FieldWorks.XWorks.MorphologyEditor.PhEnvStrRepresentationSlice.
/// </summary>
/// <param name="rootb"></param>
/// <param name="cache"></param>
/// <param name="persistenceProvider"></param>
/// <param name="mediator"></param>
/// <returns></returns>
public static bool ChooseNaturalClass(IVwRootBox rootb, FdoCache cache,
IPersistenceProvider persistenceProvider, XCore.Mediator mediator)
{
List<int> candidates = null;
int hvoPhonData = cache.LangProject.PhonologicalDataOA.Hvo;
int flidNatClasses = (int)PhPhonData.PhPhonDataTags.kflidNaturalClasses;
int[] targetHvos = cache.GetVectorProperty(hvoPhonData, flidNatClasses, false);
if (targetHvos.Length > 0)
candidates = new List<int>(targetHvos);
else
candidates = new List<int>(0);
ObjectLabelCollection labels = new ObjectLabelCollection(cache, candidates,
"",
cache.LanguageWritingSystemFactoryAccessor.GetStrFromWs(cache.DefaultAnalWs));
using (ReallySimpleListChooser chooser = new ReallySimpleListChooser(persistenceProvider,
labels, "NaturalClass"))
{
string sTitle = null;
string sDescription = null;
string sJumpLabel = null;
if (mediator != null && mediator.HasStringTable)
{
sTitle = mediator.StringTbl.GetString("kstidChooseNaturalClass",
"Linguistics/Morphology/NaturalClassChooser");
sDescription = mediator.StringTbl.GetString("kstidNaturalClassListing",
"Linguistics/Morphology/NaturalClassChooser");
sJumpLabel = mediator.StringTbl.GetString("kstidGotoNaturalClassList",
"Linguistics/Morphology/NaturalClassChooser");
}
if (sTitle == null || sTitle.Length == 0 || sTitle == "kstidChooseNaturalClass")
sTitle = XMLViewsStrings.ksChooseNaturalClass;
if (sDescription == null || sDescription.Length == 0 || sDescription == "kstidNaturalClassListing")
sDescription = XMLViewsStrings.ksNaturalClassDesc;
if (sJumpLabel == null || sJumpLabel.Length == 0 || sJumpLabel == "kstidGotoNaturalClassList")
sJumpLabel = XMLViewsStrings.ksEditNaturalClasses;
chooser.Cache = cache;
chooser.SetObjectAndFlid(0, 0);
chooser.InitializeRaw(mediator, sTitle, sDescription, sJumpLabel,
"naturalClassedit", "analysis vernacular");
System.Windows.Forms.DialogResult res = chooser.ShowDialog();
if (System.Windows.Forms.DialogResult.Cancel == res)
return true;
if (chooser.HandleAnyJump())
return true;
if (chooser.ChosenOne != null)
{
int hvo = chooser.ChosenOne.Hvo;
IPhNaturalClass pnc = PhNaturalClass.CreateFromDBObject(cache, hvo);
ITsString tss = pnc.Abbreviation.BestAnalysisVernacularAlternative;
string sName = tss.Text;
string sIns = String.Format("[{0}]", sName);
int wsPending = cache.DefaultVernWs;
IVwRootSite site = rootb.Site;
IVwGraphics vg = null;
if (site != null)
vg = site.get_ScreenGraphics(rootb);
rootb.OnTyping(vg, sIns, 0, 0, '[', ref wsPending);
}
}
return true;
}