Exemple #1
0
        private void WaitForBackspace()
        {
            ConsoleKeyInfo _lastPressedKey;

            do
            {
                _lastPressedKey = Console.ReadKey();
            } while (_lastPressedKey.Key != ConsoleKey.Backspace);

            //After enter has been presset, return to prev
            PrevMenuItem.Select();
        }
 public override void Select()
 {
     if (MenuItems.Count <= 0)
     {
         try
         {
             foreach (string entry in Directory.GetDirectories(_directoryInfo.FullName))
             {
                 MenuItems.Add(new FileSystemMenu(entry, new DirectoryInfo(entry)));
             }
         }
         catch (UnauthorizedAccessException ex)
         {
             Console.WriteLine("Unauthorized Access\n");
             Thread.Sleep(3000); // wait 3 seconds
             PrevMenuItem.Select();
         }
     }
     Start();
 }
Exemple #3
0
        private void WaitForKeys()
        {
            bool running = true;

            do
            {
                ConsoleKeyInfo cki = Console.ReadKey();
                switch (cki.Key)
                {
                case ConsoleKey.Backspace:
                    running = false;
                    PrevMenuItem.Select();
                    break;

                case ConsoleKey.Enter:
                    System.Diagnostics.Process.Start(_link);
                    break;
                }
            } while (running);
        }