Ejemplo n.º 1
0
    public static void Main()
    {
        MaterialProperties materialProperties = new MaterialProperties();

        ElementType elementType = ElementType.NoVal;
        // Set to start in Main Menu
        State menuState = State.MainMenu;
        bool  quit      = false;


//        Console.WriteLine(Enum.GetNames(typeof(ElementType)).Length);

//        ElementType[] elemArray = (ElementType[])Enum.GetNames(typeof(ElementType));

        // Loop until 'q' is pressed
        string message = "";

        while (!quit)
        {
            // Main Menu
            if (menuState == State.MainMenu)
            {
                Console.Clear();
                Console.WriteLine(message);
                message = "";
                PrintMainMenu();

                string input = Console.ReadLine();

                // TODO: make then input value automatically pick the correct dictionary
                // entry
                switch (input)
                {
                case "1":
                    // Take to Material Property menu
                    elementType = ElementType.Al;
                    menuState   = State.EnterMaterialProps;
                    break;

                case "a":
                case "A":
                    materialProperties.Print();
                    menuState = State.DisplayResults;
                    break;

                case "q":
                case "Q":
                    quit = true;
                    continue;

                default:
                    message = "\n          INVALID SELECTION";
                    break;
                }
            }

            // Enter Properties
            else if (menuState == State.EnterMaterialProps)
            {
                Console.Clear();
                materialProperties.AssignElementProportion(elementType);
                menuState = State.MainMenu;
            }

            // Display Results
            else if (menuState == State.DisplayResults)
            {
                Console.Clear();
                Console.WriteLine();
                materialProperties.Print();

                Console.WriteLine("Enter to end");
                // Wait for enter:
                Console.ReadLine();
                quit = true;
            }
        }
    }