/// <summary>
        /// Mains the specified arguments.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public static void Main(string [] args)
        {
            //TestMethods ( );
            //TestMethodPriority ( );
            Random random = new Random( );

            Console.WriteLine("How many windows");
            int numWidows = Int32.Parse(Console.ReadLine( ));

            Windows = new List <Window> (numWidows);
            for (int i = 0; i < Windows.Capacity; i++)
            {
                Window window = new Window( );
                Windows.Add(window);
            }            //end for loop
            //tempLines ( );
            //Console.WriteLine (ToStringConsole (Windows));
            ConventionRegistration conventionRegistration = new ConventionRegistration(Windows, -1000 * Math.Log(random.NextDouble( ), Math.E));
            //Menu ( );
        }        //End Main (string [ ])
        static void Main(string[] args)
        {
            Console.Title = "Ignace & Li -- Project 4 -- Convention Registration";

            int      numberOfRegistrants    = 1000;                                //Number of expected registrants
            int      expectedProcessingTime = 255;                                 //Expected processing time for one registrant (second)
            int      numberOfWindowsStaffed = 10;                                  //Number of registration windows
            int      timeRegistrationIsOpen = 10 * 60 * 60;                        //Number of open registration hours (default 10)
            double   minProcessingTime      = 90.0;
            DateTime timeWeOpen             = new DateTime(2015, 11, 15, 8, 0, 0); //Open hour of registration(default 8:00 AM)


            Utility.WelcomeMessage("Welcome to the Convention Registration Simulator!\n\n" +
                                   "By Shuhai Li & Caleb Ignace\n\n" +
                                   "November 16, 2015\n\n" +
                                   "Today, we will run a simulation of a registration process\n" +
                                   "at a conference between the hours 8 am and 6 pm; you will\n" +
                                   "be able to specify some of the conditions.\n\n" +
                                   "We would like to know when how many registration windows\n" +
                                   "must be open to keep the line down to a specific number."
                                   , "CSCI 2210-201", "Shuhai & Ignace");

            bool   notValid;
            string choose;

            Console.WriteLine("Time to run simulation (in seconds): " + timeRegistrationIsOpen + ", i.e. 10 hours");
            Console.WriteLine("Expected number of registrants: " + numberOfRegistrants);
            Console.WriteLine("Expected processing time: " + expectedProcessingTime);
            Console.WriteLine("Minimum processing time: " + minProcessingTime);
            Console.WriteLine("Number of windows staffed: " + numberOfWindowsStaffed + "\n");

            do
            {
                notValid = true;

                Console.WriteLine("Would you like to enter different values than the ones listed above? (Y/N): ");
                choose = Console.ReadLine().ToUpper();

                if (choose == "Y" || choose == "N")
                {
                    notValid = false;
                }
                else
                {
                    Console.WriteLine(" INVALID");
                }
            } while (notValid);

            if (choose == "Y")
            {
                do                  //Input seconds to run program
                {
                    notValid = true;

                    Console.WriteLine("How long (in seconds) would you like to run: ");

                    if (int.TryParse(Console.ReadLine(), out timeRegistrationIsOpen))
                    {
                        notValid = false;
                    }
                    else
                    {
                        Console.WriteLine(" INVALID");
                    }
                } while (notValid);

                do                  //take input from Console for the expected number of registrants
                {
                    notValid = true;

                    Console.WriteLine("Please supply the number of registrants that you expect: ");

                    if (int.TryParse(Console.ReadLine(), out numberOfRegistrants))
                    {
                        notValid = false;
                    }
                    else
                    {
                        Console.WriteLine(" INVALID");
                    }
                } while (notValid);

                do   //take input from Console for the expected processing time
                {
                    notValid = true;

                    Console.WriteLine("Please supply the expected processing time for each registrant (in seconds): ");

                    if (int.TryParse(Console.ReadLine(), out expectedProcessingTime))
                    {
                        notValid = false;
                    }
                    else
                    {
                        Console.WriteLine(" INVALID");
                    }
                } while (notValid);

                do                  //Input seconds to run program
                {
                    notValid = true;

                    Console.WriteLine("What is the minimum processing time (in seconds): ");

                    if (double.TryParse(Console.ReadLine(), out minProcessingTime))
                    {
                        notValid = false;
                    }
                    else
                    {
                        Console.WriteLine(" INVALID");
                    }
                } while (notValid);


                do                    //take input from Console for the number of registration windows
                {
                    notValid = true;

                    Console.WriteLine("Please supply number of windows you want to be staffed: ");

                    if (int.TryParse(Console.ReadLine(), out numberOfWindowsStaffed))
                    {
                        notValid = false;
                    }
                    else
                    {
                        Console.WriteLine(" INVALID");
                    }
                } while (notValid);
            }
            //Create an instance of ConventionRegistration
            ConventionRegistration CR = new ConventionRegistration(numberOfRegistrants, expectedProcessingTime,
                                                                   numberOfWindowsStaffed, timeRegistrationIsOpen, timeWeOpen, minProcessingTime);

            CR.GenerateArrivalEvents();              //generate arrival events
            CR.Simulate();                           //simulate the registration process

            Utility.GoodbyeMessage("It turns out that the longest line consisted of " + CR.GetLongestLineLength() +
                                   "\nregistrants at " + numberOfRegistrants + " expected registrants, an expected processing time of " +
                                   "\n" + expectedProcessingTime + ", and " + numberOfWindowsStaffed + " number of windows staffted.");
        }
        }        //End Main (string [ ])

        /// <summary>
        /// Menus this instance.
        /// </summary>
        /// <exception cref="InvalidCastException">
        /// </exception>
        public static void Menu( )
        {
            String Line;                                                //gets the user's input
            int    Choice  = 0;                                         //holds the user's choice
            bool   Option  = true;                                      //checks if the user entered a valid option
            bool   Option2 = true;                                      //checks to see if the numbers entered are valid


            while (Choice != 5)
            {
                Console.WriteLine("\n\nRegistration Demo Menu\n");                        //displays the menu
                Console.WriteLine("1. Set the number of Registrants \n" +
                                  "2. Set the number of hours open \n" +
                                  "3. Set the number of windows available \n" +
                                  "4. Set the average duration to register \n" +
                                  "5. Start Simulation \n" +
                                  "6. Exit\n");

                Console.WriteLine("\n\nType the number of your choice");

                Line   = Console.ReadLine( );                                 //gets the users choice
                Option = Int32.TryParse(Line, out Choice);                    //try to parse the input
                if (Option == true)                                           //checks if the value is valid
                {
                    if (Choice >= 1 && Choice <= 6)
                    {
                        switch (Choice)
                        {
                        case (1):
                            Console.WriteLine("\nPlease enter the amount of registrants expected: ");
                            Line    = Console.ReadLine( );
                            Option2 = Int32.TryParse(Line, out NumRegs);
                            if (Option2 == false)
                            {
                                Console.WriteLine("Invalid number input");
                                throw new InvalidCastException( );
                                //if the value input is not a valid integer, throws an exception to return to the menu
                            }
                            break;

                        case (2):
                            Console.WriteLine("\nPlease enter the number of hours the windows will be open: ");
                            Line    = Console.ReadLine( );
                            Option2 = float.TryParse(Line, out Hours);
                            if (Option2 == false)
                            {
                                Console.WriteLine("Invalid number input");
                                throw new InvalidCastException( );
                                //if the value input is not a valid integer, throws an exception to return to the menu
                            }

                            break;

                        case (3):
                            Console.WriteLine("\nPlease enter the number of Windows that will be open: ");
                            Line = Console.ReadLine( );

                            Option2 = Int32.TryParse(Line, out int NumWindows);
                            if (Option2 == false)
                            {
                                Console.WriteLine("Invalid number input");
                                throw new InvalidCastException( );
                                //if the value input is not a valid integer, throws an exception to return to the menu
                            }
                            Windows = new List <Window>(NumWindows);
                            for (int i = 0; i < Windows.Capacity; i++)
                            {
                                Window window = new Window();
                                Windows.Add(window);
                            }    //end for loop
                            break;

                        case (4):
                            Console.WriteLine("\nPlease enter the average time it takes to register: ");
                            Line    = Console.ReadLine( );
                            Option2 = float.TryParse(Line, out AvgTime);
                            if (Option2 == false)
                            {
                                Console.WriteLine("Invalid number input");
                                throw new InvalidCastException( );
                                //if the value input is not a valid integer, throws an exception to return to the menu
                            }
                            break;

                        case (5):
                            //ConventionRegistration conventionRegistration = new ConventionRegistration(Windows, NumRegs, AvgTime);
                            Windows = new List <Window>(8);
                            for (int i = 0; i < Windows.Capacity; i++)
                            {
                                Window window = new Window();
                                Windows.Add(window);
                            }
                            ConventionRegistration conventionRegistration = new ConventionRegistration(Windows, 1000, 4.5);
                            break;

                        case (6):
                            Environment.Exit(0);
                            break;

                        default:
                            throw new InvalidCastException();
                        }
                    }
                }
            }
        }
 /// <summary>
 /// Handles the Click event of the ButtonStart control. Creates a new ConventionRegistration object to run the simulation.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void ButtonStart_Click(object sender, EventArgs e)
 {
     ResetListBoxes(this);
     Conv = new ConventionRegistration(this);
 }