/// <summary>轮训订单状态,直到订单的库存预扣操作完成 /// </summary> /// <param name="orderId"></param> /// <returns></returns> private Task <Order> WaitUntilReservationCompleted(Guid orderId) { return(TimerTaskFactory.StartNew <Order>( () => this.OrderQueryService.FindOrder(orderId), x => x != null && (x.Status == (int)OrderStatus.ReservationSuccess || x.Status == (int)OrderStatus.ReservationFailed), PricedOrderPollInterval, PricedOrderWaitTimeout)); }
private Task <PricedOrder> WaitUntilOrderIsPriced(Guid orderId, int lastOrderVersion) { return(TimerTaskFactory.StartNew( () => this._orderDao.FindPricedOrder(orderId), order => order != null && order.OrderVersion > lastOrderVersion, PricedOrderPollInterval, PricedOrderWaitTimeout)); }
private Task <DraftOrder> WaitUntilSeatsAreConfirmed(Guid orderId, int lastOrderVersion) { return (TimerTaskFactory.StartNew <DraftOrder>( () => this._orderDao.FindDraftOrder(orderId), order => order != null && order.State != DraftOrder.States.PendingReservation && order.OrderVersion > lastOrderVersion, DraftOrderPollInterval, DraftOrderWaitTimeout)); }
private void InitSetTimeTimerTask() { SyncTimeProcessTimerTaskCancellationToken?.Cancel(); SyncTimeProcessTimerTaskCancellationToken = new CancellationTokenSource(); Task SyncTimerTask = TimerTaskFactory.Start(action: SetTime, intervalInMilliseconds: RETRY_SYNC_TIME_INTERVAL_MS, delayInMilliseconds: 0, cancelToken: SyncTimeProcessTimerTaskCancellationToken.Token, maxIterations: Int32.MaxValue); }
private void InitBlurAnimationTimerTask() { AnimProcessTimerTaskCancellationToken?.Cancel(); AnimProcessTimerTaskCancellationToken = new CancellationTokenSource(); Task AnimTimerTask = TimerTaskFactory.Start(action: PerformBlurAnimation, intervalInMilliseconds: RETRY_ANIM_TIME_INTERVAL_MS, delayInMilliseconds: 0, cancelToken: AnimProcessTimerTaskCancellationToken.Token, maxIterations: Int32.MaxValue); }