mirror of
https://github.com/cyanfish/naps2.git
synced 2024-08-16 10:40:35 +03:00
7f54aa63b0
Prefer OkCancel and set OK as the default button. That way keyboard navigation works well (Enter = OK, Esc = Cancel).
21 lines
723 B
C#
21 lines
723 B
C#
using Eto.Forms;
|
|
|
|
namespace NAPS2.EtoForms;
|
|
|
|
public class EtoOverwritePrompt : IOverwritePrompt
|
|
{
|
|
public OverwriteResponse ConfirmOverwrite(string path)
|
|
{
|
|
string fileName = Path.GetFileName(path);
|
|
var dialogResult = Invoker.Current.InvokeGet(() =>
|
|
MessageBox.Show(string.Format(MiscResources.ConfirmOverwriteFile, fileName),
|
|
MiscResources.OverwriteFile, MessageBoxButtons.YesNoCancel, MessageBoxType.Warning,
|
|
MessageBoxDefaultButton.Yes));
|
|
return dialogResult switch
|
|
{
|
|
DialogResult.Yes => OverwriteResponse.Yes,
|
|
DialogResult.No => OverwriteResponse.No,
|
|
_ => OverwriteResponse.Abort
|
|
};
|
|
}
|
|
} |