Ejemplo n.º 1
0
        /// <summary>
        /// Distribute Items by row Layers strarting from provided layer
        /// </summary>
        /// <param name="row">Current row</param>
        /// <param name="layerNumber">Layer below which distribute Items</param>
        /// <returns>Are there intersected items at the layer.</returns>
        bool DistributeLayers(WeekPlannerRow row, int layerNumber)
        {
            bool isIntersection = false;
            //Selects all items at the row by layer number
            //var listLayer = row.Items.Where(l => l.Layer == layerNumber &&
            //    Helper.isDatesIntersect(CurrentDate.Date, CurrentDate.Date.AddDays(DayCount), l.StartDate.Date, l.EndDate.Date) ||
            //   Helper.isDatesIntersect(l.StartDate.Date, l.EndDate.Date, CurrentDate.Date, CurrentDate.Date.AddDays(DayCount))).ToList();
            var listLayer = row.Items.Where(l => l.Layer == layerNumber).ToList();

            foreach (var item in listLayer)
            {
                //if item is already distributed at the layer
                if (item.Layer == layerNumber)
                {
                    // Looks for the items which intersect with the provided item
                    var intersectItems = IntersectedItems(item, listLayer);
                    if (intersectItems.Count() > 0)
                    {
                        isIntersection = true;
                        // Intescted items increase layer number
                        foreach (var i in intersectItems)
                        {
                            i.Layer++;
                        }
                    }
                }
            }

            return(isIntersection);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// perform items layout by layers at the provided row
        /// </summary>
        /// <returns>Count of layers at the row</returns>
        private int PerformItemsLayout(WeekPlannerRow row)
        {
            var count = 0;

            for (int i = 0; i <= count; i++)
            {
                //if found intersected items at the layer increase layer count
                if (DistributeLayers(row, i))
                {
                    count++;
                }
            }
            row.LayerCount = count;
            return(count);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a new <see cref="WeekPlannerRow"/>
 /// </summary>
 /// <param name="row">Related row</param>
 /// <param name="button">Mouse Button Pressed</param>
 public RowClickEventArgs(WeekPlannerRow row, MouseButtons button)
 {
     _row    = row;
     _button = button;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a new <see cref="WeekPlannerRow"/>
 /// </summary>
 /// <param name="row">Related row</param>
 public RowEventArgs(WeekPlannerRow row)
 {
     _row = row;
 }