Exemple #1
0
        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)))
            {
                // TODO: find out how we are getting a null task item in the list
                if (taskItem == null)
                {
                    continue;
                }

                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 * GuiWidget.DeviceScale
                };

                tasksContainer.AddChild(runningTaskPanel);
            }

            if (!string.IsNullOrEmpty(ApplicationController.Instance.UiHint))
            {
                statusMessage.Text    = ApplicationController.Instance.UiHint;
                statusMessage.Visible = true;
                var parent = statusMessage.Parent;
                if (parent.Children.IndexOf(statusMessage) != parent.Children.Count - 1)
                {
                    parent.RemoveChild(statusMessage);
                    statusMessage.ClearRemovedFlag();
                    parent.AddChild(statusMessage);
                }
            }
            else
            {
                statusMessage.Visible = false;
            }

            tasksContainer.Invalidate();
        }
Exemple #2
0
        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)))
            {
                // TODO: find out how we are getting a null task item in the list
                if (taskItem == null)
                {
                    continue;
                }

                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();
        }