Exemple #1
0
 public static void Readpath()
 {
     try
     {
         string text;
         using (StreamReader sr = new StreamReader(readPath, System.Text.Encoding.Default))
         {
             text = sr.ReadToEnd().ToLower().Trim();
         }
         if (text == "bin")
         {
             Bin bs = new Bin();
             Menu menu = new Menu(bs);
             menu.ShowMenu();
         }
         else if (text == "xml")
         {
             Xml xs = new Xml();
             Menu menu = new Menu(xs);
             menu.ShowMenu();
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("Ошибка: " + e.Message);
     }
 }
Exemple #2
0
 static void Main(string[] args)
 {
     Menu menu = new Menu();
     for (int i = 1; i > 0; i++)
     {
         menu.ShowStartMenu();
     }
 }
Exemple #3
0
        public int UseRobot()
        {
            List<string> armChoices = new List<string>(new string[] {
                "1: Shot Gun",
                "2: Machine Gun",
                "3: Lazer Gun"
                });
            List<string> legChoices = new List<string>(new string[] {
                "1: Two Legs",
                "2: Four Legs",
                "3: Tread Legs",
                "4: Hover Legs"
                });
            int robotChoice;
            string input;

                Console.WriteLine("It's time to build a robot");
                Menu leftArmMenu = new Menu("What type of left arm would you like?", armChoices);
                Menu rightArmMenu = new Menu("What type of left arm would you like?", armChoices);
                Menu legMenu = new Menu("What type of left arm would you like?", legChoices);
                int leftArmChoice = leftArmMenu.LimbMenu();
                int rightArmChoice = rightArmMenu.LimbMenu();
                int legChoice = legMenu.LimbMenu();
                Robot robot = new Robot(leftArmChoice, rightArmChoice, legChoice);
            do
            {
                Console.WriteLine("Now it is time to take over the world with your robot");
                Console.WriteLine(message);
                foreach (string choice in choices)
                {
                    Console.WriteLine(choice);
                }
                input = Console.ReadLine();
                if (int.TryParse(input, out robotChoice))
                {
                    Console.WriteLine(robotChoice);
                    robot.UseRobot(robotChoice);
                }
                else
                {
                    Console.WriteLine("Please try again");
                }
            }
            while (robotChoice != 4 && robotChoice != 5);
            return robotChoice;
        }
Exemple #4
0
        static void Main(string[] args)
        {
            int choice;
            List<string> menuChoice = new List<string>(new string[] {
                "1: Left Arm",
                "2: Right Arm",
                "3: Legs",
                "4: Start over",
                "5: Quit"
            });

            Menu main = new Menu("What would you like to use?", menuChoice);
            do
            {
                choice = main.UseRobot();
            } while (choice != 5);
        }