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(); }
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(); } }
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; }
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; }
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(); }
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(); }