コード例 #1
0
ファイル: GetCommand.cs プロジェクト: cybermv/BucketList
        private void PrintEntryList(List <BucketListEntry> entries)
        {
            if (!entries.Any())
            {
                ConsoleWriter.WriteLine("No entries found", ConsoleColor.Yellow);
                return;
            }

            ConsoleWriter.WriteLine(TableTopBorder);
            ConsoleWriter.WriteLine(TableCaption);

            for (int idx = 0; idx < entries.Count; idx++)
            {
                BucketListEntry entry = entries[idx];

                if (idx > 0 && idx % PageSize == 0)
                {
                    ConsoleWriter.Write("{0} more entries; Press any key to continue or X to stop",
                                        ConsoleColor.Green,
                                        entries.Count - idx);
                    ConsoleKeyInfo key = Console.ReadKey(true);
                    ConsoleWriter.ClearCurrentConsoleLine();
                    if (key.Key == ConsoleKey.X)
                    {
                        break;
                    }
                }

                ConsoleWriter.WriteLine(TableEntryTemplate,
                                        entry.Id,
                                        entry.Description,
                                        entry.Difficulty.ToDisplayString(),
                                        entry.CreatedDate.ToString("d"),
                                        entry.CheckedDate?.ToString("d"));
            }

            ConsoleWriter.WriteLine(TableTopBorder);
        }