本文整理汇总了C#中SIL.FieldWorks.FDO.FdoCache.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# FdoCache.Dispose方法的具体用法?C# FdoCache.Dispose怎么用?C# FdoCache.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.FDO.FdoCache
的用法示例。
在下文中一共展示了FdoCache.Dispose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCache
/// -----------------------------------------------------------------------------------
/// <summary>
/// Check to see if the given cache is already being used.
/// Use the one that we have, if available,
/// which will reset the 'cache' parameter.
/// Deprecated--(JohnT)...this approach involves creating and destroying a cache
/// unnecessarily and this seems to cause problems (see LT-7176). Better to use
/// the overload that takes a server and database name.
/// </summary>
/// <param name="cache">Reference to an FdoCache.</param>
/// <returns>True if the cache is not already being used, otherwise false.</returns>
/// -----------------------------------------------------------------------------------
protected bool GetCache(ref FdoCache cache)
{
Debug.Assert(cache != null);
bool isNewCache = false;
string key = MakeKey(cache.ServerName, cache.DatabaseName);
if (m_caches.ContainsKey(key))
{
// Use extant one.
cache.Dispose();
cache = m_caches[key];
}
else
{
// Cache the new cache in the hash.
m_caches[key] = cache;
isNewCache = true;
}
SetCacheProgressBar(cache);
return isNewCache;
}
示例2: ShowFirstTimeMessage
/// ------------------------------------------------------------------------------------
/// <summary>
/// Looks to see whether the sample DB is available and, if so, displays a message box
/// asking the user whether or not he wants to open it.
/// (TE-3473)
/// </summary>
/// <param name="cache">(output)</param>
/// <returns><c>true</c> if a connection to the sample DB is made; <c>false</c>
/// otherwise</returns>
/// ------------------------------------------------------------------------------------
protected bool ShowFirstTimeMessage(out FdoCache cache)
{
cache = null;
// Need to set this in case the user starts up a new main window from the
// Advertisement prompt or welcome dialog.
FwRegistrySettings.StartupSuccessfulSetting = true;
if (string.IsNullOrEmpty(SampleDatabase) || !FwRegistrySettings.FirstTimeAppHasBeenRun)
return false;
// First, attempt a connection to the sample DB before offering the user the
// option of opening it.
if (CheckDbVerCompatibility(MiscUtils.LocalServerName, SampleDatabase))
cache = FdoCache.Create(SampleDatabase);
if (cache != null && ShowFirstTimeMessageDlg())
return true;
if (cache != null)
cache.Dispose();
cache = null;
return false;
}
示例3: RemoveFdoCache
/// ------------------------------------------------------------------------------------
/// <summary>
/// Removes the specified FdoCache cleanly, saving it first.
/// </summary>
/// ------------------------------------------------------------------------------------
public void RemoveFdoCache(FdoCache wndCache)
{
CheckDisposed();
// To be safe - this method might get called recursively (explicitly and from
// Application.Exit() below again).
if (wndCache.IsDisposed)
return;
Debug.Assert(wndCache != null);
wndCache.Save();
DataUpdateMonitor.RemoveDataAccess(wndCache.MainCacheAccessor);
m_caches.Remove(MakeKey(wndCache.ServerName, wndCache.DatabaseName));
wndCache.Dispose();
// If the last cache was removed, then exit the application
if ((!m_fSuppressClose) && m_fOkToClose && m_caches.Count == 0)
{
EditingHelper.ClearTsStringClipboard();
Application.Exit();
}
}