本文整理汇总了C#中SIL.FieldWorks.FDO.FdoCache.CreateObject方法的典型用法代码示例。如果您正苦于以下问题:C# FdoCache.CreateObject方法的具体用法?C# FdoCache.CreateObject怎么用?C# FdoCache.CreateObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.FDO.FdoCache
的用法示例。
在下文中一共展示了FdoCache.CreateObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CmPicture
/// ------------------------------------------------------------------------------------
/// <summary>
/// Create a new picture, given a text representation (e.g., from the clipboard).
/// NOTE: The caption is put into the default vernacular writing system.
/// </summary>
/// <param name="fcCache">FDO cache</param>
/// <param name="sTextRepOfPicture">Clipboard representation of a picture</param>
/// <param name="sFolder">The name of the CmFolder where picture should be stored</param>
/// <param name="anchorLoc">The anchor location that can be used to determine (may be 0).</param>
/// <param name="locationParser">The picture location parser (can be null).</param>
/// ------------------------------------------------------------------------------------
public CmPicture(FdoCache fcCache, string sTextRepOfPicture, string sFolder,
int anchorLoc, IPictureLocationBridge locationParser)
: base(fcCache, fcCache.CreateObject(CmPicture.kclsidCmPicture))
{
string[] tokens = sTextRepOfPicture.Split(new char[] {'|'});
if (tokens.Length < 9 || tokens[0] != "CmPicture")
throw new ArgumentException("The clipboard format for a Picture was invalid");
string sDescription = tokens[1];
string srcFilename = tokens[2];
string sLayoutPos = tokens[3];
string sLocationRange = tokens[4];
string sCopyright = tokens[5];
string sCaption = tokens[6];
string sLocationRangeType = tokens[7];
string sScaleFactor = tokens[8];
PictureLocationRangeType locRangeType = ParseLocationRangeType(sLocationRangeType);
InitializeNewPicture(sFolder, anchorLoc, locationParser, sDescription,
srcFilename, sLayoutPos, sLocationRange, sCopyright, sCaption,
locRangeType, sScaleFactor);
}
示例2: CreateEntry
/// ------------------------------------------------------------------------------------
/// <summary>
/// Create a new entry.
/// The caller is expected to call PropChanged on the cache to notify the record
/// list of the new record.
/// </summary>
/// <param name="cache">The cache.</param>
/// <param name="morphType">Type of the morph.</param>
/// <param name="tssLexemeForm">The TSS lexeme form.</param>
/// <param name="gloss">The gloss.</param>
/// <param name="dummyMSA">The dummy MSA.</param>
/// <returns></returns>
/// ------------------------------------------------------------------------------------
public static ILexEntry CreateEntry(FdoCache cache, IMoMorphType morphType,
ITsString tssLexemeForm, string gloss, DummyGenericMSA dummyMSA)
{
using (new UndoRedoTaskHelper(cache, Strings.ksUndoCreateEntry, Strings.ksRedoCreateEntry))
{
ILexEntry entry = null;
// NO: Since this fires a PropChanged, and we do it ourselves later on.
// entry = (LexEntry)entries.Add(new LexEntry());
// CreateObject creates the entry without a PropChanged.
int entryHvo = cache.CreateObject(LexEntry.kClassId,
cache.LangProject.LexDbOAHvo,
(int)LexDb.LexDbTags.kflidEntries,
0); // 0 is fine, since the entries prop is not a sequence.
entry = LexEntry.CreateFromDBObject(cache, entryHvo);
ILexSense sense = LexSense.CreateSense(entry, dummyMSA, gloss);
if (morphType.Guid.ToString() == MoMorphType.kguidMorphCircumfix)
{
// Set Lexeme form to lexeme form and circumfix
SetCircumfixLexemeForm(cache, entry, tssLexemeForm, morphType);
// Create two allomorphs, one for the left member and one for the right member.
SplitCircumfixIntoLeftAndRightAllomorphs(cache, entry, tssLexemeForm, sense);
}
else
{
IMoForm allomorph = MoForm.CreateAllomorph(entry, sense.MorphoSyntaxAnalysisRA, tssLexemeForm, morphType, true);
}
(entry as LexEntry).UpdateHomographNumbersAccountingForNewEntry();
return entry;
}
}
示例3: SetCircumfixLexemeForm
static private void SetCircumfixLexemeForm(FdoCache cache, ILexEntry entry, ITsString tssLexemeForm, IMoMorphType morphType)
{
int iHvo = cache.CreateObject(MoAffixAllomorph.kClassId, entry.Hvo, (int)LexEntry.LexEntryTags.kflidLexemeForm, 0);
MoAffixAllomorph lexemeAllo = new MoAffixAllomorph(cache, iHvo);
lexemeAllo.Form.SetAlternativeTss(tssLexemeForm);
lexemeAllo.MorphTypeRA = morphType;
lexemeAllo.IsAbstract = true;
}
示例4: CreateUnownedIndirectAnnotation
/// <summary>
/// This should be the preferred way to create CmBaseAnnotations that ought not to be owned:
/// currently Wfics, Pfics, paragraph segments, free translations, literal translations, and notes.
/// </summary>
/// <param name="cache"></param>
/// <returns></returns>
public static ICmIndirectAnnotation CreateUnownedIndirectAnnotation(FdoCache cache)
{
int hvoNew = cache.CreateObject(kclsidCmIndirectAnnotation);
return
CmObject.CreateFromDBObject(cache, hvoNew, typeof(CmIndirectAnnotation), false, false) as
ICmIndirectAnnotation;
}
示例5: DefaultCreateNewUiObject
internal static CmObjectUi DefaultCreateNewUiObject(uint classId, int hvoOwner, int flid, int insertionPosition, FdoCache cache)
{
CmObjectUi newUiObj;
cache.BeginUndoTask(FdoUiStrings.ksUndoInsert, FdoUiStrings.ksRedoInsert);
int newHvo = cache.CreateObject((int)classId, hvoOwner, flid, insertionPosition);
newUiObj = CmObjectUi.MakeUi(cache, newHvo, classId);
cache.EndUndoTask();
cache.MainCacheAccessor.PropChanged(null, (int)PropChangeType.kpctNotifyAll, hvoOwner, flid, insertionPosition, 1, 0);
return newUiObj;
}
示例6: 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;
}
示例7: InitNew
/// ------------------------------------------------------------------------------------
///<summary>
///Initialize a new ownerless FDO object,
///based on a newly created database object.
///Override this method to perform additional initialization.
///</summary>
/// <param name="fcCache">The FDO cache object.</param>
/// ------------------------------------------------------------------------------------
protected internal virtual void InitNew(FdoCache fcCache)
{
Debug.Assert(fcCache != null);
Debug.Assert(m_hvo == (int)SpecialHVOValues.kHvoOwnerPending);
m_hvo = fcCache.CreateObject(ClassID);
m_cache = fcCache;
Debug.Assert(m_hvo > 0);
}