示例#1
0
		/// <summary>
		/// Called after broadcasting all changes.
		/// </summary>
		public void EndBroadcastingChanges()
		{
			// If we're ending a bulk edit, end the sorting suppression (if any).
			if (m_bulkEditUpdateHelper != null)
			{
				m_bulkEditUpdateHelper.Dispose();
				m_bulkEditUpdateHelper = null;
			}
		}
示例#2
0
			public ListUpdateHelper(RecordClerk clerk, bool fWasAlreadySuppressed)
			{
				m_clerk = clerk;
				if (m_clerk != null)
				{
					m_fOriginalUpdatingList = m_clerk.m_list.UpdatingList;
					m_fOriginalListLoadingSuppressedState = fWasAlreadySuppressed;
					m_fOriginalSkipRecordNavigationState = m_clerk.m_skipShowRecord;
					m_fOriginalSuppressSaveOnChangeRecord = m_clerk.SuppressSaveOnChangeRecord;
					m_fOriginalLoadRequestedWhileSuppressed = m_clerk.RequestedLoadWhileSuppressed;
					// monitor whether ReloadList was requested during the life of this ListUpdateHelper
					m_clerk.m_list.RequestedLoadWhileSuppressed = false;

					m_originalUpdateHelper = m_clerk.UpdateHelper;
					// if we're already suppressing the list, we don't want to auto reload since
					// the one who is suppressing the list expects to be able to handle that later.
					// or if the parent clerk is suppressing, we should wait until the parent reloads.
					RecordClerk parentClerk = clerk.ParentClerk();
					if (m_fOriginalListLoadingSuppressedState ||
						parentClerk != null && parentClerk.ListLoadingSuppressed)
					{
						m_fTriggerPendingReloadOnDispose = false;
					}
					m_clerk.ListLoadingSuppressedNoSideEffects = true;
					m_clerk.UpdateHelper = this;
				}
			}
示例#3
0
		/// <summary>
		/// Called at the start of broadcasting PropChanged messages, passed the count of changes.
		/// Currently this used so as to not doing anything to batch them if there is only one.
		/// </summary>
		public void BeginBroadcastingChanges(int count)
		{
			// If we're starting a multi-property change, suppress list sorting until all the notifications have been received.
			// The null check is just for sanity, it should always be null when starting an operation.
			if (count > 1 && m_bulkEditUpdateHelper == null)
			{
				m_bulkEditUpdateHelper = new ListUpdateHelper(this);
			}
		}
示例#4
0
		private void UpdateOwningObject(bool fUpdateOwningObjectOnlyIfChanged)
		{
			//if we're not dependent on another clerk, then we don't ever change our owning object.
			if (m_clerkProvidingRootObject !=null)
			{
				var old = m_list.OwningObject;
				ICmObject newObj = null;
				var rni = (RecordNavigationInfo) m_mediator.PropertyTable.GetValue(DependentPropertyName);
				if (rni != null)
					newObj = rni.Clerk.CurrentObject;
				using (var luh = new ListUpdateHelper(this))
				{
					// in general we want to actually reload the list if something as
					// radical as changing the OwningObject occurs, since many subsequent
					// events and messages depend upon this information.
					luh.TriggerPendingReloadOnDispose = true;
					if (rni != null)
						luh.SkipShowRecord = rni.SkipShowRecord;
					if (!fUpdateOwningObjectOnlyIfChanged)
						m_list.OwningObject = newObj;
					if (old != newObj)
					{
						if (fUpdateOwningObjectOnlyIfChanged)
							m_list.OwningObject = newObj;
					}
				}
				if (old != newObj)
					m_mediator.SendMessage("ClerkOwningObjChanged", this);
			}
		}