コード例 #1
0
 /// <summary>
 /// Begins a block notification scope where the notifications are not sent to the listeners.
 /// The PropertyChanged requests are stored and when the scope ends, all of them will be sent to the listeners
 /// exactly once, even if more than one Request was made for a specific property.
 /// <code>
 /// using(obj.BeginBlockNotifications())
 /// {
 ///     obj.Prop1 = 1;
 ///     obj.Prop2 = 3;
 ///     obj.Prop2 = 6;
 /// } // Two events will be sent to the listeners : one for Prop1, one for Prop2.
 /// </code>
 /// </summary>
 /// <returns></returns>
 public IDisposable BeginBlockNotifications()
 {
     if (BlockNotificationsScope == null)
     {
         BlockNotificationsScope             = new Scope();
         BlockNotificationsScope.OnScopeEnd += (sender, e) => OnBlockNotificationsEnd();
     }
     BlockedNotifications = new Dictionary <string, PropertyChangedEventArgs>();
     return(BlockNotificationsScope.BeginScope());
 }
コード例 #2
0
ファイル: SelectionBase.cs プロジェクト: AndreiCretu23/WPF
 /// <summary>
 /// Begins a scope in which all notifications are disabled. If the value changes inside this scope,
 /// the event will not raise itself. When the scope ends, if the value changed during it, the event will raise itself.
 /// </summary>
 /// <returns></returns>
 public IDisposable BeginBlockingNotifications()
 {
     return(BlockNotificationsScope.BeginScope());
 }