Here is an extension method you can use. Unsubscribing from the Click event is important to avoid memory leaks, because event publishers keep references of event subscribers.
public static Task OnClickAsync(this Control source)
{
var tcs = new TaskCompletionSource();
source.Click += OnClick;
return tcs.Task;
void OnClick(object sender, EventArgs e)
{
source.Click -= OnClick;
tcs.SetResult(true);
}
}
Usage example:
await Button1.OnClickAsync();