private static void CreateAnalysisForWord(string word, ISegment segment, int ws, bool fCreateGlosses) { FdoCache cache = segment.Cache; IWfiWordformFactory wfFactory = cache.ServiceLocator.GetInstance <IWfiWordformFactory>(); IWfiWordformRepository wfRepo = cache.ServiceLocator.GetInstance <IWfiWordformRepository>(); IWfiGlossFactory glossFactory = cache.ServiceLocator.GetInstance <IWfiGlossFactory>(); IWfiAnalysisFactory wfiAnalysisFactory = cache.ServiceLocator.GetInstance <IWfiAnalysisFactory>(); ITsString tssForm = cache.TsStrFactory.MakeString(word, cache.DefaultVernWs); IWfiWordform form; IAnalysis analysis; if (wfRepo.TryGetObject(tssForm, out form)) { analysis = (fCreateGlosses) ? (IAnalysis)form.AnalysesOC.First().MeaningsOC.First() : form; } else { analysis = form = wfFactory.Create(tssForm); IWfiAnalysis actualWfiAnalysis = wfiAnalysisFactory.Create(); form.AnalysesOC.Add(actualWfiAnalysis); if (fCreateGlosses) { IWfiGloss gloss = glossFactory.Create(); actualWfiAnalysis.MeaningsOC.Add(gloss); gloss.Form.set_String(ws, "G" + word + "g"); analysis = gloss; } } segment.AnalysesRS.Add(analysis); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Create test data for tests. /// </summary> /// ------------------------------------------------------------------------------------ protected override void CreateTestData() { m_servloc = Cache.ServiceLocator; m_text = AddInterlinearTextToLangProj("My Interlinear Text"); m_stTextPara = AddParaToInterlinearTextContents(m_text, "Here is a sentence I can chart."); m_stText = m_text.ContentsOA; m_rowFact = m_servloc.GetInstance <IConstChartRowFactory>(); m_wordGrpFact = m_servloc.GetInstance <IConstChartWordGroupFactory>(); m_possFact = m_servloc.GetInstance <ICmPossibilityFactory>(); m_wfiFact = m_servloc.GetInstance <IWfiWordformFactory>(); m_mtMrkrFact = m_servloc.GetInstance <IConstChartMovedTextMarkerFactory>(); m_clsMrkrFact = m_servloc.GetInstance <IConstChartClauseMarkerFactory>(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Create test data for tests. /// </summary> /// ------------------------------------------------------------------------------------ protected override void CreateTestData() { m_servloc = Cache.ServiceLocator; m_text = AddInterlinearTextToLangProj("My Interlinear Text"); m_stTextPara = AddParaToInterlinearTextContents(m_text, "Here is a sentence I can chart."); m_stText = m_text.ContentsOA; m_tssFact = Cache.TsStrFactory; m_rowFact = m_servloc.GetInstance<IConstChartRowFactory>(); m_wordGrpFact = m_servloc.GetInstance<IConstChartWordGroupFactory>(); m_possFact = m_servloc.GetInstance<ICmPossibilityFactory>(); m_wfiFact = m_servloc.GetInstance<IWfiWordformFactory>(); m_mtMrkrFact = m_servloc.GetInstance<IConstChartMovedTextMarkerFactory>(); m_clsMrkrFact = m_servloc.GetInstance<IConstChartClauseMarkerFactory>(); }
/// <summary> /// Set up some common data /// </summary> public override void TestSetup() { base.TestSetup(); m_wfiFactory = Cache.ServiceLocator.GetInstance <IWfiWordformFactory>(); m_progress = new DummyProgressDlg(); }
/// <summary> /// Set variable to null; /// </summary> public override void FixtureTeardown() { m_wordFormFactory = null; base.FixtureTeardown(); }
/// <summary> /// /// </summary> public override void FixtureSetup() { base.FixtureSetup(); m_wordFormFactory = Cache.ServiceLocator.GetInstance<IWfiWordformFactory>(); var servLoc = Cache.ServiceLocator; NonUndoableUnitOfWorkHelper.Do(m_actionHandler, () => { Cache.LanguageProject.PeopleOA = servLoc.GetInstance<ICmPossibilityListFactory>().Create(); Cache.LanguageProject.PeopleOA.PossibilitiesOS.Add(servLoc.GetInstance<ICmPersonFactory>().Create()); // force Scripture reference system to be created - along with TranslatedScriptureOA Cache.LangProject.TranslatedScriptureOA = servLoc.GetInstance<IScriptureFactory>().Create(); }); m_uowService = Cache.ServiceLocator.GetInstance<IUnitOfWorkService>(); }
/// <summary> /// Set up some common data /// </summary> public override void TestSetup() { base.TestSetup(); m_wfiFactory = Cache.ServiceLocator.GetInstance<IWfiWordformFactory>(); m_progress = new ProgressBarWrapper(new ProgressBar()); }
private void Init(FdoCache cache) { m_cache = cache; m_paragraphTextScanner = new WordMaker(null, cache.WritingSystemFactory); m_wfr = m_cache.ServiceLocator.GetInstance<IWfiWordformRepository>(); m_wordfactory = m_cache.ServiceLocator.GetInstance<IWfiWordformFactory>(); m_cbaf = m_cache.ServiceLocator.GetInstance<ICmBaseAnnotationFactory>(); m_cbar = m_cache.ServiceLocator.GetInstance<ICmBaseAnnotationRepository>(); }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected virtual void Dispose(bool disposing) { System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); // Must not be run more than once. if (m_isDisposed) return; if (disposing) { if (RebuildingConcordanceWordforms) RebuildingConcordanceWordforms = false; // don't get rid of m_wfi until we do this. } m_wordformAnnotationPossibilities = null; m_paragraphTextScanner = null; m_wordfactory = null; m_wfr = null; m_cbaf = null; m_cbar = null; m_wordMaker = null; m_tssPara = null; m_para = null; m_cache = null; m_isDisposed = true; }
/// <summary> /// Set up some common data /// </summary> public override void TestSetup() { base.TestSetup(); m_wfiFactory = Cache.ServiceLocator.GetInstance<IWfiWordformFactory>(); m_progress = new DummyProgressDlg(); }