示例#1
0
        /// <summary>
        /// Posts the request.
        /// </summary>
        /// <returns>True if posting succeeded, false otherwise.</returns>
        /// <param name="request">Request to post.</param>
        public async Task <bool> PostRequest(RideRequest request)
        {
            if (IsStale)
            {
                return(false);
            }

            IPendingRideRelatedRequest response = await RideRequester.SubmitRideRequest(request);

            if (response != null)
            {
                TransitionTo(new RequestPendingState(this, response, request));
                return(true);
            }

            return(false);
        }
示例#2
0
        /// <summary>
        /// Posts the offer.
        /// </summary>
        /// <returns>True if posting succeeded, false otherwise.</returns>
        /// <param name="offer">Offer to post.</param>
        public async Task <bool> PostOffer(RideOffer offer)
        {
            if (IsStale)
            {
                return(false);
            }

            IPendingRideRelatedRequest response = await RideOfferer.SubmitRideOffer(offer);

            if (response != null)
            {
                TransitionTo(new OfferPendingState(this, response, offer));
                return(true);
            }

            return(false);
        }
示例#3
0
 public OfferPendingState(Ridesharing.StateBase previous, IPendingRideRelatedRequest response, RideOffer offer)
     : base(previous, response)
 {
     Offer = offer;
 }
示例#4
0
 protected AbstractPendingState(Ridesharing.StateBase previous, IPendingRideRelatedRequest response)
     : base(previous)
 {
     this.response = response;
 }
示例#5
0
 public RequestPendingState(Ridesharing.StateBase previous, IPendingRideRelatedRequest response, RideRequest request)
     : base(previous, response)
 {
     Request = request;
 }