SIL.FieldWorks.FieldWorks.CommitAndDisposeCache C# (CSharp) Метод

CommitAndDisposeCache() приватный статический Метод

Commits the and disposes the FdoCache. This is usually called on a separate thread.
private static CommitAndDisposeCache ( IThreadedProgress progressDlg, object parameters ) : object
progressDlg IThreadedProgress The progress dialog.
parameters object The parameters passed in to the caller.
Результат object
		private static object CommitAndDisposeCache(IThreadedProgress progressDlg, object[] parameters)
		{
			progressDlg.Message = ResourceHelper.GetResourceString("kstidShutdownSaveMessage");
			//ENHANCE: if (about to restore and not doing a backup of existing project first) then
			// we improve efficiency by skipping the step of saving the data
			// Save any changes that have happened since the last commit on the cache
			try
			{
				s_cache.ServiceLocator.GetInstance<IUndoStackManager>().StopSaveTimer();
				s_cache.ServiceLocator.GetInstance<IUndoStackManager>().Save();
				if (s_doingRename)
				{
					progressDlg.Message = Properties.Resources.kstidRenamingProject;
					// Give the disk and system time to update. For some reason this is
					// needed after doing a save.
					Thread.Sleep(2000);
					s_renameSuccessful = s_cache.RenameDatabase(s_renameNewName);
			}
			}
			catch (NonRecoverableConnectionLostException e)
			{
				// any changes have NOT been saved.
				Logger.WriteEvent("Got non-recoverable error while saving:");
				Logger.WriteError(e);
			}
			finally
			{
				// Even if an exception is thrown during saving, we still want to dispose of
				// the cache (we'll probably be disposing it later anyways). (FWR-3179)
				s_cache.Dispose();
				s_cache = null; // Don't try to use it again
			}
			return null;
		}
		#endregion
FieldWorks