コード例 #1
0
 public virtual bool UpdateSource()
 {
     //ignoring the concurrent access, there is no need to use Interlocked or lock
     if (_isSourceUpdating)
     {
         return(false);
     }
     try
     {
         _isSourceUpdating = true;
         if (_sourceAccessor.SetValue(_targetAccessor, this, true))
         {
             RaiseBindingUpdated(BindingEventArgs.SourceTrueArgs);
             return(true);
         }
         RaiseBindingUpdated(BindingEventArgs.SourceFalseArgs);
     }
     catch (Exception exception)
     {
         RaiseBindingException(
             BindingExceptionManager.WrapBindingException(this, BindingAction.UpdateSource, exception),
             exception, BindingAction.UpdateSource);
     }
     finally
     {
         _isSourceUpdating = false;
     }
     return(false);
 }
コード例 #2
0
 /// <summary>
 ///     Sends the current value back to the source.
 /// </summary>
 public virtual bool UpdateSource()
 {
     try
     {
         if (_sourceAccessor.SetValue(_targetAccessor, this, true))
         {
             RaiseBindingUpdated(BindingEventArgs.SourceTrueArgs);
             return(true);
         }
         RaiseBindingUpdated(BindingEventArgs.SourceFalseArgs);
     }
     catch (Exception exception)
     {
         RaiseBindingException(
             BindingExceptionManager.WrapBindingException(this, BindingAction.UpdateSource, exception),
             exception, BindingAction.UpdateSource);
     }
     return(false);
 }