TryComplete() public method

检查活动是否已经完成,若已经完成则获取相应的收益
public TryComplete ( PlaceActing acting, System.DateTime now ) : bool
acting PlaceActing 正在进行的活动
now System.DateTime
return bool
示例#1
0
        /// <summary>
        /// 检查活动状态
        /// </summary>
        public void Check(DateTime now)
        {
            lock ( SyncRoot )
            {
                if (Place == null)
                {
                    throw new InvalidOperationException();
                }


                if (this.Equals(Place.Acting) == false)
                {
                    throw new InvalidOperationException();
                }

                if (ActionDescriptor.TryComplete(this, now))
                {
                    Place.SetActing(null);
                }
            }
        }