Example #1
0
        /// <summary>
        /// Defines brush to draw stop element.
        /// </summary>
        /// <param name="stop">Stop.</param>
        /// <param name="context">Drawing context.</param>
        /// <returns></returns>
        private static Brush _GetFillBrush(StopInfo stopInfo, GanttItemElementDrawingContext context)
        {
            Debug.Assert(context != null);

            // Define selected color.
            if (context.DrawSelected)
            {
                return(GanttControlHelper.GetSelectedBrush());
            }

            // Define location color.
            if (stopInfo.Stop.StopType == StopType.Location)
            {
                return(GanttControlHelper.GetLocationBrush());
            }

            // Define Break color.
            if (stopInfo.Stop.StopType == StopType.Lunch)
            {
                return(GanttControlHelper.GetBreakBrush());
            }

            // Define locked color.
            if (stopInfo.Stop.IsLocked || (stopInfo.Route != null && stopInfo.Route.IsLocked))
            {
                return(GanttControlHelper.GetLockedBrush(stopInfo.Route.Color));
            }

            // If stop is Order, not locked, not selected and not dragged over - return normal fill color.
            return(GanttControlHelper.GetFillBrush(stopInfo.Route.Color));
        }
Example #2
0
        /// <summary>
        /// Defines brush to draw drivetime element.
        /// </summary>
        /// <param name="context">Drawing context.</param>
        /// <returns></returns>
        private Brush _GetFillBrush(GanttItemElementDrawingContext context)
        {
            Debug.Assert(_stop != null);
            Debug.Assert(_route != null);
            Debug.Assert(context != null);

            // Define selected color.
            if (context.DrawSelected)
            {
                return(GanttControlHelper.GetSelectedBrush());
            }

            // Define dragged over color.
            if (context.DrawDraggedOver)
            {
                return(GanttControlHelper.GetDragOverBrush());
            }

            // Define locked color.
            if (_stop.IsLocked || _route.IsLocked)
            {
                return(GanttControlHelper.GetLockedBrush(_route.Color));
            }

            // If stop is Order, not locked, not selected and not dragged over - return normal fill color.
            return(GanttControlHelper.GetFillBrush(_route.Color));
        }