Пример #1
0
        public static void StartProgram()
        {
            while (true)
            {
                StandardMessages.MainMenu();     // A static method from the standard messages class and it returns a menu of options

                var option = Console.ReadLine(); // stores the option value of the user
                Console.WriteLine();

                if (option == "1")
                {
                    var          size  = StandardMessages.Size(); // returns the size inputed by the user
                    StackProgram stack = new StackProgram(size);  // Creates an instance of the stackProgram class
                    while (true)                                  // A continuous loop for the stack program class
                    {
                        stack.Run();                              // Runs the RUN Method in the stack program class
                    }
                }

                if (option == "2")
                {
                    var          size  = StandardMessages.Size(); // returns the size inputed by the user
                    QueueProgram queue = new QueueProgram(size);  // Creates an object of the QueueProgram class
                    while (true)                                  // A continuous loop for the queue program class
                    {
                        {
                            queue.Run(); // Runs the RUN Method in the queue Program class
                        }
                    }
                }

                if (option == "3")
                {
                    LinkedListProgram linkedList = new LinkedListProgram(); // Created an instance of the LinkedListProgram class
                    while (true)                                            // A continuous loop for the linkedList program class
                    {
                        {
                            linkedList.Run(); // Runs the RUN Method in the linkedListProgram class
                        }
                    }
                }
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendLine("Application starting");
            builder.AppendLine("1. Service Bus Application");
            builder.AppendLine("2. Redis Cache");
            builder.AppendLine("3. Function app");
            builder.AppendLine("4. Blob Storage Account");
            builder.AppendLine("5. Table Storage Account");
            builder.AppendLine("6. Queue Storage Account");
            builder.AppendLine("7. Cosmos DB : MongoDB Driver");
            builder.AppendLine("8. Cosmos DB : MongoDB Driver Single Instance");
            builder.AppendLine("9. Cosmos DB : SQL API");
            builder.AppendLine("Enter your choice: ");
            bool run    = true;
            var  logger = new FileLogger("logger.txt");

            while (run)
            {
                Console.Clear();
                IProgram program;
                Console.Write(builder.ToString());
                int choice = 0;
                int.TryParse(Console.ReadLine(), out choice);

                switch (choice)
                {
                case 1:
                    program = new ServiceBusProgram();
                    break;

                case 2:
                    program = new RedisProgram();
                    break;

                case 3:
                    program = new BlobProgram();
                    break;

                case 4:
                    program = new BlobProgram();
                    break;

                case 5:
                    program = new TableProgram();
                    break;

                case 6:
                    program = new QueueProgram();
                    break;

                case 7:
                    program = new MongoDriverProgram();
                    break;

                case 8:
                    program = new MongoDriverSingleInstanceProgram();
                    break;

                case 9:
                    program = new SQLProgram();
                    break;

                default:
                    program = null;
                    Environment.Exit(-1);
                    break;
                }
                program.Logger = logger;
                program.Run();
            }
            Console.ReadKey();
        }