Advertisement
Jakobhorak28

Untitled

Oct 8th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             ConsoleKeyInfo cki;
  14.  
  15.             Console.TreatControlCAsInput = true;
  16.             Console.WriteLine("Press Shift+S for more informations");
  17.  
  18.             do
  19.             {
  20.  
  21.                 cki = Console.ReadKey();
  22.                 Console.Write(" --- You pressed ");
  23.                 if ((cki.Modifiers & ConsoleModifiers.Shift) != 0) Console.Write("SHIFT+ ");
  24.                 Console.WriteLine(cki.Key.ToString());
  25.                 if (((cki.Modifiers & ConsoleModifiers.Shift) != 0) & (cki.Key == ConsoleKey.S)) Console.WriteLine(" Press T in order to get the key sequence to close the console");
  26.                 if (((cki.Modifiers & ConsoleModifiers.Alt) == 0) & ((cki.Modifiers & ConsoleModifiers.Control) == 0) & ((cki.Modifiers & ConsoleModifiers.Shift) == 0) & (cki.Key == ConsoleKey.T)) Console.WriteLine("If you press Shift+Alt+Ctrl+G it will show you the value of the key sequence");
  27.                 if (((cki.Modifiers & ConsoleModifiers.Alt) != 0) & ((cki.Modifiers & ConsoleModifiers.Control) != 0) & ((cki.Modifiers & ConsoleModifiers.Shift) != 0) & (cki.Key == ConsoleKey.G)) Console.WriteLine("Escape");
  28.  
  29.             } while (cki.Key != ConsoleKey.Escape);
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement