コード例 #1
0
ファイル: Program.cs プロジェクト: Sorster/Class-Collection
        static void Main(string[] args)
        {
            SuperObjectManager superObjectManager = new SuperObjectManager();

            do
            {
                ShowMenu();
                Menu choice = InputMenu();

                Console.Clear();

                if (choice == Menu.Exit)
                {
                    break;
                }

                if (superObjectManager.IsEmpty() && choice != Menu.AddElement)
                {
                    Console.WriteLine("Collection is empty!");
                    Console.WriteLine("Refer to elemnts addition...");
                    Console.ReadKey();
                    choice = Menu.AddElement;
                    Console.Clear();
                }

                switch (choice)
                {
                case Menu.AddElement:
                    superObjectManager.AddElement();
                    break;

                case Menu.ShowElements:
                    superObjectManager.ShowElements();
                    break;

                case Menu.Sort:
                    Sort(superObjectManager);
                    break;

                case Menu.RemoveElement:
                    superObjectManager.RemoveElement();
                    break;

                case Menu.RemoveAll:
                    superObjectManager.RemoveAll();
                    break;

                case Menu.Search:
                    superObjectManager.Search();
                    break;

                default:
                    Console.WriteLine("Wrong command!");
                    break;
                }

                Console.WriteLine("Inout any key to continue...");
                Console.ReadKey();
                Console.Clear();
            } while (true);
        }