Return Value From ShowForm Method

PHOTO EMBED

Mon Aug 22 2022 13:03:56 GMT+0000 (UTC)

Saved by @HristoT #c#

private DialogResultT<XXX> ShowForm()
{
    XXX model = null;

    var res = new FormEx<XXX>()
        .LoadForm(form =>
        {
            form.btnSave.Click += (s, e) =>
            {
                model = new XXX();
                form.CloseResultYes();
            };

            form.btnClose.Click += (s,e) => form.CloseResultCancel();
        })
        .ShowDialog();

    return new DialogResultT<XXX>(model, res.form.DialogResult);
}
content_copyCOPY