本文整理汇总了C#中SIL.FieldWorks.FDO.FdoCache.EnableBulkLoadingIfPossible方法的典型用法代码示例。如果您正苦于以下问题:C# FdoCache.EnableBulkLoadingIfPossible方法的具体用法?C# FdoCache.EnableBulkLoadingIfPossible怎么用?C# FdoCache.EnableBulkLoadingIfPossible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.FDO.FdoCache
的用法示例。
在下文中一共展示了FdoCache.EnableBulkLoadingIfPossible方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup
public void Setup()
{
string sBackupFile = UnzipBackup();
RestoreDbBackup(sBackupFile, "FlexChorusTest");
// now, create the data cache for the test project.
Dictionary<string, string> cacheOptions = new Dictionary<string, string>();
cacheOptions.Add("c", MiscUtils.LocalServerName);
cacheOptions.Add("db", "FlexChorusTest");
m_cache = FdoCache.Create(cacheOptions);
Debug.Assert(m_cache != null);
m_cache.EnableBulkLoadingIfPossible(true);
InstallVirtuals(@"Language Explorer\Configuration\Main.xml",
new string[] { "SIL.FieldWorks.FDO.", "SIL.FieldWorks.IText." });
}
示例2: LoadSections
/// <summary>
/// Load sections into the books of a scripture tree view optionally including the
/// heading as well as the content of each section.
/// </summary>
/// <param name="cache"></param>
/// <param name="fIncludeHeadings"></param>
public void LoadSections(FdoCache cache, bool fIncludeHeadings)
{
try
{
cache.EnableBulkLoadingIfPossible(true);
// first load the book ids.
this.Nodes.Clear();
this.LoadBooks(cache);
TreeNode bibleNode;
if (this.Nodes.Count == 1)
{
bibleNode = this.Nodes[0];
}
else if (this.Nodes.Count > 0)
{
throw new ArgumentException("We should only have 1 Bible node, not " + this.Nodes.Count);
}
else
return;
if (cache.LangProject.TranslatedScriptureOA == null)
return;
Scripture scripture = cache.LangProject.TranslatedScriptureOA as Scripture;
foreach (TreeNode testament in bibleNode.Nodes)
{
foreach (TreeNode bookNode in testament.Nodes)
{
IScrBook book = ScrBook.CreateFromDBObject(cache, (int)bookNode.Tag) as IScrBook;
// Add Title node.
if (book.TitleOAHvo != 0)
{
TreeNode titleNode =
new TreeNode(ResourceHelper.GetResourceString("kstidScriptureTitle"));
titleNode.Name = book.TitleOAHvo.ToString();
titleNode.Tag = book.TitleOAHvo;
bookNode.Nodes.Add(titleNode);
}
// Add Sections.
foreach (IScrSection section in book.SectionsOS)
{
string chapterVerseBridge = scripture.ChapterVerseBridgeAsString(section);
if (fIncludeHeadings && section.HeadingOAHvo != 0)
{
// Include the heading text if it's not empty. See LT-8764.
int cTotal = 0;
foreach (IStTxtPara para in section.HeadingOA.ParagraphsOS)
cTotal += para.Contents.Length;
if (cTotal > 0)
{
string sFmt = ResourceHelper.GetResourceString("kstidSectionHeading");
TreeNode node = new TreeNode(String.Format(sFmt, chapterVerseBridge));
node.Name = String.Format(sFmt, section.Hvo.ToString());
node.Tag = section.HeadingOAHvo; // expect an StText
bookNode.Nodes.Add(node);
}
}
TreeNode sectionNode =
new TreeNode(chapterVerseBridge);
sectionNode.Name = section.Hvo.ToString();
sectionNode.Tag = section.ContentOAHvo; // expect an StText
bookNode.Nodes.Add(sectionNode);
}
// Add Footnotes in reverse order, so we can insert them in the proper order.
List<IStFootnote> footnotes = new List<IStFootnote>(book.FootnotesOS);
footnotes.Reverse();
foreach (IStFootnote footnote in footnotes)
{
ScrFootnote scrFootnote = footnote as ScrFootnote;
if (scrFootnote == null)
scrFootnote = new ScrFootnote(cache, footnote.Hvo);
// insert under the relevant section, if any (LTB-408)
int hvoContainingObj;
if (scrFootnote.TryGetContainingSectionHvo(out hvoContainingObj) ||
scrFootnote.TryGetContainingTitle(out hvoContainingObj))
{
string nodeName = scripture.ContainingRefAsString(scrFootnote);
TreeNode footnoteNode = new TreeNode(nodeName);
footnoteNode.Tag = footnote.Hvo;
footnoteNode.Name = "Footnote";
// see if we can lookup the node of this section.
int nodeIndex = bookNode.Nodes.IndexOfKey(hvoContainingObj.ToString());
//TreeNode[] sectionNodes = bookNode.Nodes.Find(hvoSection.ToString(), false);
//if (sectionNodes != null && sectionNodes.Length > 0)
if (nodeIndex >= 0)
bookNode.Nodes.Insert(nodeIndex + 1, footnoteNode);
else
bookNode.Nodes.Add(footnoteNode); // insert at end.
}
}
}
//.........这里部分代码省略.........
示例3: LoadBooks
/// <summary>
/// Load ScrBooks into the scripture tree view.
/// </summary>
/// <param name="cache"></param>
public void LoadBooks(FdoCache cache)
{
if (cache.LangProject.TranslatedScriptureOA == null)
return;
try
{
cache.EnableBulkLoadingIfPossible(true);
List<TreeNode> otBooks = new List<TreeNode>();
List<TreeNode> ntBooks = new List<TreeNode>();
foreach (IScrBook book in cache.LangProject.TranslatedScriptureOA.ScriptureBooksOS)
{
TreeNode node = new TreeNode((book.BookIdRA as ScrBookRef).UIBookName);
node.Tag = book.Hvo;
node.Name = "Book"; // help us query for books.
if (book.CanonicalNum < Scripture.kiNtMin)
otBooks.Add(node);
else
ntBooks.Add(node);
}
TreeNode bibleNode = new TreeNode(ScrControls.kstidBibleNode);
if (otBooks.Count > 0)
{
TreeNode testamentNode = new TreeNode(ScrControls.kstidOtNode,
otBooks.ToArray());
testamentNode.Name = "Testament"; // help us query for Testaments
bibleNode.Nodes.Add(testamentNode);
}
if (ntBooks.Count > 0)
{
TreeNode testamentNode = new TreeNode(ScrControls.kstidNtNode,
ntBooks.ToArray());
testamentNode.Name = "Testament"; // help us query for Testaments
bibleNode.Nodes.Add(testamentNode);
}
this.Nodes.Add(bibleNode);
}
finally
{
cache.EnableBulkLoadingIfPossible(false);
}
}