本文整理汇总了C#中SIL.FieldWorks.FDO.FdoCache.BeginUndoTask方法的典型用法代码示例。如果您正苦于以下问题:C# FdoCache.BeginUndoTask方法的具体用法?C# FdoCache.BeginUndoTask怎么用?C# FdoCache.BeginUndoTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.FDO.FdoCache
的用法示例。
在下文中一共展示了FdoCache.BeginUndoTask方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddToDatabase
public override void AddToDatabase(FdoCache cache)
{
CheckDisposed();
if (m_fInDatabase)
return; // It's already in the database, so nothing more can be done.
cache.BeginUndoTask(MGAStrings.ksUndoCreateInflectionFeature,
MGAStrings.ksRedoCreateInflectionFeature);
m_featDefn = FsFeatureSystem.AddFeatureAsXml(cache, m_node);
cache.EndUndoTask();
}
示例2: AddToDatabase
public override void AddToDatabase(FdoCache cache)
{
CheckDisposed();
if (m_fInDatabase)
return; // It's already in the database, so nothing more can be done.
string sType = XmlUtils.GetManditoryAttributeValue(m_node, "type");
if (sType == "feature")
{
cache.BeginUndoTask(MGAStrings.ksUndoCreatePhonologicalFeature,
MGAStrings.ksRedoCreatePhonologicalFeature);
ILangProject lp = cache.LangProject;
IFsFeatureSystem featsys = lp.PhFeatureSystemOA as IFsFeatureSystem;
// Since phonological features in the chooser only have features and no values,
// we need to create the positive and negative value nodes
string sName = XmlUtils.GetManditoryAttributeValue(m_node, "id");
const string sTemplate =
"<item id='v{0}Positive' type='value'><abbrev ws='en'>+</abbrev><term ws='en'>positive</term>" +
"<fs id='v{0}PositiveFS' type='Phon'><f name='{0}'><sym value='+'/></f></fs></item>" +
"<item id='v{0}Negative' type='value'><abbrev ws='en'>-</abbrev><term ws='en'>negative</term>" +
"<fs id='v{0}NegativeFS' type='Phon'><f name='{0}'><sym value='-'/></f></fs></item>";
StringBuilder sb = new StringBuilder();
sb.AppendFormat(sTemplate, sName.Substring(1));
m_node.InnerXml += sb.ToString();
// have to use a ndw document or, for some odd reason, it keeps on using an old value and not the new one...
XmlDocument doc = new XmlDocument();
doc.LoadXml(m_node.OuterXml);
// add positive value; note that the FsFeatDefn will be the same for both
XmlNode valueNode = doc.SelectSingleNode("//item[contains(@id,'Positive')]");
m_featDefn = FsFeatureSystem.AddFeatureAsXml(cache, featsys, valueNode);
// add negative value
valueNode = doc.SelectSingleNode("//item[contains(@id,'Negative')]");
m_featDefn = FsFeatureSystem.AddFeatureAsXml(cache, featsys, valueNode);
cache.EndUndoTask();
}
}
示例3: Init
public void Init()
{
CheckDisposed();
m_builder = new DummySFFileListBuilder();
m_cache = FdoCache.Create("TestLangProj");
if (!m_cache.DatabaseAccessor.IsTransactionOpen())
m_cache.DatabaseAccessor.BeginTrans();
m_cache.BeginUndoTask("Undo SfFileListBuilderTest", "Redo SfFileListBuilderTest");
m_settings = new ScrImportSet();
m_cache.LangProject.TranslatedScriptureOA.DefaultImportSettings = m_settings;
}
示例4: 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;
}
示例5: AddToDatabase
public void AddToDatabase(FdoCache cache, ICmPossibilityList posList, MasterCategory parent, IPartOfSpeech subItemOwner)
{
CheckDisposed();
if (m_pos != null)
return; // It's already in the database, so nothing more can be done.
cache.BeginUndoTask(LexTextControls.ksUndoCreateCategory,
LexTextControls.ksRedoCreateCategory);
int newOwningFlid;
int insertLocation;
int newOwner =
DeterminePOSLocationInfo(subItemOwner, parent, posList, out newOwningFlid, out insertLocation);
ILgWritingSystemFactory wsf = cache.LanguageWritingSystemFactoryAccessor;
Debug.Assert(m_pos != null);
if (m_node == null)
{ // should not happen, but just in case... we still get something useful
m_pos.Name.SetAlternative(m_term, wsf.GetWsFromStr(m_termWs));
m_pos.Abbreviation.SetAlternative(m_abbrev, wsf.GetWsFromStr(m_abbrevWs));
m_pos.Description.SetAlternative(m_def, wsf.GetWsFromStr(m_defWs));
}
else
{
SetContentFromNode(cache, "abbrev", false, m_pos.Abbreviation);
SetContentFromNode(cache, "term", true, m_pos.Name);
SetContentFromNode(cache, "def", false, m_pos.Description);
}
m_pos.CatalogSourceId = m_id;
// Need a PropChanged, since it isn't done in the 'Append' for some reason.
cache.PropChanged(null, PropChangeType.kpctNotifyAll,
newOwner, newOwningFlid, insertLocation, 1, 0);
cache.EndUndoTask();
}
示例6: Init
public void Init()
{
CheckDisposed();
m_cache = FdoCache.Create("TestLangProj");
if (!m_cache.DatabaseAccessor.IsTransactionOpen())
m_cache.DatabaseAccessor.BeginTrans();
m_cache.BeginUndoTask("Undo ScrImportSetTest", "Redo ScrImportSetTest");
m_Scripture = m_cache.LangProject.TranslatedScriptureOA;
m_settings = new ScrImportSet();
m_Scripture.DefaultImportSettings = m_settings;
m_styleSheet = new FwStyleSheet();
m_styleSheet.Init(m_cache, m_Scripture.Hvo,
(int)Scripture.ScriptureTags.kflidStyles);
foreach (ILgWritingSystem ws in m_cache.LanguageEncodings)
{
if (ws.ICULocale != null && ws.ICULocale.ToLower() == "de")
ws.LegacyMapping = kGermanLegacyMapping;
if (ws.ICULocale == m_cache.LangProject.DefaultAnalysisWritingSystemICULocale)
ws.LegacyMapping = kDummyAnalLegacyMapping;
if (ws.ICULocale == m_cache.LangProject.DefaultVernacularWritingSystemICULocale)
ws.LegacyMapping = kDummyVernLegacyMapping;
}
m_DummyImportWizard = new DummyImportWizard(m_cache, (Scripture)m_Scripture, m_styleSheet);
m_DummyImportWizard.Show();
Application.DoEvents();
}