This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
UpTool2/UpTool2/TaskPreview.cs

23 lines
739 B
C#

using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using UpTool2.Task;
namespace UpTool2
{
internal static class TaskPreview
{
public static void Show(ref List<IAppTask> tasks)
{
using Form tmp = new Form {Size = new Size(600, 300)};
using CheckedListBox list = new CheckedListBox {Dock = DockStyle.Fill};
list.Items.AddRange(tasks.ToArray());
for (int i = 0; i < tasks.Count; i++)
list.SetItemChecked(i, true);
tmp.Controls.Add(list);
tmp.ShowDialog();
tasks = list.Items.OfType<IAppTask>().Where((s, i) => list.GetItemChecked(i)).ToList();
}
}
}