dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.4k stars 977 forks source link

Introduce ShowDialogAsync on Form #5917

Closed KlausLoeffelmann closed 1 month ago

KlausLoeffelmann commented 3 years ago

Rationale

Fluent and responsive desktop UI are not exclusive domains of UWP, WinUi or WPF. WinForm is also capable of this, not only in principle: In order to guarantee fluid WinForms app and to exclude "application not responding" messages, it should also be possible in WinForms to apply the programming paradigm with async and await that is predominant in .NET [Core] anyway.

Showing a modal Dialog asynchronously is an important element in this context.

Proposed API

var dialogResult=await Form1.ShowDialogSync([IWin43Window owner]);
KlausLoeffelmann commented 3 years ago

Locked this for now, since it's work in progress.

KlausLoeffelmann commented 2 years ago

Unlocked. Let's discuss from here.

janseris commented 1 year ago

What is the added value from this? How does this make application more responsive than the regular call which blocks UI thread during InitializeComponent of the dialog and when it's rendered (because how else would you do it anyways? there is no I/O to be asynchronous here or is it)?