コード例 #1
0
        private async Task Confirm(object o)
        {
            if (!ValidateConfirm())
            {
                return;
            }

            DateTime scheduledDeparture = SelectedDate.AddHours(DepartureTimeHours.Value).AddMinutes(DepartureTimeMinutes.Value);

            UiState = UiState.Wait;

            await m_crudManager.AddFlight(SelectedRouteAircraft.RouteAircraftId, FlightNumber, scheduledDeparture);

            UiState = UiState.Normal;

            MessageBoxResult result = MessageBox.Show("Flight added successfully. Add another?", "Success", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                m_pageController.AddFlight();
            }
            else
            {
                m_pageController.Home();
            }
        }
コード例 #2
0
 private void UpdateCalendarDates()
 {
     if (SelectedArea != null)
     {
         if (SelectedDate > CalendarStart)
         {
             CalendarEnd   = SelectedDate.AddHours(SelectedArea.eveningends.Value).AddHours(SelectedArea.eveningends_minutes > 0 ? 1 : 0);
             CalendarStart = SelectedDate.AddHours(SelectedArea.morningstarts.Value);
         }
         else
         {
             CalendarStart = SelectedDate.AddHours(SelectedArea.morningstarts.Value);
             CalendarEnd   = SelectedDate.AddHours(SelectedArea.eveningends.Value).AddHours(SelectedArea.eveningends_minutes > 0 ? 1 : 0);
         }
     }
 }
コード例 #3
0
        private void UpdateMeetingTimes(bool updateStartTimes)
        {
            if (SelectedDate != null && SelectedArea != null)
            {
                DateTime first = SelectedDate.AddHours(SelectedArea.morningstarts.HasValue ? SelectedArea.morningstarts.Value : 7).AddMinutes(SelectedArea.morningstarts_minutes.HasValue ? SelectedArea.morningstarts_minutes.Value : 0);
                DateTime last  = SelectedDate.AddHours(SelectedArea.eveningends.HasValue ? SelectedArea.eveningends.Value : 7).AddMinutes(SelectedArea.eveningends_minutes.HasValue ? SelectedArea.eveningends_minutes.Value : 0);
                DateTime current;
                int      count = 0;

                if (updateStartTimes)
                {
                    MeetingStartTimes.Clear();
                }
                else
                {
                    first = MeetingStart;
                }

                current = first;
                MeetingEndTimes.Clear();
                if (current.Date != last.Date)
                {
                    last = current.Date + last.TimeOfDay;
                }

                while ((current < last) && (count < 48))
                {
                    count++;
                    if (updateStartTimes)
                    {
                        MeetingStartTimes.Add(current);
                    }

                    current = current.AddMinutes(30);
                    MeetingEndTimes.Add(new EndTime()
                    {
                        Value = current, Start = first
                    });
                }
            }
        }
コード例 #4
0
        private void LoadSelectedForecasts()
        {
            try
            {
                var collection = WeatherDataSelecter.GetGroupedByParameterForecastPlots(new ForecastViewerRequest(
                                                                                            _settings.CurrentStation,
                                                                                            SelectedDate.AddHours(SelectedTime == allDayString ? 0 : int.Parse(SelectedTime)),
                                                                                            GivenTimeKind,
                                                                                            SelectedTime == allDayString ? RequestTimeDeterminateness.AllDay : RequestTimeDeterminateness.DateAndHour,
                                                                                            SourceParamPicker.CheckedSources,
                                                                                            SourceParamPicker.CheckedParameters.Select(p => p.ShortTypeName)));

                foreach (var plot in Plots)
                {
                    plot.Dispose();
                }
                Plots.Clear();
                foreach (var parameter in collection.Keys)
                {
                    var plot = new PlotViewModel(collection[parameter]);
                    Plots.Add(plot);
                }
            }
            catch (Exception e)
            {
                System.Windows.MessageBox.Show(e.Message);
            }
        }