private static void ShowExampleTables()
        {
            Table table = new Table("One", "Two", "Three");

            table.AddRow("1", "2", "3");
            table.AddRow("Short", "item", "Here");
            table.AddRow("Longer items go here", "stuff stuff", "stuff");

            table.Config = TableConfiguration.Default();
            string test = String.Empty.PadRight(Console.WindowWidth, '-');

            Console.Write(test);
            Console.SetCursorPosition(0, 0);
            Console.Write(table.ToString());
            Console.WriteLine();
            table.Config = TableConfiguration.Markdown();
            Console.Write(table.ToString());
            Console.WriteLine();
            table.Config = TableConfiguration.MySql();
            Console.Write(table.ToString());
            Console.WriteLine();
            table.Config = TableConfiguration.MySqlSimple();
            Console.Write(table.ToString());
            Console.WriteLine();
            table.Config = TableConfiguration.Unicode();
            Console.Write(table.ToString());
            Console.WriteLine();
            table.Config = TableConfiguration.UnicodeAlt();
            Console.Write(table.ToString());
            Console.WriteLine();
        }
Exemplo n.º 2
0
        private static void ShowExampleTables()
        {
            ShowAlignedTables();
            Console.WriteLine();

            Table table = new Table("One", "Two", "Three");

            table.AddRow("1", "2", "3");
            table.AddRow("Short", "item", "Here");
            table.AddRow("Longer items go here", "stuff stuff", "stuff");

            table.Config = TableConfiguration.Default();

            Console.Write(table.ToString());
            Console.WriteLine();
            table.Config = TableConfiguration.Markdown();
            Console.Write(table.ToString());
            Console.WriteLine();
            table.Config = TableConfiguration.MySql();
            Console.Write(table.ToString());
            Console.WriteLine();
            table.Config = TableConfiguration.MySqlSimple();
            Console.Write(table.ToString());
            Console.WriteLine();
            table.Config = TableConfiguration.Unicode();
            Console.Write(table.ToString());
            Console.WriteLine();
            table.Config = TableConfiguration.UnicodeAlt();
            Console.Write(table.ToString());
            Console.WriteLine();
        }
Exemplo n.º 3
0
        private static void ShowAlignedTables()
        {
            Console.WriteLine();
            Table1();
            Console.WriteLine();
            Table2();
            Console.WriteLine();

            void Table1()
            {
                ColumnHeader[] headers = new[]
                {
                    new ColumnHeader("Left"),
                    new ColumnHeader("Right", Alignment.Right, Alignment.Right),
                    new ColumnHeader("Center", Alignment.Center, Alignment.Center),
                };

                Table table = new Table(headers);

                table.Config = TableConfiguration.MySqlSimple();
                table.AddRow("1", "2", "3");
                table.AddRow("Short", "item", "Here");
                table.AddRow("Longer items go here", "stuff stuff", "some centered thing");

                Console.Write(table.ToString());
            }

            void Table2()
            {
                ColumnHeader[] headers = new[]
                {
                    new ColumnHeader("Left"),
                    new ColumnHeader("Left Header", Alignment.Right),
                    new ColumnHeader("Right Header", Alignment.Center, Alignment.Right),
                };
                Table table = new Table(headers);

                table.Config = TableConfiguration.MySqlSimple();
                table.AddRow("1", "2", "3");
                table.AddRow("Short", "item", "Here");
                table.AddRow("Longer items go here", "Right Contents", "Centered Contents");

                Console.Write(table.ToString());
            }
        }
Exemplo n.º 4
0
        /*
         * Draw a table of Available Places
         */
        public static void PlaceNumber(List <Place> placesList)
        {
            if (placesList.Count != 0)
            {
                // Create the columns
                ColumnHeader[] headers = new[] {
                    new ColumnHeader(" PLACE NUMBER ", Alignment.Right, Alignment.Center),
                };
                Table table = new Table(headers);

                // Add the row of the table
                StringBuilder result  = new StringBuilder(" ");
                int           counter = 0;
                foreach (Place p in placesList)
                {
                    if (counter != placesList.Count - 1)
                    {
                        result.Append(p.PlaceNumber + ",  ");
                    }
                    else
                    {
                        result.Append(p.PlaceNumber + " ");
                    }
                    counter++;
                }
                table.AddRow(result);

                // Format the table
                table.Config = TableConfiguration.MySqlSimple();

                Output.WriteLine(table.ToString());
            }
            else
            {
                Console.WriteLine("There are no Available Places in the DataBase!");
            }
        }