예제 #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// If a data update is actually in progress, we want to only complete edits and not
        /// notify the world of the prop changes yet (we'll store the info in a queue for
        /// broadcast later, in Dispose()).
        /// </summary>
        /// <param name="vwsel"></param>
        /// <param name="sda">Data access object (corresponds to a DB connection)</param>
        /// <returns>Return value from IVwSelection.Commit() or IVwSelection.CompleteEdits()
        /// </returns>
        /// ------------------------------------------------------------------------------------
        public static bool Commit(IVwSelection vwsel, ISilDataAccess sda)
        {
            if (vwsel == null)
            {
                return(false);
            }

            UpdateSemaphore semaphore = null;

            if (s_UpdateSemaphores.ContainsKey(sda))
            {
                semaphore = s_UpdateSemaphores[sda];
            }
            if (semaphore == null || !semaphore.fDataUpdateInProgress)
            {
                return(vwsel.Commit());
            }

            VwChangeInfo changeInfo;
            bool         fRet = vwsel.CompleteEdits(out changeInfo);

            if (changeInfo.hvo != 0)
            {
                semaphore.changeInfoQueue.Enqueue(changeInfo);
            }
            return(fRet);
        }
예제 #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// If a data update is actually in progress, we want to only complete edits and not
		/// notify the world of the prop changes yet (we'll store the info in a queue for
		/// broadcast later, in Dispose()).
		/// </summary>
		/// <param name="vwsel"></param>
		/// <param name="sda">Data access object (corresponds to a DB connection)</param>
		/// <returns>Return value from IVwSelection.Commit() or IVwSelection.CompleteEdits()
		/// </returns>
		/// ------------------------------------------------------------------------------------
		public static bool Commit(IVwSelection vwsel, ISilDataAccess sda)
		{
			if (vwsel == null)
				return false;

			UpdateSemaphore semaphore = null;
			if (s_UpdateSemaphores.ContainsKey(sda))
			{
				semaphore = s_UpdateSemaphores[sda];
			}
			if (semaphore == null || !semaphore.fDataUpdateInProgress)
				return vwsel.Commit();

			VwChangeInfo changeInfo;
			bool fRet = vwsel.CompleteEdits(out changeInfo);
			if (changeInfo.hvo != 0)
				semaphore.changeInfoQueue.Enqueue(changeInfo);
			return fRet;
		}