예제 #1
0
 /// <summary>
 /// プロパティ変更前の処理
 /// </summary>
 protected virtual void OnDataPropertyChanging(DataPropertyChangingEventArgs <T> e)
 {
     if (DataPropertyChanging != null || _DataPropertyChanging != null)
     {
         using (BlockReentrancy())
         {
             DataPropertyChanging?.Invoke(this, e);
             _DataPropertyChanging?.Invoke(this, e);
         }
     }
 }
예제 #2
0
        /// <summary>
        /// 設定の操作
        /// </summary>
        protected virtual void SetValue(T value)
        {
            var oldValue = ValueCore;

            if (!Equals(value, oldValue))
            {
                CheckReentrancy();

                var e = new DataPropertyChangingEventArgs <T>(this, value, oldValue);
                OnDataPropertyChanging(e);
                if (!e.Cancel)
                {
                    var newValue = e.NewValue;
                    if (!Equals(newValue, oldValue))
                    {
                        ValueCore = newValue;
                        OnDataPropertyChanged(new DataPropertyChangedEventArgs <T>(this, newValue, value, oldValue));
                    }
                }
            }
        }