Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 再操作の確認
        /// </summary>
        protected void CheckReentrancy()
        {
            if (this.watcher.IsInScope)
            {
                var invocationCount = 0;
                if (DataPropertyChanging != null)
                {
                    invocationCount += DataPropertyChanging.GetInvocationList().Length;
                }

                if (_DataPropertyChanging != null)
                {
                    invocationCount += _DataPropertyChanging.GetInvocationList().Length;
                }

                if (invocationCount > 1)
                {
                    throw new InvalidOperationException(string.Format(Echo.Properties.Resources.MESSAGE_EXCEPTION_INVALID_OPERATION_REENTRANCY_FORMAT, nameof(DataProperty <T>), nameof(DataPropertyChanging)));
                }
            }
        }