コード例 #1
0
 private static IEnumerable <TextMenuItem> CreateMenuItems(DemoApplication demoApplication)
 {
     return(new[] {
         new TextMenuItem
         {
             Id = "1",
             Text = "Long/short titles",
             Command = new LongShortTitleCommand()
         },
         new TextMenuItem
         {
             Id = "2",
             Text = "Multiline titles",
             Command = new MultilineTitleCommand()
         },
         new TextMenuItem
         {
             Id = "3",
             Text = "Multiline cell content",
             Command = new MultilineCellCommand()
         },
         new TextMenuItem
         {
             Id = "4",
             Text = "Draw lines between rows",
             Command = new DrawLinesBetweenRowsCommand()
         },
         new TextMenuItem
         {
             Id = "5",
             Text = "Cell padding",
             Command = new CellPaddingCommand()
         },
         new TextMenuItem
         {
             Id = "11",
             Text = "Single-line Border",
             Command = new SingleLineBorderCommand()
         },
         new TextMenuItem
         {
             Id = "22",
             Text = "Double-line Border",
             Command = new DoubleLineBorderCommand()
         },
         new TextMenuItem
         {
             Id = "33",
             Text = "Simple Border",
             Command = new SimpleBorderCommand()
         },
         new TextMenuItem
         {
             Id = "0",
             Text = "Exit",
             Command = new ExitDemoCommand(demoApplication)
         }
     });
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: lastunicorn/ConsoleTools
        private static void Main()
        {
            try
            {
                DisplayApplicationHeader();

                DemoApplication demoApplication = new DemoApplication();
                demoApplication.Run();
            }
            catch (Exception ex)
            {
                CustomConsole.WriteError(ex);
            }
        }
コード例 #3
0
ファイル: MainMenu.cs プロジェクト: lastunicorn/ConsoleTools
        public MainMenu(DemoApplication demoApplication)
        {
            if (demoApplication == null)
            {
                throw new ArgumentNullException(nameof(demoApplication));
            }

            Margin = "0 1";

            QuestionText = new InlineTextBlock
            {
                Text        = "Make your choice:",
                MarginRight = 1
            };

            IEnumerable <TextMenuItem> menuItems = CreateMenuItems(demoApplication);

            AddItems(menuItems);
        }