本文整理汇总了C#中SIL.FieldWorks.FDO.FdoCache.GetTimeProperty方法的典型用法代码示例。如果您正苦于以下问题:C# FdoCache.GetTimeProperty方法的具体用法?C# FdoCache.GetTimeProperty怎么用?C# FdoCache.GetTimeProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.FDO.FdoCache
的用法示例。
在下文中一共展示了FdoCache.GetTimeProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StringsFor
//.........这里部分代码省略.........
}
case "seq":
{
// Follow the property. For each object, look up the layout to use,
// invoke recursively, concatenate
int flid = GetFlid(fdoCache, layout, hvo);
int ctarget = fdoCache.MainCacheAccessor.get_VecSize(hvo, flid);
string[] result = null;
string targetLayoutName = XmlVc.GetLayoutName(layout, caller); // also allows for finding "param" attr in caller, if not null
//string targetLayoutName = XmlUtils.GetOptionalAttributeValue(layout, "layout");
for(int i = 0; i < ctarget; i++)
{
int hvoTarget = fdoCache.MainCacheAccessor.get_VecItem(hvo, flid, i);
int prevResultLength = GetArrayLength(result);
XmlNode layoutTarget = GetLayoutNodeForChild(fdoCache, hvoTarget, flid, targetLayoutName, layout, layoutCache);
if (layoutTarget == null)
continue; // should not happen, but best recovery we can make
result = Concatenate(result, ChildKeys(fdoCache, layoutTarget, hvoTarget, layoutCache, caller, stringTbl, wsForce));
// add a separator between the new childkey group and the previous childkey group
if (i > 0 && prevResultLength != GetArrayLength(result) && prevResultLength > 0)
{
int ichIns = 0;
if (result[prevResultLength - 1] != null)
ichIns = result[prevResultLength - 1].Length;
AddSeparator(ref result[prevResultLength - 1], ichIns, layout);
}
}
return result;
}
case "choice":
{
foreach(XmlNode whereNode in layout.ChildNodes)
{
if (whereNode.Name != "where")
{
if (whereNode.Name == "otherwise")
return StringsFor(fdoCache, XmlUtils.GetFirstNonCommentChild(whereNode), hvo, layoutCache, caller, stringTbl, wsForce);
continue; // ignore any other nodes,typically comments
}
// OK, it's a where node.
if (XmlVc.ConditionPasses(whereNode, hvo, fdoCache, caller))
return StringsFor(fdoCache, XmlUtils.GetFirstNonCommentChild(whereNode), hvo, layoutCache, caller, stringTbl, wsForce);
}
break; // if no condition passes and no otherwise, return null.
}
case "if":
{
if (XmlVc.ConditionPasses(layout, hvo, fdoCache, caller))
return StringsFor(fdoCache, XmlUtils.GetFirstNonCommentChild(layout), hvo, layoutCache, caller, stringTbl, wsForce);
break;
}
case "ifnot":
{
if (!XmlVc.ConditionPasses(layout, hvo, fdoCache, caller))
return StringsFor(fdoCache, XmlUtils.GetFirstNonCommentChild(layout), hvo, layoutCache, caller, stringTbl, wsForce);
break;
}
case "lit":
{
string literal = layout.InnerText;
if (stringTbl != null)
{
string sTranslate = XmlUtils.GetOptionalAttributeValue(layout, "translate", "");
if (sTranslate.Trim().ToLower() != "do not translate")
literal = stringTbl.LocalizeLiteralValue(literal);
}
return new string[] { literal };
}
case "int":
{
int flid = GetFlid(fdoCache, layout, hvo);
int val = fdoCache.MainCacheAccessor.get_IntProp(hvo, flid);
return new string[] {XmlViewsUtils.AlphaCompNumberString(val)};
}
case "datetime":
{
int flid = GetFlid(fdoCache, layout, hvo);
FieldType itype = fdoCache.GetFieldType(flid);
if (itype == FieldType.kcptTime)
{
DateTime dt = fdoCache.GetTimeProperty(hvo, flid);
return new string[] {XmlViewsUtils.DateTimeCompString(dt)};
}
else
{
string stFieldName = XmlUtils.GetManditoryAttributeValue(layout, "field");
throw new Exception("Bad field type (" + stFieldName + " for hvo " + hvo + " found for " +
layout.Name + " property " + flid + " in " + layout.OuterXml);
}
}
case "picture":
// Treat a picture as a non-empty string for purposes of deciding whether something is empty.
// This string seems as good as anything for other purposes.
return new string[] {"a picture"};
default: // unknown or comment node, adds nothing
Debug.Assert(false, "unrecognized XML node.");
break;
}
return new string[0]; // don't know how to sort, treat as empty key.
}