Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }