Example #1
0
        public void Run()
        {
            using (Spinner spinner = new Spinner(SpinnerTemplate))
            {
                spinner.MarginTop    = 2;
                spinner.MarginBottom = 2;
                spinner.FrameIntervalMilliseconds = SpinnerStepMilliseconds;
                spinner.Label = new InlineTextBlock
                {
                    Text        = "Doing some work",
                    MarginRight = 1
                };

                spinner.Display();

                try
                {
                    // Simulate work
                    Thread.Sleep(WorkPeriod);

                    spinner.DoneText = new InlineTextBlock("[Done]", CustomConsole.SuccessColor);
                    spinner.Close();
                }
                catch
                {
                    spinner.DoneText = new InlineTextBlock("[Error]", CustomConsole.ErrorColor);
                    spinner.Close();
                }
            }
        }