예제 #1
0
        public async Task InitializeAndPost()
        {
            GameCenter.StartTracking(this);

            driverTimer.Start();

            // Make sure to post this status before we handle any cancellations.
            await PostStatus(driverTimer.Interval);

            // Delay running the OnRide___Canceled() methods until this method finishes.
            using (var delay = new DelayedActions())
            {
                // TODO handle request changes properly
                offer.Changed += OnRideOfferCanceled;

                delay.Run(() => offer.Canceled.RunWhenFired(OnRideOfferCanceled));
                offer.PendingRideMade(this);

                foreach (UserRideRequest rr in requests)
                {
                    // TODO handle request changes properly
                    rr.Changed += OnRideRequestCanceled;

                    delay.Run(() => rr.Canceled.RunWhenFired(OnRideRequestCanceled));
                    rr.PendingRideMade(this);
                }
            }
        }