Example #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)
         }
     });
 }
Example #2
0
        private static void Main()
        {
            try
            {
                DisplayApplicationHeader();

                DemoApplication demoApplication = new DemoApplication();
                demoApplication.Run();
            }
            catch (Exception ex)
            {
                CustomConsole.WriteError(ex);
            }
        }
Example #3
0
        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);
        }