コード例 #1
0
        private void ItemView_ItemClick(object sender, ItemClickEventArgs e)
        {
            BookingContext bookingContext = new BookingContext();

            bookingContext.Name = ((Journey)e.ClickedItem).Name;

            bookingContext.Image = ((Journey)e.ClickedItem).Image;
            bookingContext.Destination = ((Journey)e.ClickedItem).Destination.Name;
            bookingContext.DepartureTime = ((Journey)e.ClickedItem).FromDate;
            bookingContext.ReturnTime = ((Journey)e.ClickedItem).ToDate;
            bookingContext.Amount = ((Journey)e.ClickedItem).Amount;
            bookingContext.ID = ((Journey)e.ClickedItem).ID;

            Frame.Navigate(typeof(BookingDetailsPage), bookingContext);
        }
コード例 #2
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the  
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method 
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedTo(e);
            _bookingContext = (BookingContext)e.Parameter;
            BookingName.Text = _bookingContext.Name;

            ImageName.Source = _bookingContext.Image;
            /*
            if (bookingContext.Image == null)
            {
                ImageName.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            }
            else
            {
                ImageName.Source = bookingContext.Image;
            }
            */
            Destination.Text = _bookingContext.Destination;
            Amount.Text = "$" + _bookingContext.Amount;
            DepartureTime.Text = _bookingContext.DepartureTime;
            RetureTime.Text = _bookingContext.ReturnTime;

            Settings settings = await App.SettingsDataSource.GetSettings();

            if (settings.LoggedInUser != null)
            {
                BookButton.IsEnabled = true;
                BookButton.Content = "Book Journey";
            }
            else
            {
                BookButton.IsEnabled = false;
            }
        }