Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Diagnostics.CodeAnalysis;
- using System.Dynamic;
- using System.Globalization;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.IO;
- namespace CSLight
- {
- class Program
- {
- private static int index = 0;
- static void Main(string[] args)
- {
- //int index = 0;
- string[] menu = { "1. Добавить досье.", "2. Вывести досье.", "3. Удалить досье.", "4. Поиск по фамилии.", "5. Выход." };
- Console.CursorVisible = false;
- while(true)
- {
- string selectMenuItems = DrawMenu(menu);
- if(selectMenuItems == "1. Добавить досье.")
- {
- Console.Clear();
- Console.WriteLine("Привет!");
- //Console.Read();
- }
- else if(selectMenuItems == "2. Вывести досье.")
- {
- }
- else if (selectMenuItems == "3. Удалить досье.")
- {
- }
- else if (selectMenuItems == "4. Поиск по фамилии.")
- {
- }
- else if (selectMenuItems == "5. Выход.")
- {
- break;
- }
- }
- }
- static string DrawMenu(string[] items)
- {
- for (int i = 0; i < items.Length; i++)
- {
- if (i == index)
- {
- Console.BackgroundColor = ConsoleColor.Gray;
- Console.ForegroundColor = ConsoleColor.Black;
- Console.WriteLine(items[i]);
- }
- else
- {
- Console.WriteLine(items[i]);
- }
- Console.ResetColor();
- }
- ConsoleKeyInfo ckey = Console.ReadKey();
- if (ckey.Key == ConsoleKey.DownArrow)
- {
- if (index == items.Length - 1)
- {
- index = 0;
- }
- else
- {
- index++;
- }
- }
- else if (ckey.Key == ConsoleKey.UpArrow)
- {
- if (index <= 0)
- {
- index = items.Length - 1;
- }
- else
- {
- index--;
- }
- }
- else if (ckey.Key == ConsoleKey.Enter)
- {
- return items[index];
- }
- else
- {
- Console.Clear();
- }
- Console.Clear();
- return "";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment