Esempio n. 1
0
        private static void RunDemos()
        {
            bool exitWasRequested = false;

            TextMenu textMenu = new TextMenu();

            textMenu.AddItems(new[]
            {
                new TextMenuItem
                {
                    Id      = "1",
                    Text    = "Default",
                    Command = new DefaultCommand()
                },
                new TextMenuItem
                {
                    Id      = "2",
                    Text    = "Custom Unlock Key",
                    Command = new CustomUnlockKeyCommand()
                },
                new TextMenuItem
                {
                    Id      = "3",
                    Text    = "Erasable Pause",
                    Command = new ErasablePauseCommand()
                },
                new TextMenuItem
                {
                    Id      = "4",
                    Text    = "Custom Margins",
                    Command = new CustomMarginsCommand()
                },
                new TextMenuItem
                {
                    Id      = "5",
                    Text    = "Custom Paddings",
                    Command = new CustomPaddingsCommand()
                },
                new TextMenuItem
                {
                    Id      = "6",
                    Text    = "Foreground Color",
                    Command = new ForegroundColorCommand()
                },
                new TextMenuItem
                {
                    Id      = "7",
                    Text    = "Background Color",
                    Command = new BackgroundColorCommand()
                },
                new TextMenuItem
                {
                    Id      = "0",
                    Text    = "Exit",
                    Command = new ActionCommand(() =>
                    {
                        exitWasRequested = true;
                    })
                }
            });

            while (!exitWasRequested)
            {
                textMenu.Display();
            }
        }