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/UpToolEto/UpToolEto/Forms/QueueOverview.cs

47 lines
1.4 KiB
C#

using System.Collections.Generic;
using System.Linq;
using Eto.Forms;
using UpToolLib.v2.TaskQueue;
namespace UpToolEto.Forms
{
public class QueueOverview : Dialog
{
private readonly IList<AppTask> _tasks;
public bool Cancelled;
CheckBoxList cbl;
public List<AppTask> TasksResulting => cbl.SelectedValues.Select(s => (AppTask) s).ToList();
public QueueOverview(IList<AppTask> tasks)
{
_tasks = tasks;
StackLayout layout = new();
layout.Items.Add(new StackLayoutItem(new StackLayout()
{
Items =
{
new StackLayoutItem(new Button((_, _) =>
{
Cancelled = true;
Close();
})
{
Text = "Cancel"
}, HorizontalAlignment.Stretch),
new StackLayoutItem(new Button((_, _) =>
{
Close();
})
{
Text = "OK"
}, HorizontalAlignment.Stretch)
},
Orientation = Orientation.Horizontal
}, HorizontalAlignment.Stretch));
cbl = new CheckBoxList {DataStore = tasks, SelectedValues = tasks};
layout.Items.Add(cbl);
Content = layout;
}
}
}