private void CreateColumnTasks(List<StoryTask> storyTasks, Column column) { foreach (var key in storyYPositions.Keys) { xPos = SetXStartPos(column); yPos = storyYPositions[key]; var cardCount = 0; var stackCount = 0; var currentstoryTasks = storyTasks.Where(t => t.StoryNumber == key).ToList(); var maxCard = 10; if (column == Column.Testing) { maxCard = 5; } if (currentstoryTasks.Count >= maxCard) { currentstoryTasks = currentstoryTasks.Take(maxCard).ToList(); if (column == Column.Testing) { testingFull = true; } } currentstoryTasks = currentstoryTasks.OrderByDescending(st => st.Number).ToList(); foreach (var storyTask in currentstoryTasks) { var taskControl = new TaskControl(); var tcvm = new TaskCardViewModel { Users = sbvm.Users, StoryTask = storyTask }; if (testingFull) taskControl.BackgroundColour = Brushes.OrangeRed; else taskControl.BackgroundColour = Brushes.White; taskControl.DataContext = tcvm; taskControl.SetValue(Canvas.LeftProperty, xPos); taskControl.SetValue(Canvas.TopProperty, yPos); taskControl.MouseDown += ControlMouseDown; taskControl.MouseMove += ControlMouseMove; taskControl.MouseUp += ControlMouseUp; cardCount++; if (cardCount < 5) { SetXYForColumn(column); } else { stackCount++; xPos = SetXStartPos(column) + (CARD_WIDTH * stackCount) + 5; yPos = storyYPositions[key]; cardCount = 0; } SprintBoard.Children.Add(taskControl); } testingFull = false; } }
private void CreateColumnTasks(List <StoryTask> storyTasks, Column column) { foreach (var key in storyYPositions.Keys) { xPos = SetXStartPos(column); yPos = storyYPositions[key]; var cardCount = 0; var stackCount = 0; var currentstoryTasks = storyTasks.Where(t => t.StoryNumber == key).ToList(); var maxCard = 10; if (column == Column.Testing) { maxCard = 5; } if (currentstoryTasks.Count >= maxCard) { currentstoryTasks = currentstoryTasks.Take(maxCard).ToList(); if (column == Column.Testing) { testingFull = true; } } currentstoryTasks = currentstoryTasks.OrderByDescending(st => st.Number).ToList(); foreach (var storyTask in currentstoryTasks) { var taskControl = new TaskControl(); var tcvm = new TaskCardViewModel { Users = sbvm.Users, StoryTask = storyTask }; if (testingFull) { taskControl.BackgroundColour = Brushes.OrangeRed; } else { taskControl.BackgroundColour = Brushes.White; } taskControl.DataContext = tcvm; taskControl.SetValue(Canvas.LeftProperty, xPos); taskControl.SetValue(Canvas.TopProperty, yPos); taskControl.MouseDown += ControlMouseDown; taskControl.MouseMove += ControlMouseMove; taskControl.MouseUp += ControlMouseUp; cardCount++; if (cardCount < 5) { SetXYForColumn(column); } else { stackCount++; xPos = SetXStartPos(column) + (CARD_WIDTH * stackCount) + 5; yPos = storyYPositions[key]; cardCount = 0; } SprintBoard.Children.Add(taskControl); } testingFull = false; } }