Michael Bucari-Tovo 1fdcea929f Form thread safety
2025-07-21 22:52:17 -06:00

24 lines
544 B
C#

using System;
using System.Windows.Forms;
namespace LibationWinForms.Dialogs.Login
{
public abstract class WinformLoginBase
{
protected Control Owner { get; }
protected WinformLoginBase(Control owner)
{
Owner = owner;
}
/// <returns>True if ShowDialog's DialogResult == OK</returns>
protected bool ShowDialog(Form dialog)
=> Owner.Invoke(() =>
{
var result = dialog.ShowDialog(Owner);
Serilog.Log.Logger.Debug("{@DebugInfo}", new { DialogResult = result });
return result == DialogResult.OK;
});
}
}