예제 #1
0
 public ItineraryDetailsViewModel(INavigation MainPageNavigation, ItineraryViewModel itineraryVm)
 {
     Title                   = "Itinerary Details";
     _navigation             = MainPageNavigation;
     _itineraryVm            = itineraryVm;
     ItineraryDailyBreakDown = new ObservableCollection <ItineraryDailyBreakDown>();
     LoadItineraryCommand    = new Command(() => ExecuteLoadItemsCommand());
 }
        void ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                //ItineraryDailyBreakDown.Clear();
                KT.BusinessLayer.Itinerary itineraryManager = new KT.BusinessLayer.Itinerary();
                DateTime startDate     = DateTime.Today.AddDays(-2);
                var      itineraryList = itineraryManager.GetItineraryList();
                int      cntr          = 0;
                foreach (TripServices dto in itineraryList)
                {
                    cntr++;
                    var      newItem     = new ItineraryViewModel(_navigation);
                    DateTime tripStartDt = DateTime.Parse(dto.StartDate);

                    //TODO; change after demo
                    newItem.TripId        = dto.ItineraryId;
                    newItem.TripName      = dto.Name;
                    newItem.TripSchedule  = $"{tripStartDt.ToString("MMM ddd, yyyy")} - {tripStartDt.AddDays(dto.NoOfDays).ToString("MMM dd, yyyy")}";
                    newItem.BackImagePath = $"KtMobileApp.Assets.Images.Activity_{cntr + 10}_128_128.png";

                    ItineraryList.Add(newItem);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
 public async Task OpenPage(ItineraryViewModel itineraryVm)
 {
     await _pageNavigation.PushAsync(new ItineraryDetails(_pageNavigation, itineraryVm)); //_pageNavigation.PushModalAsync(new Page) ; NOTE: this is for Modal Dialog
 }