Ejemplo n.º 1
0
 /// <summary>
 /// Adds the specified unit as a passing unit
 /// </summary>
 /// <param name="calendarTimeScaleUnit"></param>
 internal void AddUnitPassing(CalendarTimeScaleUnit calendarTimeScaleUnit)
 {
     if (!UnitsPassing.Contains(calendarTimeScaleUnit))
     {
         UnitsPassing.Add(calendarTimeScaleUnit);
     }
 }
Ejemplo n.º 2
0
        public override void OnDrawTimeScale(CalendarRendererEventArgs e)
        {
            int margin  = 5;
            int largeX1 = TimeScaleBounds.Left + margin;
            int largeX2 = TimeScaleBounds.Right - margin;
            int shortX1 = TimeScaleBounds.Left + TimeScaleBounds.Width / 2;
            int shortX2 = largeX2;
            int top     = 0;
            Pen p       = new Pen(ColorTable.TimeScaleLine);

            for (int i = 0; i < e.Calendar.Days[0].TimeUnits.Length; i++)
            {
                CalendarTimeScaleUnit unit = e.Calendar.Days[0].TimeUnits[i];

                if (!unit.Visible)
                {
                    continue;
                }

                top = unit.Bounds.Top;

                if (unit.Minutes == 0)
                {
                    e.Graphics.DrawLine(p, largeX1, top, largeX2, top);
                }
                else
                {
                    e.Graphics.DrawLine(p, shortX1, top, shortX2, top);
                }
            }

            if (e.Calendar.DaysMode == CalendarDaysMode.Expanded &&
                e.Calendar.Days != null &&
                e.Calendar.Days.Length > 0 &&
                e.Calendar.Days[0].TimeUnits != null &&
                e.Calendar.Days[0].TimeUnits.Length > 0
                )
            {
                top = e.Calendar.Days[0].BodyBounds.Top;

                //Timescale top line is full
                e.Graphics.DrawLine(p, TimeScaleBounds.Left, top, TimeScaleBounds.Right, top);
            }

            p.Dispose();

            base.OnDrawTimeScale(e);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Updates the value of <see cref="TimeUnits"/> property
        /// </summary>
        internal void UpdateUnits()
        {
            int factor = 0;

            switch (Calendar.TimeScale)
            {
            case CalendarTimeScale.SixtyMinutes:    factor = 1;     break;

            case CalendarTimeScale.ThirtyMinutes:   factor = 2;     break;

            case CalendarTimeScale.FifteenMinutes:  factor = 4;     break;

            case CalendarTimeScale.TenMinutes:      factor = 6;     break;

            case CalendarTimeScale.SixMinutes:      factor = 10;    break;

            case CalendarTimeScale.FiveMinutes:     factor = 12;    break;

            default: throw new NotImplementedException("TimeScale not supported");
            }

            _timeUnits = new CalendarTimeScaleUnit[24 * factor];

            int hourSum = 0;
            int minSum  = 0;

            for (int i = 0; i < _timeUnits.Length; i++)
            {
                _timeUnits[i] = new CalendarTimeScaleUnit(this, i, hourSum, minSum);

                minSum += 60 / factor;

                if (minSum >= 60)
                {
                    minSum = 0;
                    hourSum++;
                }
            }

            UpdateHighlights();
        }
 public CalendarRendererTimeUnitEventArgs(CalendarRendererEventArgs original, CalendarTimeScaleUnit unit)
     : base(original)
 {
     _unit = unit;
 }