Exemplo n.º 1
0
        private void getTripByType(string type)
        {
            mSuperActivity.ShowLoadingView("Loading...");

            var dic = new Dictionary <String, String> {
                { Constant.GETMYBOOKEDRESERVATIONS_CUSTOMERID, AppSettings.UserID },
                { Constant.GETMYBOOKEDRESERVATIONS_ISFUTURERES, type },
                { Constant.GETMYBOOKEDRESERVATIONS_LASTSYNCON, "5/7/2014" }
            };

            String result = String.Empty;

            Task runSync = Task.Factory.StartNew(async() =>
            {
                result = await AppData.ApiCall(Constant.GETMYBOOKEDRESERVATIONS, dic);
                GetMyBookedReservationsResponse response = new GetMyBookedReservationsResponse
                {
                    MyReservations = new List <GetMyBookedReservationsResponseReservation>()
                };
                response            = (GetMyBookedReservationsResponse)AppData.ParseResponse(Constant.GETMYBOOKEDRESERVATIONS, result);
                mTripList           = response.MyReservations;
                TripAdapter adapter = new TripAdapter(this.Activity, mTripList, mSuperActivity, type);
                this.Activity.RunOnUiThread(() =>
                {
                    mDrawerList.Adapter = adapter;
                    adapter.NotifyDataSetChanged();
                    mSuperActivity.HideLoadingView();
                });
            }).Unwrap();
        }
Exemplo n.º 2
0
        public ReservationsDataSource(UIViewController owner, bool IsActiveReservations, Action DoUpdate)
        {
            this.owner = owner;

            var dic = new Dictionary <String, String>
            {
                { Constant.GETMYBOOKEDRESERVATIONS_CUSTOMERID, AppSettings.UserID },               //"11111"},
                { Constant.GETMYBOOKEDRESERVATIONS_ISFUTURERES, IsActiveReservations?"1":"0" },
                { Constant.GETMYBOOKEDRESERVATIONS_LASTSYNCON, "6/7/2014" }
            };

            String result = String.Empty;

            Task runSync = Task.Factory.StartNew(async() => {
                result   = await AppData.ApiCall(Constant.GETMYBOOKEDRESERVATIONS, dic);
                response = (GetMyBookedReservationsResponse)AppData.ParseResponse(Constant.GETMYBOOKEDRESERVATIONS, result);
                if (DoUpdate != null)
                {
                    DoUpdate();
                }
            }).Unwrap();
            //runSync.Wait();
        }