当前位置: 首页>>代码示例>>C#>>正文


C# FdoCache.Dispose方法代码示例

本文整理汇总了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;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:33,代码来源:FwApp.cs

示例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;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:33,代码来源:FwApp.cs

示例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();
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:27,代码来源:FwApp.cs


注:本文中的SIL.FieldWorks.FDO.FdoCache.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。