예제 #1
0
 private void btnTrip_Click(object sender, EventArgs e)
 {
     using (var dialog = new AddTripDialog())
     {
         dialog.ShowDialog();
         if (dialog.DialogResult == DialogResult.OK)
         {
             LoadTrips();
         }
     }
 }
예제 #2
0
        private void MiNewTrip_Click(object sender, EventArgs e)
        {
            //using (var dialog = new AddTripDialog())
            //{
            //    dialog.ShowDialog();
            //    if (dialog.DialogResult == DialogResult.OK)
            //    {
            //        //LoadTrips();
            //    }
            //}
            //DateTime startDate = calendarView1.DateSelectionStart.GetValueOrDefault();
            //DateTime endDate = calendarView1.DateSelectionEnd.GetValueOrDefault();

            using (var dialog = new AddTripDialog())
            {
                dialog.ShowDialog();
                if (dialog.DialogResult == DialogResult.OK)
                {
                    LoadTrips();
                }
            }
        }
예제 #3
0
        private async void AddTripButton_Click(object sender, RoutedEventArgs e)
        {
            NewTripNameTextBox.Text     = "";
            NewTripStartDatePicker.Date = DateTimeOffset.Now;
            NewTripEndDatePicker.Date   = DateTimeOffset.Now.AddDays(7);

            ContentDialogResult result = await AddTripDialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                TripDTO newTrip = new TripDTO
                {
                    Name          = NewTripNameTextBox.Text,
                    StartDateTime = NewTripStartDatePicker.Date.DateTime,
                    EndDateTime   = NewTripEndDatePicker.Date.DateTime
                };

                var trips = await _service.AddTrip(newTrip);

                SetupTrips(trips);
                Bindings.Update();
            }
        }