コード例 #1
0
        private async void AddItineraryItem()
        {
            AddItineraryItemDialog dialog = new AddItineraryItemDialog(Trip);

            ContentDialogResult result = await dialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                if (!String.IsNullOrEmpty(dialog.Description) && dialog.SelectedDate != null && dialog.SelectedTime != null)
                {
                    DateTime      time = dialog.SelectedDate.AddHours(dialog.SelectedTime.Hours).AddMinutes(dialog.SelectedTime.Minutes);
                    ItineraryItem ii   = new ItineraryItem(dialog.Description, time, (time.Date - DateTime.Now).Days);
                    int           id   = await _tripRepository.AddItineraryItem(Trip.Id, ii);

                    ii.Id          = id;
                    ii.Description = $"{ii.Description} at {ii.Date:H:mm}";
                    _itineraryItems.Add(ii);
                    BuildItineraryList();
                }
            }
        }