Пример #1
0
 /// <summary>
 /// Causes all property change events to be suppressed until the next
 /// ResumeStateEvents call.
 /// </summary>
 protected void PauseStateEvents()
 {
     lock (_stateLock)
     {
         if (_pausedStateDirtySet != null)
         {
             throw new InvalidOperationException("The state is already paused.");
         }
         _pausedStateDirtySet = new PausedStateDirtySet();
     }
 }
Пример #2
0
 /// <summary>
 /// Unpauses property change events paused by the previous call to
 /// PauseStateEvents, and raises events for all properties that have
 /// been changed during the time the events were paused.
 /// </summary>
 protected void ResumeStateEvents()
 {
     lock (_stateLock)
     {
         PausedStateDirtySet set = _pausedStateDirtySet;
         if (set == null)
         {
             throw new InvalidOperationException("The state was not paused.");
         }
         _pausedStateDirtySet = null;
         foreach ((string property, object data) in set.Select(x => (x.Key, x.Value)))
         {
             OnPropertyChanged(property, data);
         }
     }
 }