public static async Task WaitForLoadedAsync(this FrameworkElement element) { await EventAsync.FromRoutedEvent( handler => element.Loaded += handler, handler => element.Loaded -= handler ); }
public static async Task <RoutedEventArgs> WaitForClickAsync(this ButtonBase button) { return(await EventAsync.FromRoutedEvent( handler => button.Click += handler, handler => button.Click -= handler )); }