Beispiel #1
0
        //creates the allocation panel for a specific timeslot
        private WrapPanel createSlotsPanel(Dictionary <TimeSpan, KeyValuePair <int, int> > values, TimeSpan startTime, TimeSpan endTime)
        {
            WrapPanel panelSlots = new WrapPanel();

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

            int maxValue = Math.Max(10, values.Max(v => v.Value.Key + v.Value.Value));

            double coeff = Convert.ToDouble(maxValue) / 100;

            var vs = (from v in values where v.Key >= startTime && v.Key < endTime select v);

            foreach (KeyValuePair <TimeSpan, KeyValuePair <int, int> > value in vs)
            {
                ucChartBar ucSerie = new ucChartBar();
                ucSerie.Value      = value.Value.Key + value.Value.Value;
                ucSerie.Text       = value.Key.Minutes == 0 ? new HourConverter().Convert(value.Key.Hours).ToString()  : value.Key.Minutes.ToString();
                ucSerie.FontSize   = 10;
                ucSerie.FontWeight = value.Key.Minutes == 0 ? FontWeights.Bold : FontWeights.Regular;
                ucSerie.Width      = value.Key.Minutes == 0 ? 30 : 25;

                ucSerie.ToolTip = createToolTip(value);

                ucSerie.BarHeight = Convert.ToDouble(value.Value.Value + value.Value.Key) / coeff;
                ucSerie.BarColor  = getBarColor(value.Value.Value + value.Value.Key);

                panelSlots.Children.Add(ucSerie);
            }

            return(panelSlots);
        }
        //creates the allocation panel for a specific timeslot
        private WrapPanel createSlotsPanel(Dictionary<TimeSpan, KeyValuePair<int,int>> values, TimeSpan startTime, TimeSpan endTime)
        {
            WrapPanel panelSlots = new WrapPanel();
            panelSlots.Margin = new Thickness(0, 0, 0, 10);

            int maxValue = Math.Max(10,values.Max(v => v.Value.Key + v.Value.Value));

            double coeff = Convert.ToDouble(maxValue) / 100;

            var vs = (from v in values where v.Key>=startTime && v.Key<endTime select v);

            foreach (KeyValuePair<TimeSpan, KeyValuePair<int,int>> value in vs)
            {
                ucChartBar ucSerie = new ucChartBar();
                ucSerie.Value = value.Value.Key + value.Value.Value;
                ucSerie.Text = value.Key.Minutes == 0 ? new HourConverter().Convert(value.Key.Hours).ToString()  : value.Key.Minutes.ToString();
                ucSerie.FontSize = 10;
                ucSerie.FontWeight = value.Key.Minutes == 0 ? FontWeights.Bold : FontWeights.Regular;
                ucSerie.Width = value.Key.Minutes == 0 ? 30 : 25;

                ucSerie.ToolTip = createToolTip(value);

                ucSerie.BarHeight = Convert.ToDouble(value.Value.Value + value.Value.Key) / coeff;
                ucSerie.BarColor = getBarColor(value.Value.Value + value.Value.Key);

                panelSlots.Children.Add(ucSerie);
            }

            return panelSlots;
        }