/// <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_fdoCache != null) { m_fdoCache.DisposeWithWSFactoryShutdown(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_sda = null; m_da = null; m_fdoCache = null; base.Dispose(disposing); }
public void FindInDictionary(IOleDbEncap ode, IFwMetaDataCache mdc, IVwOleDbDa oleDbAccess, IVwSelection sel) { using (FdoCache cache = new FdoCache(ode, mdc, oleDbAccess)) { if (sel == null) { return; } IVwSelection sel2 = sel.EndPoint(false); if (sel2 == null) { return; } IVwSelection sel3 = sel2.GrowToWord(); if (sel3 == null) { return; } ITsString tss; int ichMin, ichLim, hvo, tag, ws; bool fAssocPrev; sel3.TextSelInfo(false, out tss, out ichMin, out fAssocPrev, out hvo, out tag, out ws); sel3.TextSelInfo(true, out tss, out ichLim, out fAssocPrev, out hvo, out tag, out ws); // TODO (TimS): need to supply help information (last 2 params) LexEntryUi.DisplayOrCreateEntry(cache, hvo, tag, ws, ichMin, ichLim, null, null, null, string.Empty); return; } }
public void Exit() { CheckDisposed(); m_sda = null; m_da = null; m_fdoCache.DisposeWithWSFactoryShutdown(); m_fdoCache = null; }
public void Initialize() { CheckDisposed(); if (m_fdoCache != null) { m_fdoCache.DisposeWithWSFactoryShutdown(); } m_fdoCache = InDatabaseFdoTestBase.SetupCache(); m_sda = m_fdoCache.MainCacheAccessor; m_da = (IVwOleDbDa)m_sda; }
/// <summary> /// Required method to load the data. /// </summary> /// <param name="hvo"></param> /// <param name="tag"></param> /// <param name="ws"></param> /// <param name="_cda"></param> public override void Load(int hvo, int tag, int ws, SIL.FieldWorks.Common.COMInterfaces.IVwCacheDa _cda) { // Need to get stem.PartOfSpeech instead of cn.Obj because cn.Obj and cn.Txt may be null! See LT-6828. string sql = "select ls.id, ls.MorphoSyntaxAnalysis, msao.Owner$, msao.class$, ms.txt, ms.fmt, stem.PartOfSpeech, cn.txt from LexSense ls" + " left outer join MultiStr$ ms on ms.obj = ls.id and ms.flid = 5016005 and ms.ws = " + m_cache.DefaultAnalWs + " left outer join MoStemMsa stem on stem.id = ls.MorphoSyntaxAnalysis" + " left outer join CmPossibility_Name cn on stem.PartOfSpeech = cn.obj and cn.ws = " + m_cache.DefaultAnalWs + " left outer join CmObject msao on msao.id = ls.MorphoSyntaxAnalysis"; IVwOleDbDa dba = m_cache.VwOleDbDaAccessor; IDbColSpec dcs = DbColSpecClass.Create(); dcs.Push((int)DbColType.koctObjVec, 0, this.Tag, 0); dcs.Push((int)DbColType.koctObj, 1, (int)LexSense.LexSenseTags.kflidMorphoSyntaxAnalysis, 0); dcs.Push((int)DbColType.koctObj, 2, (int)CmObjectFields.kflidCmObject_Owner, 0); dcs.Push((int)DbColType.koctInt, 2, (int)CmObjectFields.kflidCmObject_Class, 0); dcs.Push((int)DbColType.koctMlsAlt, 1, (int)LexSense.LexSenseTags.kflidDefinition, m_cache.DefaultAnalWs); dcs.Push((int)DbColType.koctFmt, 1, (int)LexSense.LexSenseTags.kflidDefinition, m_cache.DefaultAnalWs); dcs.Push((int)DbColType.koctObj, 2, (int)MoStemMsa.MoStemMsaTags.kflidPartOfSpeech, 0); dcs.Push((int)DbColType.koctMltAlt, 7, (int)CmPossibility.CmPossibilityTags.kflidName, m_cache.DefaultAnalWs); dba.Load(sql, dcs, hvo, 0, null, false); }
public void FindInDictionary(IOleDbEncap ode, IFwMetaDataCache mdc, IVwOleDbDa oleDbAccess, IVwSelection sel) { using (FdoCache cache = new FdoCache(ode, mdc, oleDbAccess)) { if (sel == null) return; IVwSelection sel2 = sel.EndPoint(false); if (sel2 == null) return; IVwSelection sel3 = sel2.GrowToWord(); if (sel3 == null) return; ITsString tss; int ichMin, ichLim, hvo, tag, ws; bool fAssocPrev; sel3.TextSelInfo(false, out tss, out ichMin, out fAssocPrev, out hvo, out tag, out ws); sel3.TextSelInfo(true, out tss, out ichLim, out fAssocPrev, out hvo, out tag, out ws); // TODO (TimS): need to supply help information (last 2 params) LexEntryUi.DisplayOrCreateEntry(cache, hvo, tag, ws, ichMin, ichLim, null, null, null, string.Empty); return; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes the WritingSystemPropertiesDialog class. Clients written in .Net with an FdoCache /// should use the version of the constructor that accepts an FdoCache. COM clients that /// do not have an FdoCache should use the default constructor and then call this method /// to initialize the object. /// </summary> /// <param name="ode"></param> /// <param name="mdc"></param> /// <param name="oleDbAccess"></param> /// <param name="helpTopicProvider">IHelpTopicProvider object used to get help /// information</param> /// <param name="stylesheet">Used for the FwTextBox</param> /// ------------------------------------------------------------------------------------ public void Initialize(IOleDbEncap ode, IFwMetaDataCache mdc, IVwOleDbDa oleDbAccess, IHelpTopicProvider helpTopicProvider, IVwStylesheet stylesheet) { CheckDisposed(); FdoCache cache = new FdoCache(ode, mdc, oleDbAccess); m_cacheMadeLocally = true; Initialize(cache, helpTopicProvider, stylesheet); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Sets the initial values for the dialog controls, prior to displaying the dialog. /// This method should be called after creating, but prior to calling DoModeless. This /// overload is meant to be called from unmanaged code. /// </summary> /// <param name="mdc"></param> /// <param name="ode"></param> /// <param name="oleDbAccess"></param> /// <param name="rootSite">view</param> /// <param name="hwnd">The window handle of the main window that owns the rootsite /// </param> /// <param name="findPattern">The find/replace pattern.</param> /// <remarks>ENHANCE JohnT: it may need more arguments, for example, the name of the /// kind of object we can restrict the search to, a list of fields.</remarks> /// ------------------------------------------------------------------------------------ public void SetOwner(IOleDbEncap ode, IFwMetaDataCache mdc, IVwOleDbDa oleDbAccess, IVwRootSite rootSite, IntPtr hwnd, IVwPattern findPattern) { CheckDisposed(); SetOwner(new FdoCache(ode, mdc, oleDbAccess), rootSite, hwnd, findPattern); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Sets the initial values for the dialog controls, prior to displaying the dialog. /// This method should be called after creating, but prior to calling DoModeless. This /// overload is meant to be called from unmanaged code. /// </summary> /// <param name="mdc"></param> /// <param name="ode"></param> /// <param name="oleDbAccess"></param> /// <param name="vwPattern">Find/replace values</param> /// <param name="rootSite">view</param> /// <param name="fReplace"><c>true</c> to initially display replace dialog page</param> /// <param name="fOverlays">ignored for now</param> /// <param name="sUserWs">UI writing system</param> /// <param name="hwnd">The window handle of the main window that owns the rootsite /// </param> /// <param name="tool">The app (needed to be able to disable all main windows)</param> /// <param name="helpTopicProvider">help topic provider allows the dialog box class /// to specify the appropriate help topic path for this dialog /// </param> /// <param name="wsEdit">writing system for the find and replace edit boxes</param> /// <returns>true if the dialog was initialized properly, otherwise false. /// False indicates some problem and the find/replace dialog should not be /// shown at this time.</returns> /// <remarks>ENHANCE JohnT: it may need more arguments, for example, the name of the /// kind of object we can restrict the search to, a list of fields.</remarks> /// ------------------------------------------------------------------------------------ public bool SetDialogValues(IOleDbEncap ode, IFwMetaDataCache mdc, IVwOleDbDa oleDbAccess, IVwPattern vwPattern, IVwRootSite rootSite, bool fReplace, bool fOverlays, string sUserWs, IntPtr hwnd, IFwTool tool, IHelpTopicProvider helpTopicProvider, int wsEdit) { CheckDisposed(); m_cacheMadeLocally = true; return SetDialogValues(new FdoCache(ode, mdc, oleDbAccess), vwPattern, rootSite, fReplace, fOverlays, sUserWs, hwnd, tool, helpTopicProvider, wsEdit); }
/// <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_fdoCache != null) m_fdoCache.DisposeWithWSFactoryShutdown(); } // Dispose unmanaged resources here, whether disposing is true or false. m_sda = null; m_da = null; m_fdoCache = null; base.Dispose(disposing); }
public void Initialize() { CheckDisposed(); if (m_fdoCache != null) m_fdoCache.DisposeWithWSFactoryShutdown(); m_fdoCache = InDatabaseFdoTestBase.SetupCache(); m_sda = m_fdoCache.MainCacheAccessor; m_da = (IVwOleDbDa)m_sda; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes the FwUserProperties class. Clients written in .Net with an FdoCache /// should use the version of the constructor that accepts an FdoCache. COM clients that /// do not have an FdoCache should use the default consructor and then call this method /// to initialize the object. /// </summary> /// ------------------------------------------------------------------------------------ public void Initialize(IOleDbEncap ode, IFwMetaDataCache mdc, IVwOleDbDa oleDbAccess, Feature[] features) { CheckDisposed(); m_Cache = new FdoCache(ode, mdc, oleDbAccess); m_cacheMadeLocally = true; m_Features = features; Initialize(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes the FwProjProperties class. Clients written in .Net with an FdoCache /// should use the version of the constructor that accepts an FdoCache. COM clients that /// do not have an FdoCache should use the default constructor and then call this method /// to initialize the object. /// </summary> /// <param name="ode"></param> /// <param name="mdc"></param> /// <param name="oleDbAccess"></param> /// <param name="tool">IFwTool object used to open/close application window</param> /// <param name="helpTopicProvider">IHelpTopicProvider object used to get help /// information</param> /// <param name="strmLog">optional log file stream</param> /// <param name="hvoProj">Hvo of the Language Project</param> /// <param name="hvoRoot">Hvo of the root object</param> /// <param name="wsUser">user interface writing system id</param> /// <param name="stylesheet">stylesheet for FwTextBox</param> /// ------------------------------------------------------------------------------------ public void Initialize(IOleDbEncap ode, IFwMetaDataCache mdc, IVwOleDbDa oleDbAccess, IFwTool tool, IHelpTopicProvider helpTopicProvider, IStream strmLog, int hvoProj, int hvoRoot, int wsUser, IVwStylesheet stylesheet) { CheckDisposed(); m_cache = new FdoCache(ode, mdc, oleDbAccess); m_cacheMadeLocally = true; m_tool = tool; m_helpTopicProvider = helpTopicProvider; m_strmLog = strmLog; m_hvoProj = hvoProj; m_hvoRoot = hvoRoot; m_wsUser = wsUser; m_stylesheet = stylesheet; Initialize(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:DummyFdoCache"/> class. /// </summary> /// <param name="ode">The ode.</param> /// <param name="mdc">The MDC.</param> /// <param name="oleDbAccess">The OLE db access.</param> /// <param name="sda">The sda.</param> /// ------------------------------------------------------------------------------------ public DummyFdoCache(IOleDbEncap ode, IFwMetaDataCache mdc, IVwOleDbDa oleDbAccess, ISilDataAccess sda): base(ode, mdc, oleDbAccess, sda) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:DummyFdoCache"/> class. /// </summary> /// <param name="ode">The ode.</param> /// <param name="mdc">The MDC.</param> /// <param name="oleDbAccess">The OLE db access.</param> /// <param name="sda">The sda.</param> /// ------------------------------------------------------------------------------------ public DummyFdoCache(IOleDbEncap ode, IFwMetaDataCache mdc, IVwOleDbDa oleDbAccess, ISilDataAccess sda) : base(ode, mdc, oleDbAccess, sda) { }