PowerArgs.Cli.CliProgressBar.RenderUntilIndeterminate C# (CSharp) Method

RenderUntilIndeterminate() public method

Renders the progress bar and shows an indeterminate progress animation. Simultaneously, the work action is started. The bar will animate as long as the work action is running.
public RenderUntilIndeterminate ( System.Action workAction ) : void
workAction System.Action
return void
        public void RenderUntilIndeterminate(Action workAction)
        {
            Task workTask = new Task(workAction);
            workTask.Start();
            RenderUntilIndeterminate(workTask);
        }

Same methods

CliProgressBar::RenderUntilIndeterminate ( Task workTask ) : void

Usage Example

Example #1
0
        private static void IndeterminateSample()
        {
            Console.WriteLine("\nThis progress bar shows indeterminate progress as long as it takes to run the given action");

            var bar = new CliProgressBar("Please wait");

            bar.RenderUntilIndeterminate(() =>
            {
                bar.Message = "Phase 1".ToConsoleString();
                Thread.Sleep(1000);
                bar.Message = "Phase 2".ToConsoleString();
                Thread.Sleep(1000);
                bar.Message = "Phase 3".ToConsoleString();
                Thread.Sleep(1000);
            });
        }