private void RenderRunningTasks(ThemeConfig theme, RunningTasksConfig tasks) { var rows = pendingTasksList.Children.OfType <RunningTaskRow>().ToList(); var displayedTasks = new HashSet <RunningTaskDetails>(rows.Select(taskRow => taskRow.taskDetails)); var runningTasks = tasks.RunningTasks; // Remove expired items foreach (var row in rows) { if (!runningTasks.Contains(row.taskDetails)) { row.Close(); } } var progressBackgroundColor = new Color(borderColor, 35); // Add new items foreach (var taskItem in tasks.RunningTasks.Where(t => !displayedTasks.Contains(t))) { var taskRow = new RunningTaskRow("", taskItem, theme) { HAnchor = HAnchor.Stretch, BackgroundColor = theme.AccentMimimalOverlay, Border = new BorderDouble(1, 1, 1, 0), BorderColor = borderColor, ProgressBackgroundColor = progressBackgroundColor }; pendingTasksList.AddChild(taskRow); } this.Visible = pendingTasksList.Children.Count > 0; pendingTasksList.Invalidate(); }
private void RenderRunningTasks(ThemeConfig theme, RunningTasksConfig tasks) { var rows = tasksContainer.Children.OfType <RunningTaskStatusPanel>().ToList(); var displayedTasks = new HashSet <RunningTaskDetails>(rows.Select(taskRow => taskRow.taskDetails)); var runningTasks = tasks.RunningTasks; // Remove expired items foreach (var row in rows) { if (!runningTasks.Contains(row.taskDetails)) { row.Close(); } } var progressBackgroundColor = new Color(theme.AccentMimimalOverlay, 35); // Add new items foreach (var taskItem in tasks.RunningTasks.Where(t => !displayedTasks.Contains(t))) { var runningTaskPanel = new RunningTaskStatusPanel("", taskItem, theme) { HAnchor = HAnchor.Absolute, VAnchor = VAnchor.Stretch, Margin = new BorderDouble(right: 2, top: 1, bottom: 1), Border = new BorderDouble(1), BorderColor = theme.SlightShade, ProgressBackgroundColor = progressBackgroundColor, Width = 200 }; tasksContainer.AddChild(runningTaskPanel); } tasksContainer.Invalidate(); }