/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { // Must not be run more than once. if (IsDisposed) return; if (disposing) { if (components != null) { components.Dispose(); } if (m_fdoCache != null) m_fdoCache.DomainDataByFlid.RemoveNotification(this); } m_vc = null; m_msa = null; base.Dispose(disposing); }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; base.Dispose(disposing); if (disposing) { if (components != null) { components.Dispose(); } if (m_vc != null) m_vc.Dispose(); } m_vc = null; m_msa = null; }
/// <summary/> protected virtual void Dispose(bool fDisposing) { System.Diagnostics.Debug.WriteLineIf(!fDisposing, "****** Missing Dispose() call for " + GetType().ToString() + " *******"); if (fDisposing && !IsDisposed) { // dispose managed and unmanaged objects // Dispose managed resources here. if (m_WsList != null) m_WsList.Dispose(); TsStringUtils.ReassignTss(ref m_tssMissingAnalysis, null); TsStringUtils.ReassignTss(ref m_tssMissingGloss, null); TsStringUtils.ReassignTss(ref m_tssEmptyAnalysis, null); TsStringUtils.ReassignTss(ref m_tssEmptyVern, null); TsStringUtils.ReassignTss(ref m_tssEmptyPara, null); TsStringUtils.ReassignTss(ref m_tssSpace, null); TsStringUtils.ReassignTss(ref m_tssCommaSpace, null); if (m_tsf != null) Marshal.ReleaseComObject(m_tsf); } // Dispose unmanaged resources here, whether disposing is true or false. m_msaVc = null; m_cache = null; m_tssMissingMorph = null; // Same as m_tssMissingAnalysis. m_tssMissingSense = null; // Same as m_tssMissingGloss. m_tssMissingMsa = null; // Same as m_tssMissingGloss. m_tssMissingAnalysisPos = null; // Same as m_tssMissingGloss. m_tssMissingEntry = null; // Same as m_tssEmptyAnalysis. m_tsf = null; m_WsList = null; IsDisposed = true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="InterlinVc"/> class. /// </summary> /// <remarks>We use the default analysis writing system as the default, even though /// this view displays data in multiple writing systems. It's pretty arbitrary in this /// case, but we need a valid WS because if we get an ORC, we have to create a Ts String /// using some writing system.</remarks> /// <param name="cache">The cache.</param> /// ------------------------------------------------------------------------------------ public InterlinVc(FdoCache cache) : base(cache.DefaultAnalWs) { Cache = cache; m_wsManager = m_cache.ServiceLocator.WritingSystemManager; m_segRepository = m_cache.ServiceLocator.GetInstance<ISegmentRepository>(); m_coRepository = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>(); m_wmbRepository = m_cache.ServiceLocator.GetInstance<IWfiMorphBundleRepository>(); m_analRepository = m_cache.ServiceLocator.GetInstance<IWfiAnalysisRepository>(); StTxtParaRepository = m_cache.ServiceLocator.GetInstance<IStTxtParaRepository>(); m_wsAnalysis = cache.DefaultAnalWs; m_wsUi = cache.LanguageWritingSystemFactoryAccessor.UserWs; Decorator = new InterlinViewDataCache(m_cache); PreferredVernWs = cache.DefaultVernWs; m_selfFlid = m_cache.MetaDataCacheAccessor.GetFieldId2(CmObjectTags.kClassId, "Self", false); m_tssMissingGloss = m_tsf.MakeString(ITextStrings.ksStars, m_wsAnalysis); m_tssMissingGlossPrepend = m_tsf.MakeString(ITextStrings.ksStars + MorphServices.kDefaultSeparatorLexEntryInflTypeGlossAffix, m_wsAnalysis); m_tssMissingGlossAppend = m_tsf.MakeString(MorphServices.kDefaultSeparatorLexEntryInflTypeGlossAffix + ITextStrings.ksStars, m_wsAnalysis); m_tssMissingSense = m_tssMissingGloss; m_tssMissingMsa = m_tssMissingGloss; m_tssMissingAnalysisPos = m_tssMissingGloss; m_tssEmptyAnalysis = m_tsf.MakeString("", m_wsAnalysis); m_WsList = new WsListManager(m_cache); m_tssEmptyPara = m_tsf.MakeString(ITextStrings.ksEmptyPara, m_wsAnalysis); m_tssSpace = m_tsf.MakeString(" ", m_wsAnalysis); m_msaVc = new MoMorphSynAnalysisUi.MsaVc(m_cache); m_vernWss = WritingSystemServices.GetAllWritingSystems(m_cache, "all vernacular", null, 0, 0); // This usually gets overridden, but ensures default behavior if not. m_lineChoices = InterlinLineChoices.DefaultChoices(m_cache.LangProject, WritingSystemServices.kwsVernInParagraph, WritingSystemServices.kwsAnal); // This used to be a constant but was made variables with dummy virtual handlers so that // ClearInfoAbout can clear them out. // load guesses ktagSegmentForms = SegmentTags.kflidAnalyses; GetSegmentLevelTags(cache); LangProjectHvo = m_cache.LangProject.Hvo; }
/// <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 override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; if (disposing) { // Dispose managed resources here. if (m_WsList != null) m_WsList.Dispose(); if (m_msaVc != null) m_msaVc.Dispose(); } // Dispose unmanaged resources here, whether disposing is true or false. m_msaVc = null; m_cache = null; m_tssMissingMorph = null; // Same as m_tssMissingAnalysis. StringUtils.ReassignTss(ref m_tssMissingAnalysis, null); m_tssMissingSense = null; // Same as m_tssMissingGloss. m_tssMissingMsa = null; // Same as m_tssMissingGloss. m_tssMissingAnalysisPos = null; // Same as m_tssMissingGloss. StringUtils.ReassignTss(ref m_tssMissingGloss, null); m_tssMissingEntry = null; // Same as m_tssEmptyAnalysis. StringUtils.ReassignTss(ref m_tssEmptyAnalysis, null); StringUtils.ReassignTss(ref m_tssEmptyVern, null); StringUtils.ReassignTss(ref m_tssEmptyPara, null); StringUtils.ReassignTss(ref m_tssSpace, null); Marshal.ReleaseComObject(m_tsf); m_tsf = null; StringUtils.ReassignTss(ref m_tssCommaSpace, null); m_WsList = null; base.Dispose(disposing); }
public InterlinVc(FdoCache cache) { m_cache = cache; m_wsAnalysis = cache.LangProject.DefaultAnalysisWritingSystem; m_wsUi = cache.LanguageWritingSystemFactoryAccessor.UserWs; PreferredVernWs = cache.LangProject.DefaultVernacularWritingSystem; m_tssMissingGloss = m_tsf.MakeString(ITextStrings.ksStars, m_wsAnalysis); m_tssMissingSense = m_tssMissingGloss; m_tssMissingMsa = m_tssMissingGloss; m_tssMissingAnalysisPos = m_tssMissingGloss; m_tssEmptyAnalysis = m_tsf.MakeString("", m_wsAnalysis); m_WsList = new WsListManager(m_cache); m_tssEmptyPara = m_tsf.MakeString(ITextStrings.ksEmptyPara, m_wsAnalysis); m_tssSpace = m_tsf.MakeString(" ", m_wsAnalysis); m_flidStringValue = CmBaseAnnotation.StringValuePropId(m_cache); m_msaVc = new MoMorphSynAnalysisUi.MsaVc(m_cache); m_vernWss = LangProject.GetAllWritingSystems("all vernacular", m_cache, null, 0, 0); // This usually gets overridden, but ensures default behavior if not. m_lineChoices = InterlinLineChoices.DefaultChoices(0, m_cache.DefaultAnalWs, m_cache.LangProject); // These two used to be constants but were made variables with dummy virtual handlers so that // ClearInfoAbout can clear them out. ktagTwficDefault = TwficDefaultTag(m_cache); ktagSegmentForms = SegmentFormsTag(m_cache); tagRealForm = TwficRealFormTag(m_cache); GetSegmentLevelTags(cache); }
public override void MakeRoot() { base.MakeRoot(); if (m_fdoCache == null || DesignMode) return; MoMorphSynAnalysisUi msaUi = new MoMorphSynAnalysisUi(m_msa); m_rootb = VwRootBoxClass.Create(); m_rootb.SetSite(this); m_rootb.DataAccess = m_fdoCache.MainCacheAccessor; m_vc = msaUi.Vc as MoMorphSynAnalysisUi.MsaVc; m_rootb.SetRootObject(m_msa.Hvo, m_vc, (int)VcFrags.kfragFullMSAInterlinearname, m_rootb.Stylesheet); }