public static Task <Choice?> ChooseAsync( this IReadOnlyList <Choice> choices, Point screenPoint) { var model = new ChooserViewModel(choices); var tcs = new TaskCompletionSource <Choice?>(); model.Show(screenPoint, c => tcs.SetResult(c)); return(tcs.Task); }
public static Task <Choice?> ChooseAsync( this IReadOnlyList <Choice> choices, UIElement?placementTarget, PlacementMode placementMode) { var model = new ChooserViewModel(choices); var tcs = new TaskCompletionSource <Choice?>(); model.Show(placementTarget, placementMode, c => tcs.SetResult(c)); return(tcs.Task); }