本文整理汇总了C#中SIL.FieldWorks.FDO.FdoCache.GetFieldType方法的典型用法代码示例。如果您正苦于以下问题:C# FdoCache.GetFieldType方法的具体用法?C# FdoCache.GetFieldType怎么用?C# FdoCache.GetFieldType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.FDO.FdoCache
的用法示例。
在下文中一共展示了FdoCache.GetFieldType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateMultiAccessor
/// <summary>
/// Creates the appropriate string accessor to the given flid.
/// </summary>
/// <param name="cache"></param>
/// <param name="hvoOwner"></param>
/// <param name="flidOwning"></param>
/// <param name="sView">Class_Field to load from database (obsolete?)</param>
/// <returns></returns>
static public MultiAccessor CreateMultiAccessor(FdoCache cache, int hvoOwner, int flidOwning, string sView)
{
FieldType flidType = cache.GetFieldType(flidOwning);
switch (flidType)
{
case FieldType.kcptMultiUnicode:
case FieldType.kcptMultiBigUnicode:
return new MultiUnicodeAccessor(cache, hvoOwner, flidOwning, sView);
case FieldType.kcptMultiString:
case FieldType.kcptMultiBigString:
return new MultiStringAccessor(cache, hvoOwner, flidOwning, sView);
default:
return null;
}
}
示例2: MakeUi
/// <summary>
/// This is the ReferenceUi factory.
/// We currently exclude ReferenceSequenceUi (see that class for reason).
/// </summary>
/// <param name="cache"></param>
/// <param name="rootObj"></param>
/// <param name="referenceFlid"></param>
/// <param name="targetHvo"></param>
/// <returns></returns>
static public ReferenceBaseUi MakeUi(FdoCache cache, ICmObject rootObj,
int referenceFlid, int targetHvo)
{
FieldType iType = cache.GetFieldType(referenceFlid);
if (iType == FieldType.kcptReferenceSequence || iType == FieldType.kcptReferenceCollection)
return new VectorReferenceUi(cache, rootObj, referenceFlid, targetHvo);
else if (iType == FieldType.kcptReferenceAtom)
return new ReferenceBaseUi(cache, rootObj, referenceFlid, targetHvo);
return null;
}
示例3: VectorReferenceUi
public VectorReferenceUi(FdoCache cache, ICmObject rootObj, int referenceFlid, int targetHvo)
: base(cache, rootObj, referenceFlid, targetHvo)
{
m_iType = cache.GetFieldType(m_flid);
Debug.Assert(m_iType == FieldType.kcptReferenceSequence ||
m_iType == FieldType.kcptReferenceCollection);
}
示例4: StringsFor
/// <summary>
/// Returns an array of string values (keys) for the objects under this layout node.
/// </summary>
/// <param name="fdoCache"></param>
/// <param name="layout"></param>
/// <param name="hvo"></param>
/// <param name="layoutCache"></param>
/// <param name="caller">where layout is a component of a 'part' element, caller
/// is the 'part ref' that invoked it.</param>
/// <param name="stringTbl"></param>
/// <param name="wsForce">if non-zero, "string" elements are forced to use that writing system for multistrings.</param>
/// <returns></returns>
static public string[] StringsFor(FdoCache fdoCache, XmlNode layout, int hvo,
LayoutCache layoutCache, XmlNode caller, StringTable stringTbl, int wsForce)
{
// Some nodes are known to be uninteresting.
if (XmlVc.CanSkipNode(layout))
return new string[0]; // don't know how to sort, treat as empty key.
switch (layout.Name)
{
case "string":
{
int hvoTarget = hvo;
XmlVc.GetActualTarget(layout, ref hvoTarget, fdoCache); // modify the hvo if needed
if (hvo != hvoTarget)
{
return AddStringFromOtherObj(layout, hvoTarget, fdoCache);
}
int flid = GetFlid(fdoCache, layout, hvo);
if (wsForce != 0)
{
// If we are forcing a writing system, and it's a multistring, get the forced alternative.
int itype = fdoCache.MetaDataCacheAccessor.GetFieldType((uint)flid);
itype = itype & 0x1f; // strip virtual bit
switch (itype)
{
case (int) FieldType.kcptMultiUnicode:
case (int) FieldType.kcptMultiString:
case (int) FieldType.kcptMultiBigUnicode:
case (int) FieldType.kcptMultiBigString:
return new string[]
{fdoCache.MainCacheAccessor.get_MultiStringAlt(hvo, flid, wsForce).Text};
}
}
bool fFoundType;
string strValue = fdoCache.GetText(hvo, flid, layout, out fFoundType);
if (fFoundType)
{
return new string[] {strValue};
}
else
{
throw new Exception("Bad property type (" + strValue + " for hvo " + hvo +
" found for string property "
+ flid + " in " + layout.OuterXml);
}
}
case "configureMlString":
{
int flid = GetFlid(fdoCache, layout, hvo);
// The Ws info specified in the part ref node
Set<int> wsIds = LangProject.GetAllWritingSystems(caller, fdoCache, null, hvo, flid);
if (wsIds.Count == 1)
{
string strValue = fdoCache.MainCacheAccessor.get_MultiStringAlt(hvo, flid, wsIds.ToArray()[0]).Text;
return new string[] {strValue};
}
else
return new string[] {AddMultipleAlternatives(fdoCache, wsIds, hvo, flid, caller)};
}
case "multiling":
return ProcessMultiLingualChildren(fdoCache, layout, hvo, layoutCache, caller, stringTbl, wsForce);
case "layout":
// "layout" can occur when GetNodeToUseForColumn returns a phony 'layout'
// formed by unifying a layout with child nodes. Assemble its children.
// (arguably, we should treat that like div if current flow is a pile.
// but we can't tell that and it rarely makes a difference.)
case "para":
case "span":
{
return AssembleChildKeys(fdoCache, layout, hvo, layoutCache, caller, stringTbl, wsForce);
}
case "column":
// top-level node for whole column; concatenate children as for "para"
// if multipara is false, otherwise as for "div"
if (XmlUtils.GetOptionalBooleanAttributeValue(layout, "multipara", false))
return ChildKeys(fdoCache, layout, hvo, layoutCache, caller, stringTbl, wsForce);
else
return AssembleChildKeys(fdoCache, layout, hvo, layoutCache, caller, stringTbl, wsForce);
case "part":
{
string partref = XmlUtils.GetOptionalAttributeValue(layout, "ref");
if (partref == null)
return ChildKeys(fdoCache, layout, hvo, layoutCache, caller, stringTbl, wsForce); // an actual part, made up of its pieces
XmlNode part = XmlVc.GetNodeForPart(hvo, partref, false, fdoCache.MainCacheAccessor, layoutCache);
// This is the critical place where we introduce a caller. The 'layout' is really a 'part ref' which is the
// 'caller' for all embedded nodes in the called part.
return StringsFor(fdoCache, part, hvo, layoutCache, layout, stringTbl, wsForce);
//.........这里部分代码省略.........
示例5: AddStringFromOtherObj
internal static string[] AddStringFromOtherObj(XmlNode frag, int hvoTarget, FdoCache cache)
{
int flid = XmlVc.GetFlid(frag, hvoTarget, cache);
ITsStrFactory tsf = TsStrFactoryClass.Create();
FieldType itype = cache.GetFieldType(flid);
if ((itype == FieldType.kcptUnicode) ||
(itype == FieldType.kcptBigUnicode))
{
return new string[] {cache.GetUnicodeProperty(hvoTarget, flid)};
}
else if ((itype == FieldType.kcptString) ||
(itype == FieldType.kcptBigString))
{
return new string[] { cache.GetTsStringProperty(hvoTarget, flid).Text };
}
else // multistring of some type
{
int wsid = 0;
string sep = "";
if (s_cwsMulti > 1)
{
string sLabelWs = XmlUtils.GetOptionalAttributeValue(frag, "ws");
if (sLabelWs != null && sLabelWs == "current")
{
sep = DisplayMultiSep(frag, cache)
+ DisplayWsLabel(s_qwsCurrent, cache);
wsid = s_qwsCurrent.WritingSystem;
}
}
if (wsid == 0)
wsid = LangProject.GetWritingSystem(frag, cache, null, LangProject.kwsAnal);
if ((itype == FieldType.kcptMultiUnicode) ||
(itype == FieldType.kcptMultiBigUnicode))
{
return new string[] {sep, cache.GetMultiUnicodeAlt(hvoTarget, flid, wsid, null) };
}
else
{
return new string[] {sep, cache.GetMultiStringAlt(hvoTarget, flid, wsid).Text };
}
}
}
示例6: Synchronize
/// ------------------------------------------------------------------------------------
/// <summary>
/// Cycle through the applications main windows and synchronize them with database
/// changes.
/// </summary>
/// <param name="sync">synchronization information record</param>
/// <param name="cache">database cache</param>
/// <returns>false if a refreshall was performed or presync failed; this suppresses
/// subsequent sync messages. True to continue processing.</returns>
/// ------------------------------------------------------------------------------------
public virtual bool Synchronize(SyncInfo sync, FdoCache cache)
{
CheckDisposed();
if (m_suppressedCaches.ContainsKey(cache))
{
Queue<SyncInfo> messages = m_suppressedCaches[cache].Queue;
if (!messages.Contains(sync))
messages.Enqueue(sync);
return true;
}
cache.StoreSync(SyncGuid, sync);
if (sync.msg == SyncMsg.ksyncFullRefresh || sync.msg == SyncMsg.ksyncCustomField)
{
RefreshAllViews(cache);
return false;
}
foreach (IFwMainWnd wnd in MainWindows)
{
if (wnd.Cache == cache && !wnd.PreSynchronize(sync))
return false;
}
if (sync.msg == SyncMsg.ksyncWs)
{
// REVIEW TeTeam: AfLpInfo::Synchronize calls AfLpInfo::FullRefresh, which
// clears the cache, loads the styles, loads ws and updates wsf, load project
// basics, updates external link root, load overlays and refreshes possibility
// lists. I don't think we need to do any of these here.
RefreshAllViews(cache);
return false;
}
else if (sync.msg == SyncMsg.ksyncPromoteEntry)
{
// Review: Write code here to deal with this case. Look at
// AfLpInfo::Syncronize to see what's necessary.
// This would be relevant to an application that uses subentries (like Data Notebook--
// if it used FwApp).
}
else if (sync.msg == SyncMsg.ksyncSimpleEdit)
{
// Use the UpdatePropIfCached method to update anything that changed that we care about.
// Todo: need to get Synchronize called for each new syncinfo in DB on window activate.
IVwOleDbDa odd = cache.VwOleDbDaAccessor;
int hvo = sync.hvo;
int flid = sync.flid;
FieldType iType = cache.GetFieldType(flid);
switch(iType)
{
case FieldType.kcptMultiString:
case FieldType.kcptMultiUnicode:
case FieldType.kcptMultiBigString:
case FieldType.kcptMultiBigUnicode:
// Try all active WS to see if cached. (Pathologically, if some wss are used for both,
// they will be updated twice.)
foreach (int ws in cache.LangProject.VernWssRC.HvoArray)
odd.UpdatePropIfCached(hvo, flid, (int)iType, ws);
foreach (int ws in cache.LangProject.AnalysisWssRC.HvoArray)
odd.UpdatePropIfCached(hvo, flid, (int)iType, ws);
// This will usually prevent a double-update; pathologically, one might still happen
// if the user ws is in the analysis or vernacular lists but is not the first analysis one.
if (cache.DefaultUserWs != cache.DefaultAnalWs)
odd.UpdatePropIfCached(hvo, flid, (int)iType, cache.DefaultUserWs);
break;
case 0:
// This is very rare but possible. Do nothing since kcptNull is not a real data
// type, hence cannot have any data.
break;
default:
odd.UpdatePropIfCached(hvo, flid, (int)iType, 0);
break;
}
return true;
}
foreach (IFwMainWnd wnd in MainWindows)
{
if (wnd.Cache == cache && !wnd.Synchronize(sync))
{
// The window itself was not able to process the message successfully;
// play safe and refresh everything
RefreshAllViews(cache);
return false;
}
}
//.........这里部分代码省略.........