naps2/NAPS2.Lib/EtoForms/Ui/BatchPromptForm.cs
2024-08-11 21:01:31 -07:00

47 lines
1.3 KiB
C#

using Eto.Forms;
using NAPS2.EtoForms.Layout;
namespace NAPS2.EtoForms.Ui;
public class BatchPromptForm : EtoDialogBase
{
private readonly Button _scanButton;
public BatchPromptForm(Naps2Config config, IIconProvider iconProvider) : base(config)
{
var scanNextCommand = new ActionCommand(() =>
{
Result = true;
Close();
})
{
Text = UiStrings.Scan,
Image = iconProvider.GetIcon("control_play_blue_small")
};
_scanButton = C.Button(scanNextCommand, ButtonImagePosition.Left);
DefaultButton = _scanButton;
}
public int ScanNumber { get; set; }
public bool Result { get; private set; }
protected override void BuildLayout()
{
Title = UiStrings.BatchPromptFormTitle;
FormStateController.SaveFormState = false;
FormStateController.RestoreFormState = false;
FormStateController.Resizable = false;
LayoutController.Content = L.Column(
C.Label(string.Format(UiStrings.ReadyForScan, ScanNumber)).NaturalWidth(200),
C.Filler(),
L.Row(
L.OkCancel(
_scanButton.Scale(),
C.CancelButton(this, UiStrings.Done).Scale())
)
);
}
}