本文整理汇总了C#中IVwEnv.CurrentObject方法的典型用法代码示例。如果您正苦于以下问题:C# IVwEnv.CurrentObject方法的具体用法?C# IVwEnv.CurrentObject怎么用?C# IVwEnv.CurrentObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwEnv
的用法示例。
在下文中一共展示了IVwEnv.CurrentObject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Display
//.........这里部分代码省略.........
int wsOldDefault = this.DefaultWs;
this.DefaultWs = wsHvo;
// Cell 1 shows the ws abbreviation.
vwenv.OpenTableCell(1,1);
vwenv.Props = m_ttpLabel;
vwenv.AddObj(wsHvo, this, ReversalIndexEntrySliceView.kFragWsAbbr);
vwenv.CloseTableCell();
// Second cell has the contents for the reversal entries.
vwenv.OpenTableCell(1,1);
// This displays the field flush right for RTL data, but gets arrow keys to
// behave reasonably. See comments on LT-5287.
IWritingSystem lgws = m_cache.LanguageWritingSystemFactoryAccessor.get_EngineOrNull(this.DefaultWs);
if (lgws != null && lgws.RightToLeft)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
}
vwenv.OpenParagraph();
// Do vector of entries in the second column.
vwenv.AddObjVec(ReversalIndexEntrySliceView.kFlidEntries, this, ReversalIndexEntrySliceView.kFragEntries);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
this.DefaultWs = wsOldDefault;
break;
}
case ReversalIndexEntrySliceView.kFragEntryForm:
{
vwenv.AddStringAltMember((int)ReversalIndexEntry.ReversalIndexEntryTags.kflidReversalForm,
this.DefaultWs, this);
int hvoCurrent = vwenv.CurrentObject();
if (hvoCurrent > 0)
{
IReversalIndexEntry rie = ReversalIndexEntry.CreateFromDBObject(m_cache, hvoCurrent);
Debug.Assert(rie != null);
int[] rgWs = m_cache.LangProject.GetReversalIndexWritingSystems(rie.Hvo, false);
int wsAnal = m_cache.DefaultAnalWs;
ITsIncStrBldr tisb = TsIncStrBldrClass.Create();
tisb.SetIntPropValues((int)FwTextPropType.ktptWs,
(int)FwTextPropVar.ktpvDefault, wsAnal);
tisb.SetIntPropValues((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptNotEditable);
tisb.Append(" [");
int cstr = 0;
ITsTextProps ttpBase = null;
for (int i = 0; i < rgWs.Length; ++i)
{
int ws = rgWs[i];
if (ws == this.DefaultWs)
continue;
string sForm = rie.ReversalForm.GetAlternative(ws);
if (sForm != null && sForm.Length != 0)
{
if (cstr > 0)
tisb.Append(", ");
++cstr;
string sWs = m_cache.GetMultiUnicodeAlt(ws,
(int)LgWritingSystem.LgWritingSystemTags.kflidAbbr, wsAnal,
"LgWritingSystem_Abbr");
if (sWs != null && sWs.Length != 0)
{
ITsString tssWs = m_tsf.MakeStringWithPropsRgch(sWs, sWs.Length, m_ttpLabel);
示例2: DisplayVariant
public override ITsString DisplayVariant(IVwEnv vwenv, int tag, int frag)
{
// we use display variant to display literal strings that are editable
ITsString tss = null;
switch (frag)
{
case kfragEmpty:
tss = m_empty;
break;
case kfragFeatureLine:
var value = m_cache.ServiceLocator.GetInstance<IFsClosedValueRepository>().GetObject(vwenv.CurrentObject());
tss = CreateFeatureLine(value);
break;
case kfragPlusVariableLine:
case kfragMinusVariableLine:
var var = m_cache.ServiceLocator.GetInstance<IPhFeatureConstraintRepository>().GetObject(vwenv.CurrentObject());
tss = CreateVariableLine(var, frag == kfragPlusVariableLine);
break;
case kfragIterCtxtMax:
// if the max value is -1, it indicates that it is infinite
int i = m_cache.DomainDataByFlid.get_IntProp(vwenv.CurrentObject(), tag);
if (i == -1)
tss = m_infinity;
else
tss = m_cache.TsStrFactory.MakeString(Convert.ToString(i), m_cache.DefaultUserWs);
break;
case kfragLeftBracketUpHook:
tss = m_leftBracketUpHook;
break;
case kfragLeftBracketExt:
tss = m_leftBracketExt;
break;
case kfragLeftBracketLowHook:
tss = m_leftBracketLowHook;
break;
case kfragRightBracketUpHook:
tss = m_rightBracketUpHook;
break;
case kfragRightBracketExt:
tss = m_rightBracketExt;
break;
case kfragRightBracketLowHook:
tss = m_rightBracketLowHook;
break;
case kfragLeftBracket:
tss = m_leftBracket;
break;
case kfragRightBracket:
tss = m_rightBracket;
break;
case kfragQuestions:
tss = m_questions;
break;
case kfragLeftParen:
tss = m_leftParen;
break;
case kfragRightParen:
tss = m_rightParen;
break;
case kfragXVariable:
tss = m_x;
break;
case kfragZeroWidthSpace:
tss = m_zwSpace;
break;
}
return tss;
}
示例3: DisplayVariant
/// ------------------------------------------------------------------------------------
/// <summary>
/// Add a user prompt for an empty paragraph.
/// </summary>
/// <param name="vwenv">View environment</param>
/// <param name="tag">Tag</param>
/// <param name="frag">Fragment to identify what type of prompt should be created.</param>
/// <returns>ITsString that will be displayed as user prompt.</returns>
/// ------------------------------------------------------------------------------------
public override ITsString DisplayVariant(IVwEnv vwenv, int tag, int frag)
{
string userPrompt = null;
Color promptColor = Color.LightGray;
int promptWs = Cache.DefaultUserWs;
switch (frag)
{
case ScrBookTags.kflidTitle:
ICmObject obj = Cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(vwenv.CurrentObject());
IScrBook book = obj.Owner.Owner as IScrBook;
userPrompt = string.Format(TeResourceHelper.GetResourceString("kstidBookTitleUserPrompt"),
book.Name.UserDefaultWritingSystem.Text);
break;
case ScrSectionTags.kflidHeading:
userPrompt = TeResourceHelper.GetResourceString("kstidSectionHeadUserPrompt");
break;
case CmTranslationTags.kflidTranslation:
if (!PrintLayout && Editable)
userPrompt = TeResourceHelper.GetResourceString("kstidBackTranslationUserPrompt");
else
userPrompt = TeResourceHelper.GetResourceString("kstidBackTranslationUserPromptPrintLayout");
break;
case SegmentTags.kflidFreeTranslation:
// A missing BT of a segment in an interlinear draft back translation.
if (!PrintLayout && Editable)
{
// There are typically several of these in a paragraph so we want to be subtle.
// Also we have a difference of colors: this view has a subtle BG color to show everything
// except the BTs is non-editable. The prompt needs to be white to show it IS editable.
userPrompt = "\xA0\xA0\xA0";
// Three non-breaking spaces (trying not altogether successfully to prevent disappearing at margin)
promptColor = SystemColors.Window;
}
else
{
userPrompt = TeResourceHelper.GetResourceString("kstidBackTranslationUserPromptPrintLayout");
}
break;
default:
Debug.Assert(false, "DisplayVariant called with unexpected fragment");
break;
}
if (userPrompt == null)
userPrompt = string.Empty;
ITsPropsBldr ttpBldr = TsPropsBldrClass.Create();
ttpBldr.SetIntPropValues((int)FwTextPropType.ktptBackColor,
(int) FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(promptColor));
ttpBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
(int) FwTextPropVar.ktpvDefault, promptWs);
// The use of the user-defined property here is to indicate that this is a
// user prompt string.
ttpBldr.SetIntPropValues(SimpleRootSite.ktptUserPrompt,
(int)FwTextPropVar.ktpvDefault, 1);
ttpBldr.SetIntPropValues((int)FwTextPropType.ktptSpellCheck,
(int)FwTextPropVar.ktpvEnum, (int)SpellingModes.ksmDoNotCheck);
ITsStrBldr bldr = TsStrBldrClass.Create();
bldr.Replace(0, 0, userPrompt, ttpBldr.GetTextProps());
// Begin the prompt with a zero-width space in the view's default writing system.
// 200B == zero-width space.
// This helps select the correct keyboard when the user selects the user prompt and
// begins typing. Also prevent the DoNotSpellCheck and back color being applied
// to what is typed.
ITsPropsBldr ttpBldr2 = TsPropsBldrClass.Create();
ttpBldr2.SetIntPropValues((int)FwTextPropType.ktptWs,
(int)FwTextPropVar.ktpvDefault, m_wsDefault);
ttpBldr2.SetIntPropValues(SimpleRootSite.ktptUserPrompt,
(int)FwTextPropVar.ktpvDefault, 1);
bldr.Replace(0, 0, "\u200B", ttpBldr2.GetTextProps());
return bldr.GetString();
}
示例4: DisplayVariant
/// -----------------------------------------------------------------------------------
/// <summary>
/// This version knows how to display a generic date as a string.
/// </summary>
/// -----------------------------------------------------------------------------------
public override ITsString DisplayVariant(IVwEnv vwenv, int tag, int frag)
{
if (vwenv.DataAccess.MetaDataCache.GetFieldType(tag) == (int)CellarPropertyType.GenDate)
{
// handle generic date. Because the actual GenDate struct is not available to
// Views code, we have to handle the display of the GenDate here
var sda = vwenv.DataAccess as ISilDataAccessManaged;
Debug.Assert(sda != null);
var genDate = sda.get_GenDateProp(vwenv.CurrentObject(), tag);
var tsf = TsStrFactoryClass.Create();
string str = "";
switch (frag)
{
case kfragGenDateLong:
str = genDate.ToLongString();
break;
case kfragGenDateShort:
str = genDate.ToShortString();
break;
case kfragGenDateSort:
str = genDate.ToSortString();
break;
}
return tsf.MakeString(str, sda.WritingSystemFactory.UserWs);
}
else
return base.DisplayVariant(vwenv, tag, frag);
}
示例5: DisplayVariant
/// ------------------------------------------------------------------------------------
/// <summary>
/// Handle display of a Scripture reference or range.
/// </summary>
/// <param name="vwenv">View environment</param>
/// <param name="tag">Tag</param>
/// <param name="frag">Fragment to identify what type of prompt should be created.</param>
/// <returns>
/// ITsString that will be displayed as user prompt.
/// </returns>
/// ------------------------------------------------------------------------------------
public override ITsString DisplayVariant(IVwEnv vwenv, int tag, int frag)
{
if (frag == (int)NotesFrags.kfrScrRef)
{
IScrScriptureNote ann = m_cache.ServiceLocator.GetInstance<IScrScriptureNoteRepository>().GetObject(vwenv.CurrentObject());
BCVRef startRef = new BCVRef(ann.BeginRef);
string bookAbbrev = m_scrBooks.GetBookAbbrev(startRef.Book);
string sAnnRef = ScrReference.MakeReferenceString(bookAbbrev, ann.BeginRef,
ann.EndRef, m_scr.ChapterVerseSepr, m_scr.Bridge);
return MakeLabelFromText(sAnnRef, ann);
}
return base.DisplayVariant(vwenv, tag, frag);
}
示例6: DisplayVariant
public override ITsString DisplayVariant(IVwEnv vwenv, int tag, int frag)
{
// we use display variant to display literal strings that are editable
ITsString tss = null;
switch (frag)
{
case kfragFeatureLine:
ComplexConcPatternNode node = ((ComplexConcPatternSda) vwenv.DataAccess).Nodes[vwenv.CurrentObject()];
switch (tag)
{
case ktagType:
string typeStr = null;
if (node is ComplexConcMorphNode)
typeStr = ITextStrings.ksComplexConcMorph;
else if (node is ComplexConcWordNode)
typeStr = ITextStrings.ksComplexConcWord;
else if (node is ComplexConcTagNode)
typeStr = ITextStrings.ksComplexConcTag;
tss = CreateFeatureLine(ITextStrings.ksComplexConcType, typeStr, m_cache.DefaultUserWs);
break;
case ktagForm:
ITsString form = null;
var formMorphNode = node as ComplexConcMorphNode;
if (formMorphNode != null)
{
form = formMorphNode.Form;
}
else
{
var formWordNode = node as ComplexConcWordNode;
if (formWordNode != null)
form = formWordNode.Form;
}
Debug.Assert(form != null);
tss = CreateFeatureLine(ITextStrings.ksComplexConcForm, form, false);
break;
case ktagEntry:
ITsString entry = null;
var entryMorphNode = node as ComplexConcMorphNode;
if (entryMorphNode != null)
entry = entryMorphNode.Entry;
Debug.Assert(entry != null);
tss = CreateFeatureLine(ITextStrings.ksComplexConcEntry, entry, false);
break;
case ktagGloss:
ITsString gloss = null;
var glossMorphNode = node as ComplexConcMorphNode;
if (glossMorphNode != null)
{
gloss = glossMorphNode.Gloss;
}
else
{
var glossWordNode = node as ComplexConcWordNode;
if (glossWordNode != null)
gloss = glossWordNode.Gloss;
}
Debug.Assert(gloss != null);
tss = CreateFeatureLine(ITextStrings.ksComplexConcGloss, gloss, false);
break;
case ktagCategory:
IPartOfSpeech category = null;
bool catNegated = false;
var catMorphNode = node as ComplexConcMorphNode;
if (catMorphNode != null)
{
category = catMorphNode.Category;
catNegated = catMorphNode.NegateCategory;
}
else
{
var catWordNode = node as ComplexConcWordNode;
if (catWordNode != null)
{
category = catWordNode.Category;
catNegated = catWordNode.NegateCategory;
}
}
Debug.Assert(category != null);
tss = CreateFeatureLine(ITextStrings.ksComplexConcCategory, category.Abbreviation.BestAnalysisAlternative, catNegated);
break;
case ktagTag:
ICmPossibility tagPoss = null;
var tagNode = node as ComplexConcTagNode;
if (tagNode != null)
tagPoss = tagNode.Tag;
Debug.Assert(tagPoss != null);
tss = CreateFeatureLine(ITextStrings.ksComplexConcTag, tagPoss.Abbreviation.BestAnalysisAlternative, false);
break;
case ktagInfl:
tss = CreateFeatureLine(ITextStrings.ksComplexConcInflFeatures, null, false);
break;
default:
//.........这里部分代码省略.........
示例7: DisplayVariant
public override ITsString DisplayVariant(IVwEnv vwenv, int tag, int frag)
{
// we use display variant to display literal strings that are editable
ITsString tss;
switch (frag)
{
case kfragFeatureLine:
var value = m_cache.ServiceLocator.GetInstance<IFsClosedValueRepository>().GetObject(vwenv.CurrentObject());
tss = CreateFeatureLine(value);
break;
case kfragPlusVariableLine:
case kfragMinusVariableLine:
var var = m_cache.ServiceLocator.GetInstance<IPhFeatureConstraintRepository>().GetObject(vwenv.CurrentObject());
tss = CreateVariableLine(var, frag == kfragPlusVariableLine);
break;
case kfragIterCtxtMax:
// if the max value is -1, it indicates that it is infinite
int i = m_cache.DomainDataByFlid.get_IntProp(vwenv.CurrentObject(), tag);
tss = i == -1 ? m_infinity : m_cache.TsStrFactory.MakeString(Convert.ToString(i), m_cache.DefaultUserWs);
break;
case kfragXVariable:
tss = m_x;
break;
default:
tss = base.DisplayVariant(vwenv, tag, frag);
break;
}
return tss;
}
示例8: DisplayVariant
public override ITsString DisplayVariant(IVwEnv vwenv, int tag, object v, int frag)
{
CheckDisposed();
// we use display variant to display literal strings that are editable
ITsString tss = null;
switch (frag)
{
case kfragEmpty:
tss = m_empty;
break;
case kfragFeatureLine:
IFsClosedValue value = new FsClosedValue(m_cache, vwenv.CurrentObject());
tss = CreateFeatureLine(value);
break;
case kfragPlusVariableLine:
case kfragMinusVariableLine:
IPhFeatureConstraint var = new PhFeatureConstraint(m_cache, vwenv.CurrentObject());
tss = CreateVariableLine(var, frag == kfragPlusVariableLine);
break;
case kfragIterCtxtMax:
// if the max value is -1, it indicates that it is infinite
int i = (int)v;
if (i == -1)
tss = m_infinity;
else
tss = m_cache.MakeUserTss(Convert.ToString(i));
break;
case kfragLeftBracketUpHook:
tss = m_leftBracketUpHook;
break;
case kfragLeftBracketExt:
tss = m_leftBracketExt;
break;
case kfragLeftBracketLowHook:
tss = m_leftBracketLowHook;
break;
case kfragRightBracketUpHook:
tss = m_rightBracketUpHook;
break;
case kfragRightBracketExt:
tss = m_rightBracketExt;
break;
case kfragRightBracketLowHook:
tss = m_rightBracketLowHook;
break;
case kfragLeftBracket:
tss = m_leftBracket;
break;
case kfragRightBracket:
tss = m_rightBracket;
break;
case kfragQuestions:
tss = m_questions;
break;
case kfragLeftParen:
tss = m_leftParen;
break;
case kfragRightParen:
tss = m_rightParen;
break;
case kfragXVariable:
tss = m_x;
break;
case kfragZeroWidthSpace:
tss = m_zwSpace;
break;
}
return tss;
}