Beispiel #1
0
        public override async Task InitializeAsync(object navigationData)
        {
            if (navigationData as ObservableCollection <Flight> != null)
            {
                var flights = (ObservableCollection <Flight>)navigationData;
                Profile = await _authenticationService.GetProfileAsync();

                foreach (var flight in flights)
                {
                    flight.PassengerName = Profile.Name;
                }

                Flights = flights;
                var departure = Flights.FirstOrDefault();

                if (departure != null)
                {
                    FromName = departure.FromName;
                    FromCode = departure.FromCode;
                }

                var arrival = Flights.LastOrDefault();

                if (arrival != null)
                {
                    ToName = arrival.ToName;
                    ToCode = arrival.ToCode;
                }
            }
        }
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            var result = await Service.GetAll();

            result.ForEach(x => Flights.Add(x));
            lastId = Flights.LastOrDefault().Id;
            LoadTicketes();
        }