Пример #1
0
        //creates the panel for the slot allocation for a day
        private ScrollViewer createSlotAllocationPanel(DayOfWeek day)
        {
            ScrollViewer scroller = new ScrollViewer();

            scroller.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            scroller.MaxWidth = 800;

            StackPanel panelSlots = new StackPanel();

            panelSlots.Margin = new Thickness(0, 10, 0, 0);


            Dictionary <TimeSpan, KeyValuePair <int, int> > values = new Dictionary <TimeSpan, KeyValuePair <int, int> >();

            DateTime time = new DateTime(2000, 1, 1, 0, 0, 0);

            while (time.Day < 2)
            {
                TimeSpan ts = new TimeSpan(time.Hour, time.Minute, 0);
                values.Add(ts, new KeyValuePair <int, int>(AirportHelpers.GetAirportTakeoffs(this.Airport, day, ts, ts.Add(new TimeSpan(0, 15, 0))).Count, AirportHelpers.GetAirportLandings(this.Airport, day, ts, ts.Add(new TimeSpan(0, 15, 0))).Count));

                time = time.AddMinutes(15);
            }

            panelSlots.Children.Add(createSlotsPanel(values, new TimeSpan(0, 0, 0), new TimeSpan(12, 0, 0)));
            panelSlots.Children.Add(createSlotsPanel(values, new TimeSpan(12, 0, 0), new TimeSpan(24, 0, 0)));

            scroller.Content = panelSlots;

            return(scroller);
        }