示例#1
0
 /// <summary>
 /// プロパティ配列変更前の処理
 /// </summary>
 protected virtual void OnDataPropertyCollectionChanging(DataPropertyCollectionChangingEventArgs <T> e)
 {
     if (DataPropertyCollectionChanging != null || _DataPropertyCollectionChanging != null)
     {
         using (BlockReentrancy())
         {
             DataPropertyCollectionChanging?.Invoke(this, e);
             _DataPropertyCollectionChanging?.Invoke(this, e);
         }
     }
 }
示例#2
0
        /// <summary>
        /// 再操作の確認
        /// </summary>
        protected void CheckReentrancy()
        {
            if (this.watcher.IsInScope)
            {
                var invocationCount = 0;
                if (DataPropertyCollectionChanging != null)
                {
                    invocationCount += DataPropertyCollectionChanging.GetInvocationList().Length;
                }

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

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