protected new void TransitionTo(Ridesharing.StateBase next)
        {
            foreach (var listener in statusListeners)
            {
                OnStatusUpdated -= listener;
            }

            base.TransitionTo(next);
        }
示例#2
0
        void HandleRidesStateChanged(Ridesharing.StateBase newState)
        {
            bool isMatched = false;
            PendingRideStatus   pendingRideStatus = null;
            Func <Task <bool> > confirm           = null;
            Func <Task <bool> > decline           = null;

            //TODO ick...
            HomeView hPage = ((homePage as NavigationPage).RootPage as ContentPage).Content as HomeView;

            switch (newState)
            {
            case AbstractMatchedState matchedState:
                isMatched = true;
                confirm   = matchedState.Confirm;
                decline   = matchedState.Decline;

                pendingRideStatus = matchedState.MostRecentStatus;
                break;

            case RideInProgressState rideInProgressState:
                // TODO: Compute route to display.
                break;
            }

            if (isMatched)
            {
                async Task ShowConfirmView()
                {
                    ShowHomePage();
                    await(homePage as NavigationPage).PopToRootAsync();

                    hPage.ShowConfirmView(confirm, decline, pendingRideStatus);
                }

                Device.BeginInvokeOnMainThread(() => ShowConfirmView().FireAndForgetAsync(App.Current.ErrorHandler));
            }
        }
示例#3
0
 public OfferMatchedState(Ridesharing.StateBase previous, IMatchedRideRelatedRequest match)
     : base(previous, match)
 {
 }
示例#4
0
 public OfferPendingState(Ridesharing.StateBase previous, IPendingRideRelatedRequest response, RideOffer offer)
     : base(previous, response)
 {
     Offer = offer;
 }
示例#5
0
 public UnknownState(Ridesharing.StateBase previous)
     : base(previous)
 {
 }
示例#6
0
 protected new void TransitionTo(Ridesharing.StateBase next)
 {
     UnregisterListeners();
     base.TransitionTo(next);
 }
示例#7
0
 protected AbstractPendingState(Ridesharing.StateBase previous, IPendingRideRelatedRequest response)
     : base(previous)
 {
     this.response = response;
 }
 public WaitingForConfirmedState(Ridesharing.StateBase previous, IMatchedRideRelatedRequest match)
     : base(previous)
 {
     this.match = match;
 }
示例#9
0
 public RideInProgressState(Ridesharing.StateBase previous, ActiveRideStatus rideStatus)
     : base(previous)
 {
     MostRecentRideStatus = rideStatus;
 }
示例#10
0
 public RequestPendingState(Ridesharing.StateBase previous, IPendingRideRelatedRequest response, RideRequest request)
     : base(previous, response)
 {
     Request = request;
 }
示例#11
0
 protected AbstractMatchedState(Ridesharing.StateBase previous, IMatchedRideRelatedRequest match)
     : base(previous)
 {
     this.match = match;
 }
示例#12
0
 public NoneState(Ridesharing.StateBase previous)
     : base(previous)
 {
 }