Esempio n. 1
0
        private void View()
        {
            ShowForm();
            Console.CursorVisible = false;

            Dictionary <ConsoleKey, Action> keyChoices = new Dictionary <ConsoleKey, Action>()
            {
                { ConsoleKey.Escape, () => { } }
            };

            if (HasPermissionTo(_RealLoggedUser.CanEdit))
            {
                ColoredConsole.Write("  [Enter] => Edit", 1, LastTextBoxY + 2, ConsoleColor.DarkGray);
                keyChoices.Add(ConsoleKey.Enter, FillForm);
            }

            if (HasPermissionTo(_RealLoggedUser.CanDelete))
            {
                ColoredConsole.Write(" [Delete] => Delete", 1, LastTextBoxY + 3, ConsoleColor.DarkGray);
                keyChoices.Add(ConsoleKey.Delete, AskAndDelete);
            }

            ReadKey <Action> readKey = new ReadKey <Action>(keyChoices);

            readKey.GetKey()();
        }
Esempio n. 2
0
        static public MessageBoxResult Show(string message)
        {
            Console.CursorVisible = false;
            ShowMessageInBox(message);

            return(_readKey.GetKey());
        }
Esempio n. 3
0
        public bool ChooseListItem()
        {
            Id = -1;

            while (Id == -1)
            {
                GeneratePageMenuChoices();
                Show();
                ReadKey <Action> readKey = new ReadKey <Action>(GetKeyChoices());
                readKey.GetKey()();
            }

            return(Id != 0);
        }
Esempio n. 4
0
        private void View()
        {
            ShowForm();
            ColoredConsole.Write("  [Enter] => Edit", 1, LastTextBoxY + 2, ConsoleColor.DarkGray);
            ColoredConsole.Write(" [Delete] => Delete", 1, LastTextBoxY + 3, ConsoleColor.DarkGray);

            Console.CursorVisible = false;

            ReadKey <Action> readKey = new ReadKey <Action>(
                new Dictionary <ConsoleKey, Action>()
            {
                { ConsoleKey.Enter, FillForm },
                { ConsoleKey.Delete, AskAndDelete },
                { ConsoleKey.Escape, () => { } },
            });

            readKey.GetKey()();
        }