本文整理汇总了C#中SIL.FieldWorks.FDO.FdoCache.SetTsStringProperty方法的典型用法代码示例。如果您正苦于以下问题:C# FdoCache.SetTsStringProperty方法的具体用法?C# FdoCache.SetTsStringProperty怎么用?C# FdoCache.SetTsStringProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.FDO.FdoCache
的用法示例。
在下文中一共展示了FdoCache.SetTsStringProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetString
/// <summary>
/// Set the specified value...typically your own new or old value...on the appropriate property.
/// </summary>
/// <param name="cache"></param>
/// <param name="newValue"></param>
public void SetString(FdoCache cache, ITsString newValue, bool fDoUpdate)
{
if (m_ws == 0)
{
if (fDoUpdate)
cache.SetTsStringProperty(m_hvoTarget, m_flid, newValue);
else
cache.MainCacheAccessor.SetString(m_hvoTarget, m_flid, newValue);
}
else
{
if (fDoUpdate)
cache.SetMultiStringAlt(m_hvoTarget, m_flid, m_ws, newValue);
else
cache.MainCacheAccessor.SetMultiStringAlt(m_hvoTarget, m_flid, m_ws, newValue);
}
}
示例2: MakeEmptyStText
/// -----------------------------------------------------------------------------------
/// <summary>
/// Static method to create a new structured text. It creates an StText object owned by
/// hvoOwner in property tag, then creates an StTxtPara owned by the new StText. It
/// sets the contents of the paragraph to be an empty string in the specified writing system,
/// and Normal paragraph style.
/// </summary>
/// ENHANCE JohnT: probably we will identify styles by something other than name.
/// REVIEW JohnT(TomB): Are we supposed to be supplying a style name rather than just
/// using "Normal"?
///
/// <param name="cache">FieldWorks database access</param>
/// <param name="hvoOwner">id of object to own the new StText</param>
/// <param name="propTag">property (field) type of the new StText</param>
/// <param name="ws">language writing system of empty paragraph</param>
/// <returns>HVO of the newly created StText object</returns>
/// -----------------------------------------------------------------------------------
public static int MakeEmptyStText(FdoCache cache, int hvoOwner, int propTag, int ws)
{
// REVIEW TomB: Lastparm should really be null if Randy changes CreateObject.
// Response from RandyR: I changed CreateObject. Null should work for
// everything now.
// Most of this code could be moved into the FDO objects, if desired.
int hvoStText = cache.CreateObject(StText.kclsidStText, hvoOwner, propTag, 0);
int hvoPara = cache.CreateObject(StTxtPara.kclsidStTxtPara, hvoStText,
(int)StText.StTextTags.kflidParagraphs, 0);
// Set the style of the paragraph to Normal
ITsTextProps ttpNormal;
ITsPropsBldr tsPropsBldr = TsPropsBldrClass.Create();
tsPropsBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
StyleNames.ksNormal);
ttpNormal = tsPropsBldr.GetTextProps();
cache.MainCacheAccessor.SetUnknown(hvoPara,
(int)StPara.StParaTags.kflidStyleRules, ttpNormal);
// Set its contents to an empty string in the right writing system.
ITsStrFactory tsFactory = TsStrFactoryClass.Create();
cache.SetTsStringProperty(hvoPara, (int)StTxtPara.StTxtParaTags.kflidContents,
tsFactory.MakeStringRgch("", 0, ws));
return hvoStText;
}