예제 #1
0
        public static void WithTask(this IProgressContext ctx, string description, Action <IProgressTask> predicate)
        {
            var task = ctx.AddTask(description);

            predicate(task);
            task.StopTask();
        }
예제 #2
0
        public static async Task <T> WithTaskAsync <T>(this IProgressContext ctx, string description, Func <IProgressTask, Task <T> > predicate)
        {
            var task   = ctx.AddTask(description);
            var result = await predicate(task);

            task.StopTask();
            return(result);
        }
예제 #3
0
        public static async Task WithTaskAsync(this IProgressContext ctx, string description, Func <IProgressTask, Task> predicate)
        {
            var task = ctx.AddTask(description);

            await predicate(task);

            task.StopTask();
        }