using System.Collections.Generic;
using System.Linq;
using OpenNest.Desktop.Interaction;
namespace OpenNest.Forms
{
///
/// The guard for plate commands (WinForms IsPlateWorkBusy): a running nesting job, or a
/// busy active tool on any view of the nest. The Select tool counts as busy while anything
/// is selected, as the WinForms select action does.
///
public static class PlateWorkGuard
{
/// What a refused plate command tells the user.
public const string BusyMessage = "Finish or cancel the current nesting or plate action first.";
/// Whether a plate command must wait: , or a busy tool among .
public static bool IsBusy(bool jobRunning, IEnumerable tools) =>
jobRunning || (tools ?? Enumerable.Empty()).Any(tool => tool?.IsBusy == true);
}
}