public void SimpleIteration()
        {
            const int total = 100;

            using (var bar = new SingleLoadingBar(total))
            {
                for (int i = 0; i < total; i++)
                {
                    bar.Update();
                }
            }
        }
Пример #2
0
        private static void RunSingleLoadingBar()
        {
            using (var loadingBar = new SingleLoadingBar(1000))
            {
                for (int i = 0; i < loadingBar.Total; i++)
                {
                    if (i == loadingBar.Total / 100 * 10)
                        Console.Write("10%");
                    if (i == loadingBar.Total / 100 * 20)
                    {
                        Console.Write("20%");
                        Console.WriteLine(Environment.NewLine + "1/5");
                    }

                    if (i == loadingBar.Total / 100 * 30)
                        Console.Write("30%");
                    if (i == loadingBar.Total / 100 * 40)
                        Console.Write("40%");
                    if (i == loadingBar.Total / 100 * 50)
                        Console.Write("50%");
                    if (i == loadingBar.Total / 100 * 60)
                    {
                        Console.Write("60%");
                        Console.WriteLine(Environment.NewLine + "6/10");
                    }

                    if (i == loadingBar.Total / 100 * 70)
                        Console.Write("70%");
                    if (i == loadingBar.Total / 100 * 80)
                        Console.Write("80%");
                    if (i == loadingBar.Total / 100 * 90)
                        Console.Write("90%");
                    if (i == loadingBar.Total / 100 * 100)
                        Console.Write("100%");

                    loadingBar.Update();
                    Thread.Sleep(_millisecondsTimeout);
                }
            }
        }